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

123
Vistas
Autoclose the approve PayPal window in the PayPal Orders REST API v2?

After you

  1. generate a bearer token and
  2. create an order with the PayPal REST API,
# step 0: get token
curl  --request POST --compressed --silent  'https://api-m.sandbox.paypal.com/v1/oauth2/token'  --header 'accept: application/json'  --header 'accept-language: en_us'  --user '<clientid>:<secret>'  --data 'grant_type=client_credentials'

# step 1: create the order (use the token from step 0)
curl  --request POST --compressed --silent  'https://api-m.sandbox.paypal.com/v2/checkout/orders'  --header 'content-type: application/json'  --header 'authorization: bearer <token>' \
  --data '{
    "intent": "CAPTURE",
    "purchase_units": [{"amount":              {"value":"10.00", "currency_code":"USD"},
                        "description":         "hello",
                        "application_context": {"brand_name":"mybrand", "shipping_preference":"NO_SHIPPING", "return_url":""}}]
  }'

you show the user the approval page, where he can enter his credentials and approve the payment:

# step 2: show the user the approval page
https://www.sandbox.paypal.com/checkoutnow?<order_id>

I'm trying to implement step 2 in the client, with Javascript, without redirects (ie. without passing a return_url to /checkout/orders in step 1), and without using the PayPal buttons that come with the JS SDK.

This means you open a new window

window.open('https://www.sandbox.paypal.com/checkoutnow?<order_id>')

and let the user do his thing.

I've got everything working well, except the part that closes the approval window in step 2.

After the user logs in and approves the order in the newly created window, how can I automatically close it?

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