问题
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