How to get the charge Id after subscribing a customer to a plan with recurring payment?

百般思念 提交于 2020-01-06 07:11:10

问题


I have successfully created a customer in stripe with a subscription of plan .After successful payment I am not able to get the charge Id because after subscribing a customer to a plan.It automatically generates an invoice.So what is the way that I can get that particular charge stripe Id from stripe and store it in my system database.


回答1:


Getting the charge ID for a subscription (or an invoice) can be done via their webhooks integration. You need to expose an API in your app where Stripe can fire these requests. You can subscribe to various events there, but in your case you'd need to do so on charge.succeeded. The charge ID will be in the data structure of the event object.

Take a look at the various other lifecycle events you can use with webhooks.



来源:https://stackoverflow.com/questions/54476932/how-to-get-the-charge-id-after-subscribing-a-customer-to-a-plan-with-recurring-p

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!