Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

177
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda