Integrate Verify with PayPal
DOCS
Last updated: Feb 27th, 8:42am
Integrate Verify with PayPal to confirm PayPal users' identity.
Know before you code
- Get the following account information from the Developer Dashboard:
- Client ID and client secret of a REST app.
- Access token to use the PayPal REST API server.
- Contact PayPal support to enable Verify with PayPal for your account and provide the following information:
- Client ID of the sandbox and live REST APP where you want to enable Verify with PayPal.
- Type of payer data you want to request from PayPal. You can request verified document type, verification status, or both.
- Verify with PayPal is only available on mobile devices.
1. Set up your app to use Verify with PayPal
Before you can send payers through the verification process, set up your app as follows:
- Log into the PayPal Developer Dashboard, go to Apps & Credentials > Sandbox > REST API apps, and select the name of your app.
- Go to Sandbox App Settings > App feature options > Log in with PayPal and select Advanced options.
- Set a return URL on the application. The return URL should:
- Connect to your backend that will receive the authorization code, which is passed to paypal.com with a basic header.
- Support the GET HTTP verb.
- Select what information your payers should share with you during the verification process.
2. Generate link to PayPal verification process
Generate a static link that takes your payers to PayPal's website to start the verification process as follows:
1https://www.paypal.com/idapps/connect?client_id=CLIENT_ID&response_type=code&scope=did_tid&redirect_uri=YRETURN_URL&state=RANDOM_STATE_VALUE#/connect/authorize
Modify the code
Modify the code and replace:
CLIENT_IDwith your client ID.REDIRECT_URLwith the redirect URL you configured earlier.RANDOM_STATE_VALUEwith a randomly generated ID, such as a UUID
If the payer cancels, fails, or declines the verification process, errors are appended to the redirect URL instead.
Select a tab to view the redirect URL for each error
- Cancelled
- Failed
- Declined
1https://example.com?errorCode=USER_CANCELLED&errorMessage=user%20cancelled%20verification%20flow
5. Get payer verification information
Make a GET request to the Identity API using the user access token from the previous step to retrieve the payer verification information:
Sample request: Get payer information
1curl -X GET 'https://api-m.paypal.com/v1/identity/oauth2/userinfo?schema=paypalv1.1' -H 'Authorization: Bearer USER-ACCESS-TOKEN'
Modify the code
Replace USER-ACCESS-TOKEN with the access token returned from the previous step
Sample response
1{2"user_id":"https://www.paypal.com/webapps/auth/identity/user/o6mqLJBHI3c_H77I6mcydoOEvNJbmOaAlVHn9a80VPo",3"sub":"https://www.paypal.com/webapps/auth/identity/user/o6mqLJBHI3c_H77I6mcydoOEvNJbmOaAlVHn9a80VPo",4"verified_doc_type":"PASSPORT",5"verification_status":"COMPLETED"6}