cancel
Showing results for 
Search instead for 
Did you mean: 

How to get an authorisation ID from PayPal when using Express Checkout with checkout.js

SOLVED
Highlighted

How to get an authorisation ID from PayPal when using Express Checkout with checkout.js

We do payment in a web app by PayPal with checkout.js . Everything works fine if we execute the payment with the intent : "sale". But now we want to authorize the payment with checkout.js at the frontend and capture later at the backend with PayPal REST API.

When we set the payment with intent : "authorize" we get response, but there is no authorisation ID we need for capture later. The related_recources array is empty. Can anybody tell me what is going wrong here? Tested with sandbox & production mode. Thanks in advance.

 

paypal.Button.render({

    env: 'sandbox',

    client: {
        sandbox: xxxxxxxxx
    },

    payment: function() {

       var env    = this.props.env;
       var client = this.props.client;

       return paypal.rest.payment.create(env, client, {

          intent: "authorize", 
          transactions: [
             {
                amount: { total: totalEur, currency: "EUR" },
                description: "Reservation..." 
             }
          ]
       });
   },

   commit: true, 

   onAuthorize: function(data, actions) {

      actions.payment.get().then(function(pdata) {

         console.dir(pdata);

         ...
1 ACCEPTED SOLUTION

Accepted Solutions
Moderator

Re: How to get an authorisation ID from PayPal when using Express Checkout with checkout.js

Hi, you get in the response the "Response payload" returned after a successful call with either the PayPal authorization ID or the pay key to process via REST (PAY-XXXXXXXXXX). Or once the authorization is processed you then can log-in into your PayPal profile and capture the payment from there.

If you open the developer tool/console (F12) just before you click the payment button then check into the Network tab and you will find the Response Payload in the response  area, attached image. This is returned in the response so you can use the response payload.

1 REPLY
Moderator

Re: How to get an authorisation ID from PayPal when using Express Checkout with checkout.js

Hi, you get in the response the "Response payload" returned after a successful call with either the PayPal authorization ID or the pay key to process via REST (PAY-XXXXXXXXXX). Or once the authorization is processed you then can log-in into your PayPal profile and capture the payment from there.

If you open the developer tool/console (F12) just before you click the payment button then check into the Network tab and you will find the Response Payload in the response  area, attached image. This is returned in the response so you can use the response payload.