我在 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 关注
- 107 浏览
添加回答
举报
0/150
提交
取消