问题
After integrating the stripe system using laravel cashier in our website, I did the testing with the test cards, few cards were successful and few were not. I have tried to adapt to the 3D secure/ SCA. So the thing is, 4000003800000446, 4000002500003155 and 4000000000003055 are success while 4000000000003220 and 4000002760003184 are failure among the cards, returns incomplete status. My system is for annual subscription for a magazine. I do get the pop up urging me to confirm authentication as shown in image confirmation popup screenshot now after i confirm, it redirects to my code for creating subscription which is
$payement_intent = $request->get('intent');
$plan_key = 'plan_*******';
try{
$payement_info = $subscriber->newSubscription('yearly', $plan_key)->create($payement_intent, [
'email'=>$subscriber->email
]);
}catch(IncompletePayment $e){
dd($e);
Session::flash('message', 'Payment is incomplete. Extra verification is needed. You will receive an email with further payment confirmation instructions.');
return redirect()->to(route('acc_success'));
}
since i have dumped the incomplete payments the screenshot for the exception is enter image description here. I am confused since i have clicked the complete authentication on the pop isn't it suppose to validate the 3D authentication and make payment successful or am i missing something regarding the incomplete status in cashier as stripe doc says "Subscriptions enter the incomplete status only when the first charge is attempted and either fails or requires SCA."
回答1:
The two cards you are using are 3DS2
cards which requires authentication for transactions. The incomplete
state requires you to ask your customer to complete the 3DS process to authorize the transaction. You could follow https://stripe.com/docs/billing/migration/strong-customer-authentication#scenario-1-handling-sca to do this.
Basically, if the subscription is in incomplete
status, you will need to check the subscription.latest_invoice.payment_intent
status.
It will be in require_action
for these cards requires authentication especially for these two test cards designed for testing these scenarios.
In this case, you will just need to pass the subscription.latest_invoice.payment_intent.client_secret
to the frontend and call handleCardPayment
to show an 3DS modal for your customer to complete the authorization.
来源:https://stackoverflow.com/questions/57947500/laravel-cashier-3d-secure-sca-issue-stripe