【问题标题】:Stripe invoice items not adding to pending invoice条带发票项目未添加到待处理发票
【发布时间】:2016-06-20 06:33:15
【问题描述】:

我在 Stripe 中有一个现有客户,我们计划为该客户添加订阅。首先,我想添加一个发票项目,以便订阅在创建时将其提取并将其添加到待处理的发票中。下面的代码按顺序运行,但是,条带中的发票项目显示为立即付款,而不是添加到订阅的待处理发票中。据我所知,文档说我的说法是正确的,知道为什么发票项目没有添加到待处理的发票中吗?

try {
    \Stripe\InvoiceItem::create(
        array(
            "customer" => $customer['stripe_customer_id'],
            "amount" => $invoice_item_amount,
            "currency" => "usd",
            "description" => $product['description']
        )
    );
} catch(Error $e) {
    // do something
}

try {
    $result = $stripe_customerObj->subscriptions->create(
        array(
            "coupon"    => $coupon,
            "plan"      => $plan_id,
            "quantity"  => $quantity,
            "trial_end" => $trial_end_timestamp,
            "metadata"  => $metadata
        )
    );
} catch(Error $e) {
    // do something
}

当我在创建订阅后将InvoiceItem::create 移动到时,它起作用了。

【问题讨论】:

    标签: api stripe-payments invoice


    【解决方案1】:

    这是预期的行为。您拥有的代码创建一个发票项目,然后是一个带有试用版的订阅。该试用会创建一张 0 美元的发票,该发票会自动提取待处理的发票项目,包括您刚刚创建的发票项目。例如,如果您想在试用期内收取费用,您会使用此流程。

    如果您希望将待处理的发票项目添加到下一张发票中,则改为在订阅之后创建它。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-12-27
      • 2012-08-06
      • 1970-01-01
      相关资源
      最近更新 更多