#alexis.saviot
1 messages · Page 1 of 1 (latest)
Hi
Hello, is there a way to pre-fill the customer's address during a checkout session?
When you create a Checkout Session, did you try to pass the customerId ?
https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-customer
I do this : $session = \Stripe\Checkout\Session::create([
// 'payment_method_types' => ['card'],
'line_items' => [[
'price' => 'price_1N5n6KIihUWcN3e1ztlJRX0H',
'quantity' => $count,
]],
// 'billing_address_collection' => 'required',
'shipping_address_collection' => [
'allowed_countries' => ['FR', 'BE', 'CH']
],
'metadata' => [
'product_name' => "standard",
"customer_id" => $user['id'],
"quantity" => $count,
"tax" => $tax,
'price' => $this::$config['FORMULA']['standard']['price'],
],
'customer' => $user['stripe_id'],
'mode' => 'subscription',
'success_url' => $this::$config['APP_URL'] . 'paiement-succes',
'cancel_url' => $this::$config['APP_URL'] . 'paiement-annule',
'payment_method_collection' => "always", // set to always for futur payment (eg. subscription update)
// 'customer_email' => $user['email'],
]);
where stripe_id is the customer id from the customer in stripe
Yes, there is no way to pre-fill address on Checkout Session