Advertisement
BrunoLC777

Untitled

Sep 23rd, 2019
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. // File 1 (with stripe.js but in PHP)
  2. // **********************************
  3. $intent = \Stripe\PaymentIntent::create([
  4. 'amount' => 1099,
  5. 'currency' => 'eur',
  6. 'receipt_email' => $util_email,
  7. 'payment_method_types' => ['card'],
  8. 'capture_method' => 'manual',
  9. 'description' => 'Empreinte (attente : confirmation)',
  10. 'confirmation_method' => 'manual'
  11. ]);
  12.  
  13. $PI_secret = $intent->client_secret;
  14.  
  15. // The process launched it returns to me the TOKEN CB CARD
  16. // *******************************************************
  17.  
  18. // File 2 (only PHP)
  19. // *****************
  20. $customer = \Stripe\Customer::create([
  21. "email" => "mail@dom.com",
  22. "name" => "Firstname NAME",
  23. "description" => "Client pour mail@dom.com",
  24. "phone" => "0606060606",
  25. "source" => $tok_id,
  26. "preferred_locales" => ['fr']
  27. ]);
  28.  
  29. $customer_result = decodeStripeJSON($customer);
  30. $customer_id = $customer_result->id;
  31.  
  32. $payment_method = $customer_result->default_source;
  33.  
  34. \Stripe\PaymentIntent::update($PI_secret,
  35. ['payment_method' => $payment_method,
  36. 'customer' => $customer_id]
  37. );
  38.  
  39. // To manage also the 3DS
  40. // **********************
  41. $intent = \Stripe\PaymentIntent::retrieve($PI_secret);
  42. $intent->confirm();
  43.  
  44. $intent->capture();
  45. \Stripe\PaymentIntent::update($PI_secret,
  46. ['description' => 'Paiement (attente : virement)']
  47. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement