Problems implementing rest API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
I'm trying to implement paypal's rest API into our solution and I have 2 issues which I can't seem to solve via documentation and can't find an answer on the forums or other media.
Issue 1:
I'm sending this json:
{
"intent": "CAPTURE",
"purchase_units": [{
"reference_id": "469440611",
"amount": {
"currency_code": "EUR",
"value": "5.00"
}
}
],
"payment_source": {
"paypal": {
"experience_context": {
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"user_action": "PAY_NOW",
"locale": "pt-PT",
"cancel_url": "https://localhost:44398/Shopping",
"return_url": "https://localhost:44398/Payments/PaypalComplete?payID=81&cartId=3470"
}
}
}
}
And I get 2 links in the answer, one with rel=self and one with rel=payer-action. I'm using the second which has the path /checkoutnow in it.
When it redirects sometimes I get a page with the options "Login" and "Pay with Debit or Credit Card", other times I have "Login" and "Create an account" option only.
It's always the same request, but the result will vary inconsistently. Is there a way to force the first option to always show? We want to allow guest payment.
Issue 2:
When I do get the option to pay with guest, I use one of the cards valid for sandbox. Everything goes fine and I get redirected back to my site (in this case localhost for debugging). I then try to make a confirmation of the status of the order via the url https://api-m.sandbox.paypal.com/v2/checkout/orders/<token>/confirm-payment-source and send the json:
{
"payment_source": {
"paypal": {
"experience_context": {
"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
"user_action": "PAY_NOW",
"locale": "pt-PT"
}
}
}
}
However, I always get the status "PAYER_ACTION_REQUIRED" in the answer.
I was expecting the status to be "COMPLETED" at this point so I could process the order. So what am I doing wrong?
Thanks in advance for the help.
- Labels:
-
Payments REST APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you need to do a Capture to complete the transaction? (to receive the payment after the buyer approves with the "rel": "payer-action" ) ... /v2/checkout/orders/{id}/capture
The buyer needs to be the personal sandbox account (if you are using the sandbox api).
But I'm having problems with Capture at the moment, so I'm no expert.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm having similar problems. I can create an order and take the buyer to the payment page but, when I try to capture the payment, the checkout/orders/{orderid}/capture returns "not found".

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- Are there any restrictions to charge using only html, vanilla javascript and php with rest api? in REST APIs
- PayPal Rest API: Popup "Bei uns ist ein Problem aufgetreten" in REST APIs
- Payment done, money received, but un error 'catched' after 'onApprouve' method in REST APIs
- JavaScript SDK unreliable redirect using "Sofortüberweisung" Klarna payment provider in SDKs