![](/img/trans.png)
[英]Getting error with Stripe: No such payment_intent: 'my payment intent id'
[英]Stripe Refund with payment intent
使用取消 API 取消訂閱后
StripeConfiguration.ApiKey = "sk_testqweqwerty";
var service = new SubscriptionService();
var cancelOptions = new SubscriptionCancelOptions
{
InvoiceNow = false,
Prorate = false,
};
Subscription subscription = service.Cancel("sub_49qwertyz6a", cancelOptions);
我想將剩余天數的錢退還給客戶,我查看了 stripe api,發現我可以通過付款意向來完成。
StripeConfiguration.ApiKey = "sk_testqwertyS";
var refunds = new RefundService();
var refundOptions = new RefundCreateOptions {
PaymentIntent = "pi_qwewz01aDfoo"
};
var refund = refunds.Create(refundOptions);
我不單獨創建付款意圖 條紋是否有可能在幕后創建付款意圖? 我看到會話對象包含付款意圖,但是當我收到它時它為空。
這是我的流程,
我想知道訂閱對象或付款會話對象是否有任何選項將包含付款意圖 ID? 或者我必須與支付會話對象一起創建支付意圖對象?
您的訂閱會創建發票(在訂閱開始時和每個重復周期,例如每個月)。
每個 Invoice 對象都有一個關聯的 PaymentIntent(Stripe 用於創建費用的生命周期對象),這些是由 Stripe 自動創建的(這就是為什么您是正確的,您的集成不會創建它們,Stripe 會為您創建它們),它回答:
Stripe 是否有可能在幕后創建支付意圖?
您需要找到在訂閱 [0] 上支付的最新發票,其中將包含一個payment_intent: pi_123
字段payment_intent: pi_123
[1]。
然后,您為該 PaymentIntent [2] 創建部分或全部退款,以將資金返還給客戶。
[0] https://stripe.com/docs/api/invoices/list#list_invoices-subscription
[1] https://stripe.com/docs/api/invoices/object#invoice_object-payment_intent
[2] https://stripe.com/docs/api/refunds/create#create_refund-payment_intent
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.