REST API

DOCS

Last updated: Aug 15th, 5:52am

Step 1: Generate Unique Session Identifier

Generate a unique session identifier, such as the PayPal-Client-Metadata-Id. The tracking ID must be a universally unique identifier (UUID).

Step 2: Pass the Unique Session Identifier as the Tracking_ID

    1curl -v -X PUT \
    2 https://api-m.sandbox.paypal.com/v1/risk/transaction-contexts/<merchant_id>/<tracking_id> \
    3 -H "Content-Type: application/json" \
    4 -H "Authorization: Bearer <Access-Token>" \
    5 -d '{
    6 "additional_data": [
    7 {
    8 "key": "test1",
    9 "value": "abc"
    10 },
    11 {
    12 "key": "test2",
    13 "value": "aaa"
    14 }]
    15}'

    Step 3: Call Create Order API

    Pass the Unique Session Identifier as the PayPal-Client-Metadata-Id header.

      1curl -v -X POST \
      2 https://api-m.sandbox.paypal.com/v2/checkout/orders \
      3 -H "Content-Type: application/json" \
      4 -H "Authorization: Bearer <Access-Token>" \
      5 -H "PayPal-Client-Metadata-Id: <Unique-Session-Identifier>" \
      6 -d '{
      7 "intent": "CAPTURE",
      8 "purchase_units": [
      9 {
      10 "amount": {
      11 "currency_code": "USD",
      12 "value": "100.00"
      13 }
      14 }
      15 ]
      16}'

      Step 4: Call Capture Order API

      Pass the Unique Session Identifier as the PayPal-Client-Metadata-Id header.

        1curl -v -X POST \
        2 https://api-m.sandbox.paypal.com/v2/checkout/orders/5O190127TN364715T/capture \
        3 -H "Content-Type: application/json" \
        4 -H "Authorization: Bearer Access-Token" \
        5 -H "PayPal-Client-Metadata-Id: <Unique-Session-Identifier>" \
        6 -H "PayPal-Request-Id: 7b92603e-77ed-4896-8e78-5dea2050476a"

        If you accept cookies, we’ll use them to improve and customize your experience and enable our partners to show you personalized PayPal ads when you visit other sites. Manage cookies and learn more