#raver-api
1 messages · Page 1 of 1 (latest)
hi 👋
@patent oriole for the first question, I would just test it, that's the fastest way.
let pi = await stripe.paymentIntents.create({
 amount: 1000,
 currency: 'usd',
 payment_method_types: ['card']
});
let success = await stripe.paymentIntents.cancel(pi.id);
// will fail since it's already cancelled
let error = await stripe.paymentIntents.cancel(pi.id);
simple as that really to see what happens and what is returned
for the second question, not sure what you mean exactly, can you elaborate? The API call is synchronous yes, it either returns an error, or the PaymentIntent object with the new status . Separately you'll receive webhooks also yep
ok, so then the way to check if it was successful, would be through either the response of the api call
or the incoming webhook?
both of them work, but for a synchronous call like that it seems easier to me to just check the API response immediately and do whatever update you need to do at that point rather than waiting for a webhook
does payment_intent.cancelled arrive at the webhook in other circumstances apart from when an api call is issued by the back end client? 😅
yes