Striped webcams against synchronous charge

The Stripe documentation explains that their payment APIs are synchronous. Why do we need webcams?

If my application runs Stripe_Charge::create() (in PHP), then can I not accept the return value and register this as a successful transaction in our database and send an email confirmation in the same execution?

Are webhooks used only if you have another back-office system that needs to be notified? What other types of events are useful for listening to web hosting?

+6
source share
1 answer

When you call Stripe_Charge :: create (), you really can, as you stated, register this as a successful transaction (provided that it does not work) and send a confirmation email.

Webhooks are extremely useful when using the lane for managing recurring payments, for example, when selling a subscription. According to this scenario, many things happen that are not directly triggered by a user request.

Suppose, for example, that a user signs up for your Gold Plan, which has a 30-day free trial. Three days before the end of the trial period, the webcam customer.subscription.trial_will_end is launched. You can answer this by sending an email to the client in which he thanked you for interviewing your subscription and remind him that his card will be charged.

Then, 3 days after his card is debited and the payment is successful, you can answer the charge. Received a webhook to send him an invoice every month.

Another very useful webhook is charge.failed. Depending on your retry settings, you can respond to this by informing the user that their card is declining and notify him that his subscription will be terminated in a few days.

In general, if you do not use subscriptions or invoices, websites have limited utility. But if so, they are indispensable.

+11
source