{
  "variables": [],
  "info": {
    "name": "Braintree Forward API",
    "description": "The Braintree Forward API allows developers to forward raw payment data from the Braintree Vault to third parties. For more, [see our documentation](https://developer.paypal.com/braintree/docs/reference/forward-api/overview/).",
    "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"
  },
  "item": [
    {
      "name": "httpbin.org example",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const publicKey = postman.getEnvironmentVariable('braintree_public_key');",
              "const privateKey = postman.getEnvironmentVariable('braintree_private_key');",
              "const authorization = btoa(publicKey + ':' + privateKey);",
              "",
              "postman.setGlobalVariable('braintree_authorization', authorization);"
            ]
          }
        }
      ],
      "request": {
        "url": "https://forwarding.sandbox.braintreegateway.com/",
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "description": ""
          },
          {
            "key": "Authorization",
            "value": "{{braintree_authorization}}",
            "description": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"merchant_id\": \"{{braintree_merchant_id}}\",\n\t\"payment_method_nonce\": \"fake-valid-nonce\",\n\t\"debug_transformations\": false,\n\t\"url\": \"https://httpbin.org/post\",\n\t\"method\": \"POST\",\n\t\"data\": {\n\t\t\"order_number\": \"999\"\n\t},\n\t\"sensitive_data\": {\n\t\t\"customer_name\": \"Selena Gomez\"\t\n\t},\n\t\"config\": {\n\t\t\"name\": \"httpbin-example\",\n\t\t\"url\": \"^https://httpbin\\\\.org/post$\",\n\t\t\"methods\": [\"POST\"],\n\t\t\"types\": [\"CreditCard\"],\n\t\t\"request_format\": {\n\t\t\t\"/body\": \"json\"\n\t\t},\n\t\t\"template\": {\n\t\t\t\"header\": {\n\t\t\t\t\"X-Fake-Header\": \"fake value\"\n\t\t\t}\n\t\t},\n\t\t\"transformations\": [\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card-number\",\n\t\t\t\t\"value\": \"$number\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card-cvv\",\n\t\t\t\t\"value\": \"$cvv\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card-expiration\",\n\t\t\t\t\"value\": [\n\t\t\t\t\t\"join\",\n\t\t\t\t\t\"/\",\n\t\t\t\t\t[\n\t\t\t\t\t\t\"array\",\n\t\t\t\t\t\t\"$expiration_month\",\n\t\t\t\t\t\t\"$expiration_year\"\n\t\t\t\t\t]\n\t\t\t\t]\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/order-number\",\n\t\t\t\t\"value\": \"$order_number\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/customer-name\",\n\t\t\t\t\"value\": \"$customer_name\"\n\t\t\t}\n\t\t]\n\t}\n}"
        },
        "description": "An example that uses httpbin.org and the Braintree Forward API."
      },
      "response": []
    },
    {
      "name": "URL-encoded data example",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const publicKey = postman.getEnvironmentVariable('braintree_public_key');",
              "const privateKey = postman.getEnvironmentVariable('braintree_private_key');",
              "const authorization = btoa(publicKey + ':' + privateKey);",
              "",
              "postman.setGlobalVariable('braintree_authorization', authorization);"
            ]
          }
        }
      ],
      "request": {
        "url": "https://forwarding.sandbox.braintreegateway.com/",
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "description": ""
          },
          {
            "key": "Authorization",
            "value": "{{braintree_authorization}}",
            "description": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"merchant_id\": \"{{braintree_merchant_id}}\",\n\t\"payment_method_nonce\": \"fake-valid-nonce\",\n\t\"url\": \"https://httpbin.org/get\",\n\t\"method\": \"GET\",\n\t\"data\": {\n\t\t\"order_number\": \"999\"\n\t},\n\t\"config\": {\n\t\t\"name\": \"urlencoded-data-example\",\n\t\t\"url\": \"^https://httpbin\\\\.org/get$\",\n\t\t\"methods\": [\"GET\"],\n\t\t\"types\": [\"CreditCard\"],\n\t\t\"transformations\": [\n\t\t\t{\n\t\t\t\t\"path\": \"/urlparam/number\",\n\t\t\t\t\"value\": \"$number\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/urlparam/cvv\",\n\t\t\t\t\"value\": \"$cvv\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/urlparam/ordernumber\",\n\t\t\t\t\"value\": \"$order_number\"\n\t\t\t}\n\t\t]\n\t}\n}"
        },
        "description": "An example that uses the Braintree Forward API to send URL-encoded data."
      },
      "response": []
    },
    {
      "name": "HTTP basic auth example",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const publicKey = postman.getEnvironmentVariable('braintree_public_key');",
              "const privateKey = postman.getEnvironmentVariable('braintree_private_key');",
              "const authorization = btoa(publicKey + ':' + privateKey);",
              "",
              "postman.setGlobalVariable('braintree_authorization', authorization);"
            ]
          }
        }
      ],
      "request": {
        "url": "https://forwarding.sandbox.braintreegateway.com/",
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "description": ""
          },
          {
            "key": "Authorization",
            "value": "{{braintree_authorization}}",
            "description": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"merchant_id\": \"{{braintree_merchant_id}}\",\n\t\"payment_method_nonce\": \"fake-valid-nonce\",\n\t\"url\": \"https://httpbin.org/post\",\n\t\"method\": \"POST\",\n\t\"sensitive_data\": {\n\t\t\"user\": \"myusername123\",\n\t\t\"password\": \"swordfish\"\n\t},\n\t\"config\": {\n\t\t\"name\": \"http-basic-auth-example\",\n\t\t\"url\": \"^https://httpbin\\\\.org/post$\",\n\t\t\"methods\": [\"POST\"],\n\t\t\"types\": [\"CreditCard\"],\n\t\t\"request_format\": {\n\t\t\t\"/body\": \"json\"\n\t\t},\n\t\t\"transformations\": [\n\t\t\t{\n\t\t\t\t\"path\": \"/body/number\",\n\t\t\t\t\"value\": \"$number\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/header/Authorization\",\n\t\t\t\t\"value\": [\n\t\t\t\t\t\"join\",\n\t\t\t\t\t\" \",\n\t\t\t\t\t[\n\t\t\t\t\t\t\"array\",\n\t\t\t\t\t\t\"Basic\",\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t\"base64\",\n\t\t\t\t\t\t\t[\"join\", \":\", [\"array\", \"$user\", \"$password\"]]\n\t\t\t\t\t\t]\n\t\t\t\t\t]\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t}\n}"
        },
        "description": "An example that uses HTTP basic auth with the `Authorization` header."
      },
      "response": []
    },
    {
      "name": "Hashed data example",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const publicKey = postman.getEnvironmentVariable('braintree_public_key');",
              "const privateKey = postman.getEnvironmentVariable('braintree_private_key');",
              "const authorization = btoa(publicKey + ':' + privateKey);",
              "",
              "postman.setGlobalVariable('braintree_authorization', authorization);"
            ]
          }
        }
      ],
      "request": {
        "url": "https://forwarding.sandbox.braintreegateway.com/",
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "description": ""
          },
          {
            "key": "Authorization",
            "value": "{{braintree_authorization}}",
            "description": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"merchant_id\": \"{{braintree_merchant_id}}\",\n\t\"payment_method_nonce\": \"fake-valid-nonce\",\n\t\"url\": \"https://httpbin.org/post\",\n\t\"method\": \"POST\",\n\t\"sensitive_data\": {\n\t\t\"cardholder_name\": \"Al Green\"\n\t},\n\t\"config\": {\n\t\t\"name\": \"hashed-data-example\",\n\t\t\"url\": \"^https://httpbin\\\\.org/post$\",\n\t\t\"methods\": [\"POST\"],\n\t\t\"types\": [\"CreditCard\"],\n\t\t\"request_format\": {\n\t\t\t\"/body\": \"xml\"\n\t\t},\n\t\t\"transformations\": [\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card/number\",\n\t\t\t\t\"value\": \"$number\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card/cardholder_name\",\n\t\t\t\t\"value\": \"$cardholder_name\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card-hash\",\n\t\t\t\t\"value\": [\n\t\t\t\t\t\"base64\",\n\t\t\t\t\t[\"md5\", \"$/body/card/number\"]\n\t\t\t\t]\n\t\t\t}\n\t\t]\n\t}\n}"
        },
        "description": "An example that shows how to MD5-hash some data."
      },
      "response": []
    },
    {
      "name": "Transformations + overrides example",
      "event": [
        {
          "listen": "prerequest",
          "script": {
            "type": "text/javascript",
            "exec": [
              "const publicKey = postman.getEnvironmentVariable('braintree_public_key');",
              "const privateKey = postman.getEnvironmentVariable('braintree_private_key');",
              "const authorization = btoa(publicKey + ':' + privateKey);",
              "",
              "postman.setGlobalVariable('braintree_authorization', authorization);"
            ]
          }
        }
      ],
      "request": {
        "url": "https://forwarding.sandbox.braintreegateway.com/",
        "method": "POST",
        "header": [
          {
            "key": "Content-Type",
            "value": "application/json",
            "description": ""
          },
          {
            "key": "Authorization",
            "value": "{{braintree_authorization}}",
            "description": ""
          }
        ],
        "body": {
          "mode": "raw",
          "raw": "{\n\t\"merchant_id\": \"{{braintree_merchant_id}}\",\n\t\"payment_method_nonce\": \"fake-valid-nonce\",\n\t\"url\": \"https://httpbin.org/post\",\n\t\"method\": \"POST\",\n\t\"debug_transformations\": true,\n\t\"override\": {\n\t\t\"body\": \"<card>\n        \t<number></number>\n            <cardholder_name>overrides other data</cardholder_name>\n            <supplemental_data>passed through</supplemental_data>\n        </card>\"\n\t},\n\t\"sensitive_data\": {\n\t\t\"cardholder_name\": \"Rufus Thomas\"\t\n\t},\n\t\"config\": {\n\t\t\"name\": \"transformations-and-overrides-example\",\n\t\t\"url\": \"^https://httpbin\\\\.org/post$\",\n\t\t\"methods\": [\"POST\"],\n\t\t\"types\": [\"CreditCard\"],\n\t\t\"request_format\": {\n\t\t\t\"/body\": \"xml\"\n\t\t},\n\t\t\"transformations\": [\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card/number\",\n\t\t\t\t\"value\": \"$number\"\n\t\t\t},\n\t\t\t{\n\t\t\t\t\"path\": \"/body/card/cardholder_name\",\n\t\t\t\t\"value\": \"$cardholder_name\"\n\t\t\t}\n\t\t]\n\t}\n}"
        },
        "description": "An example that shows how to use the `override` parameter."
      },
      "response": []
    }
  ]
}
