简体   繁体   中英

Stripe - Refund Checkout Session

I'm trying to implement a method for my connected account owners to be able to refund charges collected via a Stripe Checkout Session.

In order to do so, I want to use the following code:

const refund = await stripe.refunds.create({
                payment_intent: pi_id,
 });

In order to obtain the payment_intent_id , I am listening to the checkout.session.completed webhook, and accessing data.object.payment_intent .

When I attempt to create a refund using this payment intent id, I get the No such paymentintent error from Stripe. I noticed in my Stripe test account that there is a charge ID associated with the payment, so maybe I should be using that - but I'm not sure how to retrieve that programmatically from the checkout session.

You're making the API call correctly.

“No such...” errors with Stripe are usually caused by either a mismatch in API keys (eg using a mixture of your test plus live keys) or by trying to access objects that exist on a different account (eg trying to perform an operation from your platform account on an object that was created on a connected account).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM