PAYER_ACTION_REQUIRED with status 200

auctBasti
Contributor
Contributor

Hello,

 

I've got a problem in the integration of the REST API.

 

I have a shop and want to first authorize and then in another step capture a payment. The steps are:

1) Create order

2) Authorize order

3) Capture order

 

The first step is successful. But I've got an issue in the last two. For authorize and capture, the return status of the response is 200 with the status "PAYER_ACTION_REUQIRED". In the documentation, there is information about a redrection to the HATEOAS link, but I can't do this technically in this step. Is there any possibility to finish the order?

 

Here are the bodies for my requests:

Create order:

 

 

{
	"purchase_units": [
		{
			"amount": {
				"breakdown": {
					"item_total": {
						"value": 45.83,
						"currency_code": "EUR"
					}
				},
				"value": 45.83,
				"currency_code": "EUR"
			},
			"reference-id": "ap04iuif4j9aq82ovtjbfmq2tc4"
		}
	],
	"payment_source": {
		"paypal": {
			"experience_context": {
				"user_action": "PAY_NOW",
				"landing_page": "LOGIN",
				"return_url": "NOT INTERESTING FOR THE POST",
				"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
				"brand_name": "EXAMPLE INC",
				"locale": "de-DE",
				"cancel_url": "http://localhost"
			}
		}
	},
	"intent": "AUTHORIZE"
}

 

 

 

Authorize order:

 

 

{
	"payment_source": {
		"paypal": {
			"experience_context": {
				"user_action": "PAY_NOW",
				"landing_page": "LOGIN",
				"return_url": "NOT INTERESTING FOR THE POST",
				"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
				"locale": "de-DE",
				"cancel_url": "http://localhost",
				"shipping_preference": "NO_SHIPPING"
			}
		}
	}
}

 

 

 

Response:

 

 

{
	"id": "41053874NS5614918",
	"status": "PAYER_ACTION_REQUIRED",
	"payment_source": {
		"paypal": {}
	},
	"links": [
		{
			"href": "https://api.sandbox.paypal.com/v2/checkout/orders/41053874NS5614918",
			"rel": "self",
			"method": "GET"
		},
		{
			"href": "https://www.sandbox.paypal.com/checkoutnow?token=41053874NS5614918",
			"rel": "payer-action",
			"method": "GET"
		}
	]
}

 

 

 

Capture order:

 

 

{
	"payment_source": {
		"paypal": {
			"experience_context": {
				"user_action": "PAY_NOW",
				"landing_page": "LOGIN",
				"return_url": "NOT INTERESTING FOR THE POST",
				"payment_method_preference": "IMMEDIATE_PAYMENT_REQUIRED",
				"locale": "de-DE",
				"cancel_url": "http://localhost",
				"shipping_preference": "NO_SHIPPING"
			}
		}
	}
}

 

 

 

Response:

 

 

{
	"id": "41053874NS5614918",
	"status": "PAYER_ACTION_REQUIRED",
	"payment_source": {
		"paypal": {}
	},
	"links": [
		{
			"href": "https://api.sandbox.paypal.com/v2/checkout/orders/41053874NS5614918",
			"rel": "self",
			"method": "GET"
		},
		{
			"href": "https://www.sandbox.paypal.com/checkoutnow?token=41053874NS5614918",
			"rel": "payer-action",
			"method": "GET"
		}
	]
}

 

 

 

Could you please help me? Thank you!

 

Best regards

Basti

Login to Me Too
2 REPLIES 2

eckosneekz
Contributor
Contributor

Did you ever find a solution to this?

 

I am having the same issue. I cannot get past this.

Login to Me Too

OW_Chris
Member
Member

In this bit...

 

 

{
			"href": "https://www.sandbox.paypal.com/checkoutnow?token=41053874NS5614918",
			"rel": "payer-action",
			"method": "GET"
		}

 

 


You need to open a browser and follow that link as the "Payer". Use your sandbox personal account to pay.

 

A Paypal login will pop up - you sign in as sb#### personal.example.com  and that completes the "Payer Action".

 

After that, as the Payer, you'll be sent to the return_url. 

 

The return_url  should run the order/capture API to make the payment transfer happen between Payer and Seller. (... or approval  - then capture - if that is what you want to do.) 

Login to Me Too

Haven't Found your Answer?

It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.