---
title: Initiate a purchase V2
slug: docs/demo/initiate-a-purchase-v2
description: This document offers a practical code example that demonstrates the use of the curl command to make a POST request to an API endpoint. It covers the inclusion of headers to manage JSON data acceptance and transmission, and showcases a JSON payload with cu
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "fMaZyuNIQqmPQ-yE7oMl_",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/payments",
    "name": "Initiate a purchase V2",
    "method": "POST",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountReference",
          "type": "string",
          "description": "Account reference"
        }
      ],
      "queryParameters": [],
      "headerParameters": [
        {
          "kind": "optional",
          "name": "X-TokenId",
          "type": "string",
          "description": "The eSuite Token Id"
        },
        {
          "kind": "optional",
          "name": "X-SessionId",
          "type": "string",
          "description": "The eSuite Session Id"
        },
        {
          "kind": "required",
          "name": "X-Version",
          "type": "string",
          "description": "The eSuite Version"
        },
        {
          "kind": "optional",
          "name": "Origin",
          "type": "string",
          "description": "The eSuite Origin"
        }
      ],
      "bodyDataParameters": [
        {
          "kind": "required",
          "name": "request",
          "type": "object",
          "schema": [
            {
              "kind": "optional",
              "name": "settlementType",
              "type": "string",
              "example": "",
              "description": "Gets or sets the SettlementType"
            },
            {
              "kind": "optional",
              "name": "pricing",
              "type": "object",
              "schema": [
                {
                  "kind": "optional",
                  "name": "priceId",
                  "type": "integer<int32>",
                  "example": 0,
                  "description": "Gets or sets the price id."
                },
                {
                  "kind": "optional",
                  "name": "paymentMethod",
                  "type": "string",
                  "example": "",
                  "description": "Gets or sets the payment method."
                },
                {
                  "kind": "optional",
                  "name": "currency",
                  "type": "string",
                  "example": "",
                  "description": "Gets or sets the currency."
                },
                {
                  "kind": "optional",
                  "name": "price",
                  "type": "number<double>",
                  "example": "",
                  "description": "Gets or sets the price."
                },
                {
                  "kind": "optional",
                  "name": "taxInfo",
                  "type": "object",
                  "schema": [
                    {
                      "kind": "optional",
                      "name": "zeroRated",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the zero rated"
                    },
                    {
                      "kind": "optional",
                      "name": "country",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the country"
                    },
                    {
                      "kind": "optional",
                      "name": "state",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the state"
                    },
                    {
                      "kind": "optional",
                      "name": "county",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the county"
                    },
                    {
                      "kind": "optional",
                      "name": "city",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the city"
                    },
                    {
                      "kind": "optional",
                      "name": "zipCode",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the zipcode"
                    },
                    {
                      "kind": "optional",
                      "name": "street",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the street"
                    }
                  ],
                  "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.TaxRegionInfo",
                  "customType": "FictiveGlobal.Api.Rest.Dtos.v1.TaxRegionInfo",
                  "description": "Gets or sets the tax info."
                },
                {
                  "kind": "optional",
                  "name": "priceItems",
                  "type": "array",
                  "schema": [
                    {
                      "kind": "optional",
                      "name": "externalReference",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the external reference."
                    },
                    {
                      "kind": "optional",
                      "name": "supplierId",
                      "type": "integer<int32>",
                      "example": 0,
                      "description": "Gets or sets the supplier id."
                    },
                    {
                      "kind": "optional",
                      "name": "price",
                      "type": "number<double>",
                      "example": "",
                      "description": "Gets or sets the price."
                    },
                    {
                      "kind": "optional",
                      "name": "description",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the description."
                    }
                  ],
                  "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PricingItem",
                  "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PricingItem[]",
                  "description": "Gets or sets the price items."
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v3.Pricing",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v3.Pricing",
              "description": "Gets or sets the pricing object"
            },
            {
              "kind": "optional",
              "name": "cvv",
              "type": "string",
              "example": "",
              "description": "Gets or sets the cv2 number"
            },
            {
              "kind": "optional",
              "name": "voucherCode",
              "type": "string",
              "example": "",
              "description": "Gets or sets the promotion code"
            },
            {
              "kind": "optional",
              "name": "orderItems",
              "type": "array",
              "schema": [
                {
                  "kind": "optional",
                  "name": "priceBreakDown",
                  "type": "object",
                  "schema": [
                    {
                      "kind": "optional",
                      "name": "grossAmount",
                      "type": "number<double>",
                      "example": "",
                      "description": "Groos amount"
                    },
                    {
                      "kind": "optional",
                      "name": "netAmount",
                      "type": "number<double>",
                      "example": "",
                      "description": "Net amount"
                    },
                    {
                      "kind": "optional",
                      "name": "taxAmount",
                      "type": "number<double>",
                      "example": "",
                      "description": "Tax amount"
                    }
                  ],
                  "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PriceBreakDownDirect",
                  "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PriceBreakDownDirect",
                  "description": "Gets or sets the price break down"
                },
                {
                  "kind": "optional",
                  "name": "orderReference",
                  "type": "string",
                  "example": "",
                  "description": "Gets or sets the order reference"
                },
                {
                  "kind": "optional",
                  "name": "description",
                  "type": "string",
                  "example": "",
                  "description": "Gets or sets the description"
                },
                {
                  "kind": "optional",
                  "name": "comments",
                  "type": "string",
                  "example": "",
                  "description": "Gets or sets the comments"
                },
                {
                  "kind": "optional",
                  "name": "customOrderParameters",
                  "type": "object",
                  "schema": [],
                  "example": {},
                  "description": "Gets or sets the custom order parameters"
                },
                {
                  "kind": "optional",
                  "name": "entitlements",
                  "type": "array",
                  "schema": [
                    {
                      "kind": "optional",
                      "name": "identifier",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the identifier of the entitlement."
                    },
                    {
                      "kind": "optional",
                      "name": "startDate",
                      "type": "string<date-time>",
                      "example": "2021-09-21T05:33:09.9633582",
                      "description": "Gets or sets the create date of the entitlement"
                    },
                    {
                      "kind": "optional",
                      "name": "expiryDate",
                      "type": "string<date-time>",
                      "example": "2021-09-21T05:33:09.9633582",
                      "description": "Gets or sets the expire date of the entitlement"
                    }
                  ],
                  "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.EntitlementParameter",
                  "customType": "FictiveGlobal.Api.Rest.Dtos.v1.EntitlementParameter[]",
                  "description": "Gets or sets the entitlement parameters"
                },
                {
                  "kind": "optional",
                  "name": "taxInfo",
                  "type": "object",
                  "schema": [
                    {
                      "kind": "optional",
                      "name": "taxAmount",
                      "type": "number<double>",
                      "example": "",
                      "description": "Gets or sets the tax amount"
                    },
                    {
                      "kind": "optional",
                      "name": "category",
                      "type": "string",
                      "example": "",
                      "description": "Gets or sets the category"
                    },
                    {
                      "kind": "optional",
                      "name": "region",
                      "type": "object",
                      "schema": [
                        {
                          "kind": "optional",
                          "name": "zeroRated",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the zero rated"
                        },
                        {
                          "kind": "optional",
                          "name": "country",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the country"
                        },
                        {
                          "kind": "optional",
                          "name": "state",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the state"
                        },
                        {
                          "kind": "optional",
                          "name": "county",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the county"
                        },
                        {
                          "kind": "optional",
                          "name": "city",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the city"
                        },
                        {
                          "kind": "optional",
                          "name": "zipCode",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the zipcode"
                        },
                        {
                          "kind": "optional",
                          "name": "street",
                          "type": "string",
                          "example": "",
                          "description": "Gets or sets the street"
                        }
                      ],
                      "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.TaxRegionInfo",
                      "customType": "FictiveGlobal.Api.Rest.Dtos.v1.TaxRegionInfo",
                      "description": "Gets or sets the tax region info"
                    }
                  ],
                  "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.TaxInfo",
                  "customType": "FictiveGlobal.Api.Rest.Dtos.v1.TaxInfo",
                  "description": "Gets or sets the tax info"
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.ProcessPaymentOrderItemDirect",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v1.ProcessPaymentOrderItemDirect[]",
              "description": "Gets or sets the order items"
            },
            {
              "kind": "optional",
              "name": "asynchronousInitiationParameters",
              "type": "object",
              "schema": [],
              "example": {},
              "description": "Asynchronous Processing Parameters"
            },
            {
              "kind": "optional",
              "name": "enhancedProcessingData",
              "type": "object",
              "schema": [],
              "example": {},
              "description": "EnhancedProcessingData Processing Parameters"
            },
            {
              "kind": "optional",
              "name": "sendEreceipt",
              "type": "boolean",
              "example": "",
              "description": "Gets or sets the SendEreceipt"
            },
            {
              "kind": "optional",
              "name": "sendBackOfficeEmail",
              "type": "boolean",
              "example": "",
              "description": "Gets or sets the SendBackOfficeEmail"
            },
            {
              "kind": "optional",
              "name": "isMoto",
              "type": "boolean",
              "example": "",
              "description": "If IsMoto (Mail Order Telephone Order) flag is true then 3D secure will be ignored, default false"
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v2.ProcessPaymentDirect",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v2.ProcessPaymentDirect",
          "isExpanded": true,
          "description": "Process payment class for direct call with no session"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "sessionToken",
                "type": "string",
                "example": "",
                "description": "Gets or sets the session token"
              },
              {
                "kind": "optional",
                "name": "basketNumber",
                "type": "string",
                "example": "",
                "description": "Gets or sets the basket number"
              },
              {
                "kind": "optional",
                "name": "orders",
                "type": "array",
                "schema": [
                  {
                    "kind": "optional",
                    "name": "orderId",
                    "type": "integer<int32>",
                    "example": 0,
                    "description": "Gets or sets the order id"
                  },
                  {
                    "kind": "optional",
                    "name": "externalOrderReference",
                    "type": "string",
                    "example": "",
                    "description": "Gets or sets the external order reference"
                  }
                ],
                "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.ProcessPaymentOrderInfo",
                "customType": "FictiveGlobal.Api.Rest.Dtos.v1.ProcessPaymentOrderInfo[]",
                "description": "Gets or sets the process payment orders"
              },
              {
                "kind": "optional",
                "name": "asynchronousProcessingParameters",
                "type": "object",
                "schema": [],
                "example": {},
                "description": "Asynchronous Processing Parameters"
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.ProcessPaymentSummaryDirect",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.ProcessPaymentSummaryDirect",
            "isExpanded": true,
            "description": "Process payment summary class"
          }
        ],
        "isExpanded": true,
        "statusCode": "200",
        "description": "OK",
        "jsonExample": "{\n  \"basketNumber\": \"433M098765\",\n  \"orders\": [\n    {\n      \"orderId\": 154874,\n      \"externalOrderReference\": \"134Order\"\n    }\n  ],\n  \"asynchronousProcessingParameters\": {\n    \"threeDSecureAcsUrl\": \"https%3A%2F%2Fwww.secpay.com%2Fjava-bin%2FACSSimulator%3Fpartner%3Dsecpay%26VAA%3DB\",\n    \"threeDSecureEnrolled\": \"false\",\n    \"threeDSecureHtml\": \"<head><title> 3-D Secure Verification</title></head>\",\n    \"threeDSecureMD\": \"2058804607\",\n    \"threeDSecurePaReq\": \"eJxVUctuwjAQvPcronwA65g32hilBKkcQtM2qtRjZFYQRAI4Tgl/XztNeFiytDP27I5mcV7nB+eXVJkdC9/1esydixdMdooo/CJZKRIYUVmmW3Kyje9yNpxM2GDExq7AOPiks8BWLoy6xxE6aHRK7tJCC0zl+XW1FoMpnzKG0ELMSa1CwZ4Pwj+NRZqTiOLYSajUTiDlsSo0QkNjA9RVTPgIoQNYqYPYaX2aASBYgHA3EVe2Ko24zjYi2gfee7i9rMOfy/oabFeL2/UR7A/cpJoEZ96ITdnQ8QazPp/1xwgNj2lupwqvsdwCPNkZwePLI4MmT0WF7Gx3CKk+HQsyP0x8txrh7njxZkOU2uTyvV/yKFnW0Yfv2ygb0nbITAKcMa9pYQGClUG7JWjXaKqn9f4BGD6mtQ==\",\n    \"threeDSecureStatus\": \"RedirectionToAuthSiteRequired\"\n  }\n}"
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "Not Authorized",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "403",
        "description": "Forbidden",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not Found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal Server Error",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "503",
        "description": "Unable to validate the 3D Secure Process due to downstream partners",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to initiate a payment\r\n            This endpoint support 3D Secure v2.\r\n            In the event the account is paying using a synchronous payment method (such as credit card) and 3D Secure is disabled,  the purchase will complete instantly.\r\n            if the account selects an async payment (PayPal, P24, etc.) a redirect URL will be provided in the return to the request.",
    "examples": {
      "languages": [
        {
          "id": "UKvDgvrfaZ6jLu65sBFA7",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/payments \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "eKc_9nQOzCOQSK92OKUpY",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\nmyHeaders.append(\"x-version\", \"string\");\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/{accountReference}/payments\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "6qGmP2ApXVAlkyn8R1Lix",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/{accountReference}/payments\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-version\"] = \"string\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "rjNSMCyXdUYyZWyRy48vC",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/payments\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "UKvDgvrfaZ6jLu65sBFA7"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-200",
          "language": "200",
          "code": "{\n  \"basketNumber\": \"433M098765\",\n  \"orders\": [\n    {\n      \"orderId\": 154874,\n      \"externalOrderReference\": \"134Order\"\n    }\n  ],\n  \"asynchronousProcessingParameters\": {\n    \"threeDSecureAcsUrl\": \"https%3A%2F%2Fwww.secpay.com%2Fjava-bin%2FACSSimulator%3Fpartner%3Dsecpay%26VAA%3DB\",\n    \"threeDSecureEnrolled\": \"false\",\n    \"threeDSecureHtml\": \"<head><title> 3-D Secure Verification</title></head>\",\n    \"threeDSecureMD\": \"2058804607\",\n    \"threeDSecurePaReq\": \"eJxVUctuwjAQvPcronwA65g32hilBKkcQtM2qtRjZFYQRAI4Tgl/XztNeFiytDP27I5mcV7nB+eXVJkdC9/1esydixdMdooo/CJZKRIYUVmmW3Kyje9yNpxM2GDExq7AOPiks8BWLoy6xxE6aHRK7tJCC0zl+XW1FoMpnzKG0ELMSa1CwZ4Pwj+NRZqTiOLYSajUTiDlsSo0QkNjA9RVTPgIoQNYqYPYaX2aASBYgHA3EVe2Ko24zjYi2gfee7i9rMOfy/oabFeL2/UR7A/cpJoEZ96ITdnQ8QazPp/1xwgNj2lupwqvsdwCPNkZwePLI4MmT0WF7Gx3CKk+HQsyP0x8txrh7njxZkOU2uTyvV/yKFnW0Yfv2ygb0nbITAKcMa9pYQGClUG7JWjXaKqn9f4BGD6mtQ==\",\n    \"threeDSecureStatus\": \"RedirectionToAuthSiteRequired\"\n  }\n}"
        },
        {
          "id": "response-1-401",
          "language": "401",
          "code": "// Not Authorized\n"
        },
        {
          "id": "response-2-403",
          "language": "403",
          "code": "// Forbidden\n"
        },
        {
          "id": "response-3-404",
          "language": "404",
          "code": "// Not Found\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal Server Error\n"
        },
        {
          "id": "response-5-503",
          "language": "503",
          "code": "// Unable to validate the 3D Secure Process due to downstream partners\n"
        }
      ],
      "selectedLanguageId": "response-0-200"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}