Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

176
Views
stripe, get billing address in checkout session

I want know how can i get a billing address and set in session in stripe page, i try use address in customer, but i cannot use. My:

onst stripeCustomer = await stripe.customers.create({
        email: decoded.ds_email,
        // address: {
        //     city: 'city',
        //     country: 'country',
        //     line1: 'line1',
        //     line2: null,
        //     state: 'state',
        //     postal_code: xxxxxxxx
        // }
    })
const stripeCheckoutSession = await stripe.checkout.sessions.create({
        customer: stripeCustomer.id,
        // customerAddress: stripeCustomer.address,
        payment_method_types: ['card'],
        // payment_intent: stripePaymentIntent.id,
        billing_address_collection: 'required',
        line_items: [
            { price: stripePrice.id, quantity: 1 }
        ],
        mode: 'payment',
        allow_promotion_codes: false,
        success_url: `http://localhost:3000`,
        cancel_url: `http://localhost:3000/#/order`
    })
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I've managed to do so by adding this parameter

const COUNTRY_CODE_ARRAY = ['UK','ES','US']
shipping_address_collection:{allowed_countries:COUNTRY_CODE_ARRAY },

const stripeCheckoutSession = await stripe.checkout.sessions.create({
        customer: stripeCustomer.id,
        // customerAddress: stripeCustomer.address,
        payment_method_types: ['card'],
        // payment_intent: stripePaymentIntent.id,
        billing_address_collection: 'required',
        line_items: [
            { price: stripePrice.id, quantity: 1 }
        ],
        mode: 'payment',
        allow_promotion_codes: false,
        success_url: `http://localhost:3000`,
        cancel_url: `http://localhost:3000/#/order`,

        shipping_address_collection:{allowed_countries:COUNTRY_CODE_ARRAY },

    })

This will show textfields for shipping address, using the customer shipping address.

One thing I noted, if customer edit it, checkout session will save edited shipping address, but in customer info, shipping address will be the same as before editing.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!