Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // File 1 (with stripe.js but in PHP)
- // **********************************
- $intent = \Stripe\PaymentIntent::create([
- 'amount' => 1099,
- 'currency' => 'eur',
- 'receipt_email' => $util_email,
- 'payment_method_types' => ['card'],
- 'capture_method' => 'manual',
- 'description' => 'Empreinte (attente : confirmation)',
- 'confirmation_method' => 'manual'
- ]);
- $PI_secret = $intent->client_secret;
- // The process launched it returns to me the TOKEN CB CARD
- // *******************************************************
- // File 2 (only PHP)
- // *****************
- $customer = \Stripe\Customer::create([
- "email" => "mail@dom.com",
- "name" => "Firstname NAME",
- "description" => "Client pour mail@dom.com",
- "phone" => "0606060606",
- "source" => $tok_id,
- "preferred_locales" => ['fr']
- ]);
- $customer_result = decodeStripeJSON($customer);
- $customer_id = $customer_result->id;
- $payment_method = $customer_result->default_source;
- \Stripe\PaymentIntent::update($PI_secret,
- ['payment_method' => $payment_method,
- 'customer' => $customer_id]
- );
- // To manage also the 3DS
- // **********************
- $intent = \Stripe\PaymentIntent::retrieve($PI_secret);
- $intent->confirm();
- $intent->capture();
- \Stripe\PaymentIntent::update($PI_secret,
- ['description' => 'Paiement (attente : virement)']
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement