Why can't I open my referral URL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have created a small script to generate referral URLs before I continue with the integration. I can successfully make a call to the API with a valid token and get the referral URL(action_url). When I paste the URL in the browser I get a blank screen and when I view the JSON data it tells me this:
I made the API call with a valid token so it is confusing me. How do I add an auth header if this is a link I would just be redirecting a user to? The app I am integrating with is built using the MERN stack.
- Labels:
-
API

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi @JustinMann8 ,
Thank you for posting to the PayPal Merchant Community.
The error you are seeing usually means the incorrect payer-action url is being used.
Before you create the order, make certain that you are getting a valid access_token:
https://developer.paypal.com/api/rest/authentication/
When you create the order, in the response you should see the payer-action link.
This document has an example request and response:
https://developer.paypal.com/docs/api/orders/v2/#orders_create
In the response the payer-action link looks similar to this:
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "payer-action",
"method": "GET"
}
As you can see the link is a checkout now link with a token that is returned to you in the response.
If you are not opening a link that looks like the above, you will see an authentication error.
Thank you,
Jennifer
MTS
PayPal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hey Jennifer,
Thank you for getting back so quick!
I may have been a little unclear. I am trying to integrate the on boarding process for my app so users can connect their PayPal accounts, not creating orders just yet. Using the partner referral API: https://api-m.sandbox.paypal.com/v2/customer/partner-referrals
It seems I resolved the issue by adding more data in the request body in the initial API request. Could you just confirm that I am on the proper path?
This is the old request:
const createReferal = async () => { const paypalApiUrl = 'https://api-m.sandbox.paypal.com/v2/customer/partner-referrals'; const requestBody = { operations: [{ operation: 'API_INTEGRATION' }], legal_consents: [{ type: 'SHARE_DATA_CONSENT', granted: true }], products: ['EXPRESS_CHECKOUT'], }; axios .post(paypalApiUrl, requestBody, { headers: { 'Content-Type': 'application/json', Authorization: `Bearer {VALID TOKEN GOES HERE}`, }, }) .then((response) => { console.log(response.data); }) .catch((error) => { console.log({ error: error.message }); }); };
This is the new request:
const createUrl = async () => { const paypalApiUrl = 'https://api-m.sandbox.paypal.com/v2/customer/partner-referrals'; const requestBody = { operations: [ { operation: 'API_INTEGRATION', api_integration_preference: { rest_api_integration: { integration_method: 'PAYPAL', integration_type: 'THIRD_PARTY', third_party_details: { features: ['PAYMENT', 'REFUND'], }, }, }, }, ], legal_consents: [{ type: 'SHARE_DATA_CONSENT', granted: true }], products: ['EXPRESS_CHECKOUT'], web_experience_preference: { return_url: 'https://fruntt.com/settings', }, }; axios .post(paypalApiUrl, requestBody, { headers: { 'Content-Type': 'application/json', Authorization: `Bearer {VAlID TOKEN GOES HERE}`, }, }) .then((response) => { console.log(response.data); }) .catch((error) => { console.log({ error: error.message }); }); };

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- PayPal Business account opening api's in REST APIs
- I'm stuck in a loop of "continue to view order" in Braintree Client-side Integration (JS, iOS, Android SDKs)
- I'm stuck in a loop of "continue to view order" in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)
- CMS Drupal 8 without opening business account? in PayPal Payments Standard
- Paypal Buttons get an overlayed blank popup-window in PayPal Payments Standard