Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. try {
  2. $payment_intent_id = \Stripe\PaymentIntent::create([
  3. 'payment_method_types' => ['card'],
  4. 'amount' => 1099,
  5. 'currency' => 'gbp',
  6. 'customer' => "$customer_card_id",
  7. 'payment_method' => "$payment_card",
  8. "description" => "Invoice No: $invoice_number",
  9. ]);
  10. }
  11.  
  12. catch (\Stripe\Exception\CardException $e) {
  13. // Error code will be authentication_required if authentication is needed
  14. echo 'Error code is:' . $e->getError()->code;
  15. $payment_intent_id = $e->getError()->payment_intent->id;
  16. $payment_intent = \Stripe\PaymentIntent::retrieve($payment_intent_id);
  17. }
  18.  
  19. print $e;
  20.  
  21. $payment_intent = \Stripe\PaymentIntent::retrieve($payment_intent_id);
  22. $payment_intent->capture();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement