Integrate Adaptive Payments with Transaction Risk
Last updated: Sept 23rd, 4:27pm
PayPal partners and merchants can Set transaction context to send additional data about a customer to PayPal so that PayPal can complete a pre-transaction risk management evaluation before PayPal processes the customer transaction.
Use the Adaptive Payments API to send money in simple to complex scenarios. For example, use it to build a small send money application for a social networking site or to build a robust payroll system. You can integrate the REST Transaction Risk API Set transaction context feature with Adaptive Payments.
Integration process flow
This sequence diagram illustrates the integration process flow:
Integration steps
1. | Required | Set up your development environment. |
2. | Required | Set the transaction context. To Integrate Adaptive Payments with Transaction Risk, you must first set the transaction context. You pass a merchant_id and tracking_id in the call. |
3. | Required | Make the Adaptive Payment Pay API call to transfer funds. Add the tracking ID that you specified in the set the transaction context call. PayPal recognizes that the Adaptive Payment token matches a set the transaction context call. PayPal uses the transaction data context to complete additional risk management before it processes the payment. |
Set up your development environment
Before you can integrate Adaptive Payments, 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 Adaptive Payments.
Set the transaction context
For information, see Set transaction context.
Use the token value from the response in the previous step as the tracking_id
parameter and use the merchant ID from PayPal business account profile page as the merchant_id
parameter in the request:
1curl -v -X PUT https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/<merchant_id>/<tracking_id> \2 -H 'Content-Type: application/json' \3 -H 'Authorization: Bearer <Access-Token> \4-d '{5 "additional_data": [{6 "key": "test1",7 "value": "abc"8 },9 {10 "key": "test2",11 "value": "aaa"12 }13 ]14}'
Transfer funds
Use the Adaptive Payments Pay
API operation to transfer funds from a sender's PayPal account to one or more receivers' PayPal accounts.
Specify the tracking_id
value that you used in the set the transaction context call in the tracking_id
parameter:
1curl -s --insecure https://svcs.sandbox.paypal.com/AdaptivePayments/Pay \2 -H "X-PAYPAL-SECURITY-USERID: insert_merchant_user_name_here" \3 -H "X-PAYPAL-SECURITY-PASSWORD: insert_merchant_password_here" \4 -H "X-PAYPAL-SECURITY-SIGNATURE: insert_merchant_signature_here" \5 -H "X-PAYPAL-REQUEST-DATA-FORMAT: NV" \6 -H "X-PAYPAL-RESPONSE-DATA-FORMAT: NV" \7 -H "X-PAYPAL-APPLICATION-ID: app_id" \8 -d "actionType=PAY \9 &senderEmail=sender@example.com \10 &cancelUrl=https://example.com \11 ¤cyCode=USD \12 &receiverList.receiver(0).email=receiver@domain \13 &receiverList.receiver(0).amount=100.00 \14 &requestEnvelope.errorLanguage=en_US \15 &returnUrl=https://example.com \16 &tracking_id=<tracking_id>" # Use the tracking_id that you used in SetTransactionContext
Additional information
For information about classic payment calls, see: