Card processing with 3D secure return URL

francosdad
New Community Member

Hi! 

 

I'm struggling with card payment and 3d secure.

My process steps are:

1. create an order, only with intent "CAPTURE" and purchase units

2. get the created id

3. authorize request: https://api-m.sandbox.paypal.com/v2/checkout/orders/xxxxxxx/authorize as post with the following json object:

 

{
    "payment_source": {
        "card": {
            "number": "4111111111111111",
            "expiry": "2024-04",
            "name": "John [removed]",
            "billing_address": {
                "address_line_1": "[removed]",
                "address_line_2": "17.3.160",
                "admin_area_1": "CA",
                "admin_area_2": "San Jose",
                "postal_code": "[removed]",
                "country_code": "US"
            },
            "attributes": {
                "verification": {
                    "method": "SCA_ALWAYS"
                }
            }
        }
    }
}

and I get this response:

{
    "name": "UNPROCESSABLE_ENTITY",
    "details": [
        {
            "issue": "PAYER_ACTION_REQUIRED",
            "description": "Payer needs to perform the following action before proceeding with payment"
        }
    ],
    "message": "The requested action could not be performed, semantically incorrect, or failed business validation",
    "information_link": "http://developer.paypal.com/docs/api/orders#errors",
    "debug_id": "adf61b35610dd",
    "links": [
        {
            "href": "https://www.sandbox.paypal.com/webapps/helios?action=verify&flow=3ds&cart_id=xxxxxxxxx",
            "rel": "payer-action",
            "method": "GET"
        },
        {
            "href": "https://developer.paypal.com/docs/api/orders/v2/#error-PAYER_ACTION_REQUIRED",
            "rel": "information_link",
            "method": "GET"
        }
    ]
}

When I visit the payer-action link, I will be redirected to Paypal sandbox 3D Secure. After finishing, I get an redirection to a Paypal 404 page:

francosdad_0-1680196195312.png

Now I have 2 questions:

1. how can I pass the URL where it should redirect to my shop?

2. Why I get an "UNPROCESSABLE_ENTITY" error, even if I get a obviously correct payer-action link?

 

I have no idea how I can fix the returning URL after 3D secure.

Thanks for you support!
Best,

Michael 

Login to Me Too
2 REPLIES 2

MTS_Jennifer
Moderator
Moderator

Hi @francosdad ,

Thank you for posting to the PayPal Community.

This is how I tested it:

I created an initial payment request that included a return url.

POST https://api.sandbox.paypal.com/v2/checkout/orders (with access token)
{
  "intent": "CAPTURE",
    
  "purchase_units": [
    {
        "amount": {
        "currency_code": "USD",
        "value": "100.00"
       
      },

      "shipping": {
                "name": {
                    "full_name": "John Doe"
                },
                "address": {
                    "address_line_1": "123  W Main St",
                    "admin_area_2": "San Jose",
                    "admin_area_1": "CA",
                    "postal_code": "95112",
                    "country_code": "US"
                }
            }
        }
        ],

"application_context" : {
			"return_url" : "http://www.example.com",
			"cancel_url" : "http://my_cancel_url.com",
            "error_url" : "http://errorurl.com",
            "shipping_preference" : "SET_PROVIDED_ADDRESS"
           
        }
		}

 

I ran the authorize order API call:

POST https://api.sandbox.paypal.com/v2/checkout/orders/{{order_id}}/authorize
{
    "payment_source": {
        "card": {
            "number": "4111111111111111",
            "expiry": "2024-04",
            "name": "John Doe",
            "billing_address": {
                "address_line_1": "123 Main St",
                "address_line_2": "17.3.160",
                "admin_area_1": "CA",
                "admin_area_2": "San Jose",
                "postal_code": "95112",
                "country_code": "US"
            },
            "attributes": {
                "verification": {
                    "method": "SCA_ALWAYS"
                }
            }
        }
    }
}

I received the Payer action required with the URL for SCA simulation (I removed the Order ID in the below post):

  "links": [
        {
            "href": "https://www.sandbox.paypal.com/webapps/helios?action=verify&flow=3ds&cart_id={{orderid}}",
            "rel": "payer-action",
            "method": "GET"
        },

I pasted the URL in a browser, it went through the simulation process and I was brought back to my return url when it finished.

 

I did get a something's not right error page when I pasted a URL that had an order id that had already been captured. If the order id doesn't exist or it was previously captured, you will see that error page.

 

 

You do not need to authorize the payment again after going through the 3DS simulation successfully. You can just send an order capture API call.

POST https://api.sandbox.paypal.com/v2/checkout/orders/{{order_id}}/capture

 

Thank you,

Jennifer

MTS

PayPal

Login to Me Too

cmmfl
Contributor
Contributor

There are a couple of discrepancies between the answer you posted and the current REST v2 API documents:

 

  1. There is no 'error_url' documented in the application_content array.
  2. The SCA_ALWAYS value for the ['payment_source']['card']['attributes']['verification']['method'] field is sent on the

 

https://api-m.sandbox.paypal.com/v2/checkout/orders

request to create the order.

 

 

Could you provide an answer based on the current API documentation?  I'm working through an integration with the v2 API and am having 'difficulties' successfully responding the an SCA challenge as well

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.