PAYER_ACTION_REQUIRED returned for Capture intent when calling v2 checkout orders

lcody1
Contributor
Contributor

I am attempting to create order with this request:
{"purchase_units":[{"reference_id":"default","description":"","custom_id":"2425409","invoice_id":"3288309","soft_descriptor":"","items":[{"name":"1 oz Canadian Silver Maple Leaf Coin BU (Random Year)","quantity":"10","description":"","sku":"1090","url":"","category":"PHYSICAL_GOODS","image_url":"https://www.images-apmex.com/images/Catalog Images/Products/1090_slab.jpg","unit_amount":{"value":"30.15","currency_code":"USD"},"tax":{"value":"0.00","currency_code":"USD"},"upc":{"type":"UPC-A","code":"11111111111111111"}}],"amount":{"currency_code":"USD","value":"301.50","breakdown":{"item_total":{"value":"301.50","currency_code":"USD"},"shipping":{"value":"0.00","currency_code":"USD"},"handling":{"value":"0.00","currency_code":"USD"},"tax_total":{"value":"0.00","currency_code":"USD"},"insurance":{"value":"0.00","currency_code":"USD"},"shipping_discount":{"value":"0.00","currency_code":"USD"},"discount":{"value":"0.00","currency_code":"USD"}}},"shipping":{"type":"SHIPPING","address":{"address_line_1":"6451 PHEASANT VALLEY RD","address_line_2":"","admin_area_2":"DAYTON","admin_area_1":"OH","postal_code":"45424-7103","country_code":"US"}},"supplementary_data":{"card":{"level_2":{"invoice_id":"3288309","tax_total":{"value":"0","currency_code":"USD"}},"level_3":{"ships_from_postal_code":"73102","line_items":[null],"shipping_amount":{"value":"0","currency_code":"USD"},"duty_amount":{"value":"0","currency_code":"USD"},"discount_amount":{"value":"0","currency_code":"USD"},"shipping_address":{"address_line_1":"6451 PHEASANT VALLEY RD","address_line_2":"","admin_area_2":"DAYTON","admin_area_1":"OH","postal_code":"45424-7103","country_code":"US"}}}}}],"intent":"CAPTURE","payment_source":{"paypal":{"experince_context":null,"email_address":"xxxxxxxxxx","name":{"given_name":"Dayton","surname":"Ohio"},"phone":{"phone_type":"HOME","phone_number":{"national_number":"1111111111"}},"address":{"address_line_1":"6451 PHEASANT VALLEY RD","address_line_2":"","admin_area_2":"DAYTON","admin_area_1":"OH","postal_code":"45424-7103","country_code":"US"}}}}

 

The call to PayPal returns the status Payer_Action_Required
https://api.sandbox.paypal.com/v2/checkout/orders/69U97603G9106131C","rel":"self","method":"GET"},{"href":"https://www.sandbox.paypal.com/checkoutnow?token=69U97603G9106131C","rel":"payer-action","method":"GET"}]}

and returns with a create_order_error

What is causing the Payer_Action_Required response?

 

Login to Me Too
5 REPLIES 5

MTS_John
Moderator
Moderator

Hi @lcody1

 

Thank you for posting to the PayPal Merchant Community.

 

The buyer needs to approve the order after it is created and before it is captured by redirecting the buyer to the “payer-action” href that is returned in the API response as defined on our developer page about the Orders V2 REST API [https://developer.paypal.com/docs/api/orders/v2/#orders_create].

 

payer-action.png

 

Please let us know if you have any additional questions or need any further assistance.

 

Sincerely,

John

MTS

PayPal

 

If you found this post helpful, please give it a kudos or accept it as a solution so it can help others with a similar question.

Login to Me Too

eckosneekz
Contributor
Contributor

This doesnt work for me.

 

I copy the payer-action link, login to my sandbox ccount and complete the order.

 

I take the order id and use it in the path /v2/checkout/orders/{id}/capture

 

This results in PAYER_ACTION_REQUIRED

Login to Me Too

vnvs
New Community Member

I'm having the same issue in sandbox. It isn't going through, I'm stuck at this stage.

Login to Me Too

MTS_Jennifer
Moderator
Moderator

Hi @vnvs ,

Thank you for contributing to this post. Most of the reason why this happens in sandbox is because the payment_source and experience_context is missing the return_url. Without these details the buyer is sent in a loop staying on the PayPal account, and never approving the payment. When this happens, if you attempt to capture the order, you will receive the error Payer Action Required.

Here is the documentation:

https://developer.paypal.com/docs/api/orders/v2/#orders_create

As  you can see from the example below the payment_source includes experience_context and a return_url. You can update the return URL.

{
  "intent": "CAPTURE",    
  "purchase_units": [
    {
        "amount": {
        "currency_code": "USD",
        "value": "100.00"
       
        },       
  "shipping": {
      "name": {
        "full_name": "John Doe"
      },
      "address": {
        "address_line_1": "123 N First Street",
        "address_line_2": "Building 17",
        "admin_area_2": "San Jose",
        "admin_area_1": "CA",
        "postal_code": "95131",
        "country_code": "US"
      }
    }
        }
         
       ],        

"payment_source" : {
    "paypal" : {
       "experience_context" : {
	    "return_url" : "http://www.myreturnurl.com",
	    "cancel_url" : "http://my_cancel_url.com",
            "error_url" : "http://errorurl.com",
            "locale" : "en-US",
            "user_action": "PAY_NOW",
            "shipping_preference" : "SET_PROVIDED_ADDRESS"
}
}  
        }
		}

 Thank you,

Jennifer

MTS

PayPal

Login to Me Too

lcody1
Contributor
Contributor

Thank You!

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.