Transaction Risk Integration Guide
Last updated: Sept 23rd, 4:24pm
PayPal partners and merchants can Set transaction context to send additional data about a customer to PayPal before the customer transaction is processed. PayPal uses this data to complete a pre-transaction risk management evaluation.
API endpoints and operations
To access the Transaction Risk API services in these environments, use these endpoints:
Environment | Endpoint |
---|---|
PayPal sandbox | https://api-m.sandbox.paypal.com |
PayPal production | https://api-m.paypal.com |
To call the Transaction Risk API operations, include the appropriate endpoint in the URI:
-
Set transaction context:
1PUT <endpoint>/v1/risk/transaction-contexts/<merchant_id>/<tracking_id> -
Show transaction context data:
1GET <endpoint>/v1/risk/transaction-contexts/<merchant_id>/<tracking_id>
For definitions of the merchant_id
and tracking_id
parameters, see Parameters.
For information about common REST errors, see REST API errors.
Integration steps
To use the Transaction Risk API:
1. | Required | To add the https://uri.paypal.com/services/risk/raas/transaction-context scope to the partner's account, work with your PayPal account manager. |
2. | Required | Set up your development environment. |
4. | Required | Set the transaction context. |
5. | Optional | Show transaction context data. |
Set up your development environment
Before you can integrate Transaction Risk, you must set up your development environment. After you get a token that lets you access protected REST API resources, you create sandbox accounts to test your web and mobile apps. For details, see Get started.
Then, return to this page to integrate Transaction Risk.
Set the transaction context
PayPal merchants can set the transaction context to send data about their customers to PayPal before a transaction is processed.
This sample request sets the transaction context in the sandbox environment:
1curl -v -X PUT https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/2RDQJ4E5UEK2W/trackingId20130701 \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer <Access-Token>" \4 -d '{5 "additional_data": [6 {7 "key": "test1",8 "value": "abc"9 },10 {11 "key": "test2",12 "value": "aaa"13 }]14}'
A successful call returns the HTTP 200 OK
status code.
Show transaction context data
This sample request shows the transaction context data that is associated with the 2RDQJ4E5UEK2W
merchant ID and trackingId20130701
tracking ID:
1curl -v -X GET https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/2RDQJ4E5UEK2W/trackingId20130701 \2 -H "Content-Type: application/json" \3 -H "Authorization: Bearer <Access-Token>"
The response shows the transaction content data:
1{2 "additional_data": [3 {4 "key": "test1",5 "value": "abc"6 },7 {8 "key": "test2",9 "value": "aaa"10 }]11}
Additional information
To integrate the Transaction Risk API with Express Checkout and Adaptive Payments, see:
- Integrate Transaction Risk with Express Checkout
- Integrate Reference Transactions with Transaction Risk
- Integrate Adaptive Payments with Transaction Risk
For information about the REST Transaction Risk API calls, see:
For information about classic payment calls, see: