Transaction Risk Integration Guide

DocsLast updated: June 20th 2023, @ 6:44:12 pm


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:

EnvironmentEndpoint
PayPal sandboxhttps://api-m.sandbox.paypal.com
PayPal productionhttps://api-m.paypal.com

To call the Transaction Risk API operations, include the appropriate endpoint in the URI:

  • Set transaction context:

    PUT <endpoint>/v1/risk/transaction-contexts/<merchant_id>/<tracking_id>
    
  • Show transaction context data:

    GET <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.RequiredTo add the https://uri.paypal.com/services/risk/raas/transaction-context scope to the partner's account, work with your PayPal account manager.
2.RequiredSet up your development environment.
4.RequiredSet the transaction context.
5.OptionalShow 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

Important: Before you make other calls to process PayPal transactions, you must call the set transaction context method.

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:

curl -v -X PUT https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/2RDQJ4E5UEK2W/trackingId20130701 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>" \
  -d '{
  "additional_data": [
  {
    "key": "test1",
    "value": "abc"
  },
  {
    "key": "test2",
    "value": "aaa"
  }]
}'

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:

curl -v -X GET https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/2RDQJ4E5UEK2W/trackingId20130701 \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <Access-Token>"

The response shows the transaction content data:

{
  "additional_data": [
  {
    "key": "test1",
    "value": "abc"
  },
  {
    "key": "test2",
    "value": "aaa"
  }]
}

Additional information

To integrate the Transaction Risk API with Express Checkout and Adaptive Payments, see:

For information about the REST Transaction Risk API calls, see:

For information about classic payment calls, see:

NVPSOAP
CreateBillingAgreement API Operation (NVP)CreateBillingAgreement API Operation (SOAP)
DoReferenceTransaction API Operation (NVP)DoReferenceTransaction API Operation (SOAP)
DoExpressCheckoutPayment API Operation (NVP)DoExpressCheckoutPayment API Operation (SOAP)
GetExpressCheckoutDetails API Operation (NVP)GetExpressCheckoutDetails API Operation (SOAP)
Pay API Operation
SetExpressCheckout API Operation (NVP)SetExpressCheckout API Operation (SOAP)