[英]How to know if Stripe payment intent or session has been refunded?
The PaymentIntent itself will not change when the payment is refunded.退款时 PaymentIntent 本身不会改变。 In Stripe, refunds are created off of the underlying Charges.
在 Stripe 中,退款是根据基础费用创建的。 You can if a payment intent was refunded by checking its
latest_charge
's refunded
property.如果付款意向已通过检查其
latest_charge
的refunded
属性进行退款,则可以。
const paymentIntent = await stripe.paymentIntents.retrieve(
'pi_1234',
['expand' => ['latest_charge']]
);
const refunded = paymentIntent.latest_charge.refunded;
const amount_refunded = paymentIntent.latest_charge.amount_refunded;
);
[1] https://stripe.com/docs/api/errors?lang=node#errors-payment_intent-latest_charge [1] https://stripe.com/docs/api/errors?lang=node#errors-payment_intent-latest_charge
[2] https://stripe.com/docs/api/charges/object?lang=node#charge_object-refunded [2] https://stripe.com/docs/api/charges/object?lang=node#charge_object-refunded
Please provide some code to get help.请提供一些代码以获得帮助。
Here is an example from PaymentIntents
这是
PaymentIntents
的一个例子
const paymentIntent = await stripe.paymentIntents.retrieve(paymentIntentId);
console.log(paymentIntent)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.