sil*_*ver 10 webhooks stripe-payments
我在订阅时添加发票项目时遇到问题,目前正在敲打我的头.
我在条纹上创建了一个发票项目,我希望发票项目包含在定期付款中
这是我的代码,它在第一张发票上添加了发票项目,但在下一张发票上没有.
$new_customer = Stripe_Customer::create(array(
'card' => $card,
'email' => $email,)
);
Stripe_InvoiceItem::create(array(
'customer' => $new_customer['id'],
'amount' => $additiona_charges,
'currency' => 'gbp',
'description' => 'Addtional Cities'
));
$new_customer->updateSubscription(array('plan' => $selected_plan, 'prorate' => true));
Run Code Online (Sandbox Code Playgroud)
在我目前的设置.我根据订阅时的客户选择收取额外的自定义费用,这样我需要在定期付款时添加额外费用.
它是这样的
1 Cookie - 99GBP / Per month
2 Cookies - 199GBP / Per month
3 Cookies - 300GBP / Per month
Run Code Online (Sandbox Code Playgroud)
-With Candle - +20GBP // must be included on recurring payment.
-With Icecream - +26GBP // must be included on recurring payment.
-With Cheese - +28GBP // must be included on recurring payment.
-With Ketchup - +30 // must be included on recurring payment.
-With Poison (for your X) - +50 // must be included on recurring payment.
Run Code Online (Sandbox Code Playgroud)
我希望有人可以提供帮助.非常感谢
干杯肯恩
Ale*_*lex 16
我有一个用Stripe打开的支持问题,因此会在必要时更新.
但是,我刚刚重新阅读了有关计费结算的文档
帐户余额和发票项目只是对客户帐户的一次性调整,因此每个月都不会自动应用.
如果您的服务使用计费结算或需要为税金或其他动态成本添加自定义金额,则您需要每月创建发票项目.
它继续....
要开始使用,只需使用webhooks来监听invoice.created事件.无论何时打开发票进行修改,您的webhook端点都可以创建一个引用现有发票ID的发票项目.在向客户收费之前,我们会自动将此金额计入发票总额中.
因此,似乎我们需要创建一个Web挂钩处理程序,以便每个月重新添加这些发票项目.
根据发票上的文件
创建发票后,将自动尝试付款.请注意,付款虽然是自动的,但不会在创建发票时完全发生.如果您已配置webhooks,则发票将等到成功发送最后一个webhook后一小时(或最后一次webhook失败后超时).
这允许我们在尝试付款之前创建一个Web挂钩,以便修改发票.
我建议使用InvoiceCreatedWebhook流程
invoice.created事件的主体- 整个身体看起来像这样| 归档时间: |
|
| 查看次数: |
5142 次 |
| 最近记录: |