---
title: Create a payment instruction
slug: docs/demo/create-a-payment-instruction
description: This document offers a code example demonstrating the use of the CURL command for making a POST request to a specific API endpoint. It includes detailed instructions on how to include various header information and a JSON payload containing multiple param
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "gCKqaRkMzHy_7ZjUcz7se",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions",
    "name": "Create a payment instruction",
    "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": "cartReference",
              "type": "string",
              "example": "",
              "description": "The cart reference being purchased."
            },
            {
              "kind": "optional",
              "name": "paymentMethod",
              "type": "string",
              "example": "",
              "description": "The payment method for the payment instruction."
            },
            {
              "kind": "optional",
              "name": "addressReference",
              "type": "string",
              "example": "",
              "description": "The reference for the global level address for this request."
            },
            {
              "kind": "optional",
              "name": "voucherCode",
              "type": "string",
              "example": "",
              "description": "The voucher code to apply to the instruction."
            },
            {
              "kind": "optional",
              "name": "fulfilmentInfo",
              "type": "array",
              "schema": [
                {
                  "kind": "optional",
                  "name": "fulfilmentType",
                  "type": "string",
                  "example": "",
                  "description": "The type of the fulfilment"
                },
                {
                  "kind": "optional",
                  "name": "addressReference",
                  "type": "string",
                  "example": "",
                  "description": "The reference to the address for this fulfilment"
                },
                {
                  "kind": "optional",
                  "name": "fulfilmentDates",
                  "type": "array",
                  "example": [],
                  "itemType": "string",
                  "customType": "string[]",
                  "description": "List of dates for the fulfilments",
                  "itemExample": ""
                },
                {
                  "kind": "optional",
                  "name": "leadTime",
                  "type": "integer<int32>",
                  "example": 0,
                  "description": "The amount of lead days for the fulfilments"
                },
                {
                  "kind": "optional",
                  "name": "associatedPayments",
                  "type": "object",
                  "schema": [
                    {
                      "kind": "optional",
                      "name": "paymentDates",
                      "type": "array",
                      "example": [],
                      "itemType": "string",
                      "customType": "string[]",
                      "description": "The payment dates",
                      "itemExample": ""
                    },
                    {
                      "kind": "optional",
                      "name": "customPaymentParameters",
                      "type": "object",
                      "schema": [],
                      "example": {},
                      "description": "Custom payment parameters, each is applied to each order as 1:1."
                    }
                  ],
                  "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.AssociatedPayment",
                  "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.AssociatedPayment",
                  "description": "The payments to be associated with the fulfilment"
                },
                {
                  "kind": "optional",
                  "name": "customFulfilmentParameters",
                  "type": "object",
                  "schema": [],
                  "example": {},
                  "description": "Custom parameters for the fulfilment"
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.FulfilmentInfo",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.FulfilmentInfo[]",
              "description": "The information for fulfilments"
            },
            {
              "kind": "optional",
              "name": "synchronousPaymentInfo",
              "type": "object",
              "schema": [
                {
                  "kind": "optional",
                  "name": "paymentMethod",
                  "type": "string",
                  "example": "",
                  "description": "The payment method of the synchronous payment, which can differ to that of pending payments."
                },
                {
                  "kind": "optional",
                  "name": "customPaymentParameters",
                  "type": "object",
                  "schema": [],
                  "example": {},
                  "description": "Any custom parameters to be associated with this synchronous payment."
                },
                {
                  "kind": "optional",
                  "name": "enhancedProcessingData",
                  "type": "object",
                  "schema": [],
                  "example": {},
                  "description": "Gets or sets the Enhanced Processing Data parameters."
                }
              ],
              "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.SynchronousPaymentInfo",
              "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.SynchronousPaymentInfo",
              "description": "Info about an additional payment to be taken in this request (optional)."
            },
            {
              "kind": "optional",
              "name": "description",
              "type": "string",
              "example": "",
              "description": "The description for the new payment instruction."
            },
            {
              "kind": "optional",
              "name": "customPaymentInstructionParameters",
              "type": "object",
              "schema": [],
              "example": {},
              "description": "The custom payment instruction parameters."
            }
          ],
          "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.AddPaymentInstructionRequest",
          "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.AddPaymentInstructionRequest",
          "isExpanded": true,
          "description": "AddPaymentInstructionRequest class"
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "isExpanded": true,
        "statusCode": "201",
        "description": "Resource created at the URL given by the Location header.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Cart contains no line items.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "One or more referenced resources were not found.",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "412",
        "description": "Unable to create a payment instruction with a cart which is part of a predefined bundle",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "500",
        "description": "Internal error processing this request.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to create a new payment instruction for a registered account on the eSuite platform",
    "examples": {
      "languages": [
        {
          "id": "PgiRvTq5Ojsuy4eQmFUvu",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions \\\n     --header 'accept: application/json' \\\n     --header 'x-version: string'"
        },
        {
          "id": "VGeSMFH1wjBf1IuFL7FNn",
          "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}/payment-instructions\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "2pF05yIxMM18Sd9BOPRJu",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions\")\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": "3I6w1qw0RiCkBcqj0x17p",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions\"\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": "PgiRvTq5Ojsuy4eQmFUvu"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-201",
          "language": "201",
          "code": "// Resource created at the URL given by the Location header.\n"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Cart contains no line items.\n"
        },
        {
          "id": "response-2-404",
          "language": "404",
          "code": "// One or more referenced resources were not found.\n"
        },
        {
          "id": "response-3-412",
          "language": "412",
          "code": "// Unable to create a payment instruction with a cart which is part of a predefined bundle\n"
        },
        {
          "id": "response-4-500",
          "language": "500",
          "code": "// Internal error processing this request.\n"
        }
      ],
      "selectedLanguageId": "response-0-201"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}