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

Handle card declined on client side

parent ba20762a
Branches
Tags
No related merge requests found
......@@ -39,17 +39,25 @@ class CRM_Stripe_AJAX {
]);
}
else {
$intent = \Stripe\PaymentIntent::create([
'payment_method' => $paymentMethodID,
'amount' => $processor->getAmount(['amount' => $amount]),
'currency' => $currency,
'confirmation_method' => 'manual',
'capture_method' => 'manual', // 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,
]);
try {
$intent = \Stripe\PaymentIntent::create([
'payment_method' => $paymentMethodID,
'amount' => $processor->getAmount(['amount' => $amount]),
'currency' => $currency,
'confirmation_method' => 'manual',
'capture_method' => 'manual',
// 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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment