简体   繁体   English

条纹 - 退款结帐 Session

[英]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.我正在尝试为我的关联帐户所有者实施一种方法,以便能够退还通过 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 .为了获得payment_intent_id ,我正在监听checkout.session.completed webhook,并访问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.当我尝试使用此付款意图 ID 创建退款时,我从 Stripe 收到No such paymentintent错误。 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.我注意到在我的 Stripe 测试帐户中有一个与付款相关的费用 ID,所以也许我应该使用它 - 但我不确定如何以编程方式从结帐 session 中检索它。

You're making the API call correctly.您正在正确地调用 API 。

“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). Stripe 的“No such...”错误通常是由于 API 密钥不匹配(例如使用您的测试和实时密钥的混合)或尝试访问存在于不同帐户上的对象(例如尝试执行在连接帐户上创建的 object 上从您的平台帐户进行操作)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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