Skip to content
Snippets Groups Projects
Commit 912345c0 authored by mattwire's avatar mattwire
Browse files

Handle card declined on client side

parent ba20762a
No related branches found
No related tags found
No related merge requests found
...@@ -39,17 +39,25 @@ class CRM_Stripe_AJAX { ...@@ -39,17 +39,25 @@ class CRM_Stripe_AJAX {
]); ]);
} }
else { else {
$intent = \Stripe\PaymentIntent::create([ try {
'payment_method' => $paymentMethodID, $intent = \Stripe\PaymentIntent::create([
'amount' => $processor->getAmount(['amount' => $amount]), 'payment_method' => $paymentMethodID,
'currency' => $currency, 'amount' => $processor->getAmount(['amount' => $amount]),
'confirmation_method' => 'manual', 'currency' => $currency,
'capture_method' => 'manual', // authorize the amount but don't take from card yet 'confirmation_method' => 'manual',
'setup_future_usage' => 'off_session', // Setup the card to be saved and used later 'capture_method' => 'manual',
'confirm' => TRUE, // authorize the amount but don't take from card yet
]); 'setup_future_usage' => 'off_session',
// Setup the card to be saved and used later
'confirm' => TRUE,
]);
}
catch (Exception $e) {
CRM_Utils_JSON::output(['error' => ['message' => $e->getMessage()]]);
}
} }
self::generatePaymentResponse($intent); self::generatePaymentResponse($intent);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment