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

375
Visualizações
Paypal captures gives 400 error when using non-english characters on shipping address

The user can make payments to my site with paypal. Everything is fine until the user sends to the paypal request a non-english character.

So, I have a paypal button with an address for the client to fill. When the client fills non-english characters sending it to

app.post('/paypal',

There the request goes to this post request

https://${config.hostname}/v2/checkout/orders

making it to give to the try catch and error of 400.

Error: Request failed with status code 400

The address is just info the user has to fill, but e.x. he submits it with ö or ä then the user will see on the paypal pop-up only loading. So not able to pay.

The shipping-address with non-english characters comes to my backend and throws an error, so the paypal pop-up keeps loading forever.

Should i use somewhere language for the address to accept non-english letters? E.X DE.

How could i make the order CAPTURE accept other characters? The current solution i have is a regex replacing non-english characters with english ones.

The request code data with the shipping info from paypal CAPTURE:

    // if something is non-english character, then this will post to paypal: /v2/checkout/orders` and give 400 error
        const customerOrder = {
    intent: "CAPTURE"
  , purchase_units: [{
      amount: { "value": totalAmount.toFixed(2), "currency_code": "EUR" }
    , shipping: {
        name: { full_name: `${data.address.firstName || 'not set'} ${data.address.lastName || ''}` }
      , address: {
          address_line_1: data.address.street || 'not set'
        , admin_area_2  : data.address.city || 'not set'
        // , admin_area_1  : ""
        , postal_code   : data.address.zipCode || 'not set'
        , country_code  : data.address.
        , phone: data.phone || '1234567'
        }
      }
    }]
  , application_context: {
      locale: "de-DE"
    , return_url: `http://localhost:${PORT}/sucess/`
    , cancel_url: `http://localhost:${PORT}/cancel/`
    }
  };

Thanks. What else should i fill here? Part of error repsonse is:

data: {
  name: 'INVALID_REQUEST',
  message: 'Request is not well-formed, syntactically incorrect, or violates schema.',
  debug_id: '22dde7fbb568e',
  details: [Array],
  links: [Array]
}
    response: {
    status: 400,
    statusText: 'Bad Request',
    headers: {

NOTE: it works when i replace with regex the used characters. E.X.

word.replace(/ä/g, 'ae');

but it is impossible to cover all the cases.

about 4 years ago · Juan Pablo Isaza
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