Does the PayPal Rest API have a classic user equivalent?

Is there a way to skip the two-step verification process using PayPal REST Api?

I successfully completed the standard process using the PayPal REST api, which takes the user to the PayPal website, where they enter their credentials, and then receives the submitted order summary with the option to "continue" with the text - you are almost done. You will verify your payment at xxxx. "

Is it possible to skip this step so as not to return the user to my site, where they should again view the order and select "make payment", but rather display the "pay now" button in PayPal, which will make the payment?

I searched, and the classic API seems to handle this by adding the url parameter, user commitment. If I could find the equivalent for a REST api.

+4
source share
2 answers

I had the same problem and got a response from PayPal support.

TL DR: just add &useraction=committo url statement.

They told me that the REST API redirect URL is a regular Express Checkout redirect URL, so you can use the same parameter.

If you are making a payment API call, for example:

curl -v https://api.sandbox.paypal.com/v1/payments/payment
-H "Content-Type:application/json"
-H "Authorization:Bearer ACCESS_TOKEN_HERE"
-d '{
    "transactions": [{
        "amount": {
            "currency":"USD",
            "total":"12"
        },
        "description":"creating a payment"
    }],
    "payer": {
        "payment_method":"paypal"
    },
    "intent":"sale",
    "redirect_urls": {
        "cancel_url":"https://devtools-paypal.com/guide/pay_paypal/curl?cancel=true",
        "return_url":"https://devtools-paypal.com/guide/pay_paypal/curl?success=true"
    }
   }'

You will receive the following answer:

{
   "id":"PAY-XYZ",
   "create_time":"2015-02-26T15:14:27Z",
   "update_time":"2015-02-26T15:14:28Z",
   "state":"created",
   "intent":"sale",
   "payer":{
      "payment_method":"paypal",
      "payer_info":{
         "shipping_address":{

         }
      }
   },
   "transactions":[
      {
         "amount":{
            "total":"12.00",
            "currency":"USD",
            "details":{
               "subtotal":"12.00"
            }
         },
         "description":"creating a payment",
         "related_resources":[

         ]
      }
   ],
   "links":[
      {
         "href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-XYZ",
         "rel":"self",
         "method":"GET"
      },
      {
         "href":"https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-FOOBAR",
         "rel":"approval_url",
         "method":"REDIRECT"
      },
      {
         "href":"https://api.sandbox.paypal.com/v1/payments/payment/PAY-XYZ/execute",
         "rel":"execute",
         "method":"POST"
      }
   ]
}

In this answer you will get the approval URL

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-FOOBAR

and you just need to programmatically expand it with a parameter &useraction=commit.

So you are redirecting your user to

https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=EC-FOOBAR&useraction=commit

PayPal.

+4

All Articles