【发布时间】: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