亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Laravel 7.0 Cashier - Stripe 付款異常

Laravel 7.0 Cashier - Stripe 付款異常

PHP
Cats萌萌 2023-08-11 16:26:35
我在 Laravel Cashier Stripe 付款方面遇到問題。我需要將費用和新訂閱合二為一,這樣當出現 IncompletePayment 異常時我仍然可以獲得 stripe webhooks。try{  $user->charge(1000, $creditCard->id, [                'description' => 'Premium Registration',            ])  $user->newSubscription('premium_member', $recurring)          ->create($creditCard->id);}} catch (IncompletePayment $e) {            $intent = \Stripe\PaymentIntent::retrieve($e->payment->id);            $intent->confirm([                'return_url' => url('api/payments-3d-success'),            ]);            return response()->json([                'e' => $intent,            ]);        }另一種方法是捕獲異常并像 Laravel 一樣構建處理不完整異常的方法。try{  $subscription = \Stripe\Subscription::create([                'customer' => $customer->id,                'items' => [[                    'price' => $recurring,                ]],                'add_invoice_items' => [[                    'price' => $oneTime,                ]],            ]);}//I need to catch the exception here from stripe and build like a laravel way like IncompletePayment exceptionscatch(Exception $e){$intent = \Stripe\PaymentIntent::retrieve($e->payment->id);            $intent->confirm([                'return_url' => url('api/payments-3d-success'),            ]);            return response()->json([                'e' => $intent,            ]);}請告訴我你如何處理這個問題。謝謝
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 139 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號