Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

184
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda