---
title: Update a payment instruction
slug: docs/demo/update-a-payment-instruction
description: Learn how to make a PATCH request to the API endpoint of a fictive website, updating payment instructions for an account. This code example provides the necessary headers and data to efficiently send the request and accomplish the required changes.
docTags: 
createdAt: 2022-03-21T20:12:45.000Z
---

{
  "id": "kTjVHxc4OqC37Rf_gzYJ1",
  "data": {
    "url": "https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions/{paymentInstructionReference}",
    "name": "Update a payment instruction",
    "method": "PATCH",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "accountReference",
          "type": "string",
          "description": "The account reference"
        },
        {
          "kind": "required",
          "name": "paymentInstructionReference",
          "type": "string",
          "description": "The payment instruction 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": "patchRequest",
          "type": "array",
          "schema": [
            {
              "kind": "optional",
              "name": "value",
              "type": "object",
              "schema": [],
              "modelRef": "#/definitions/System.Object",
              "customType": "System.Object"
            },
            {
              "kind": "optional",
              "name": "path",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "op",
              "type": "string",
              "example": ""
            },
            {
              "kind": "optional",
              "name": "from",
              "type": "string",
              "example": ""
            }
          ],
          "modelRef": "#/definitions/Microsoft.AspNet.JsonPatch.JsonPatchDocument[FictiveGlobal.Api.Rest.Dtos.v1.Patch.PaymentInstructions.PaymentInstructionPatchModel]",
          "customType": "Microsoft.AspNet.JsonPatch.JsonPatchDocument[FictiveGlobal.Api.Rest.Dtos.v1.Patch.PaymentInstructions.PaymentInstructionPatchModel]",
          "isExpanded": true
        }
      ],
      "formDataParameters": []
    },
    "responses": [
      {
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "schema": [
              {
                "kind": "optional",
                "name": "paymentInstructionReference",
                "type": "string",
                "example": "",
                "description": "The payment instruction reference"
              },
              {
                "kind": "optional",
                "name": "status",
                "type": "string<Pending | Active | Completed | Cancelled>",
                "example": "",
                "description": "The payment instruction status"
              },
              {
                "kind": "optional",
                "name": "currency",
                "type": "string",
                "example": "",
                "description": "The currency of the payments associated with the PaymentInstruction"
              },
              {
                "kind": "optional",
                "name": "description",
                "type": "string",
                "example": "",
                "description": "The description of the payment instruction"
              },
              {
                "kind": "optional",
                "name": "cartReference",
                "type": "string",
                "example": "",
                "description": "The associated cart reference for this payment instruction"
              },
              {
                "kind": "optional",
                "name": "fulfilmentPaymentMappings",
                "type": "array",
                "schema": [
                  {
                    "kind": "optional",
                    "name": "fulfilments",
                    "type": "array",
                    "schema": [
                      {
                        "kind": "optional",
                        "name": "cartReference",
                        "type": "string",
                        "example": "",
                        "description": "The Fulfilment reference"
                      },
                      {
                        "kind": "optional",
                        "name": "fulfilmentReference",
                        "type": "string",
                        "example": "",
                        "description": "The Fulfilment reference"
                      },
                      {
                        "kind": "optional",
                        "name": "fulfilmentStatus",
                        "type": "string<Pending | Processing | Completed | Dispatched | Cancelled>",
                        "example": "",
                        "description": "The fulfilment Status"
                      },
                      {
                        "kind": "optional",
                        "name": "fulfilmentType",
                        "type": "string<Physical | Digital>",
                        "example": "",
                        "description": "The Fulfilment Type"
                      },
                      {
                        "kind": "optional",
                        "name": "expectedDeliveryDate",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.3073453",
                        "description": "The Expected delivery date"
                      },
                      {
                        "kind": "optional",
                        "name": "supplierNotificationDate",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.3073453",
                        "description": "The Supplier Notification date"
                      },
                      {
                        "kind": "optional",
                        "name": "addressReference",
                        "type": "string",
                        "example": "",
                        "description": "The associated address id of the fulfilment"
                      },
                      {
                        "kind": "optional",
                        "name": "dateCreated",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.3073453",
                        "description": "The Fulfilment date created"
                      },
                      {
                        "kind": "optional",
                        "name": "dateLastUpdated",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.3073453",
                        "description": "The Fulfilment last updated"
                      },
                      {
                        "kind": "optional",
                        "name": "customFulfilmentParameters",
                        "type": "object",
                        "schema": [],
                        "example": {},
                        "description": "A key-value store to hold custom params for the fulfilment"
                      }
                    ],
                    "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.Fulfilment",
                    "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.Fulfilment[]",
                    "description": "The list of fulfilments"
                  },
                  {
                    "kind": "optional",
                    "name": "payments",
                    "type": "array",
                    "schema": [
                      {
                        "kind": "optional",
                        "name": "cartReference",
                        "type": "string",
                        "example": "",
                        "description": "The cart reference"
                      },
                      {
                        "kind": "optional",
                        "name": "paymentReference",
                        "type": "string",
                        "example": "",
                        "description": "The payment reference"
                      },
                      {
                        "kind": "optional",
                        "name": "paymentDate",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.432364",
                        "description": "The Payment Date"
                      },
                      {
                        "kind": "optional",
                        "name": "paymentStatus",
                        "type": "string<None | Pending | Processed | Created | New | Confirmed | Dispatched | Cancelled | Notified | Reminder | Completed | Refunded | Waiting | Downloaded | SuspectedDuplicate | MaxRefunded | PartialRefunded | NeedToOrder | ProductsOrdered | Authorised | Unpaid>",
                        "example": "",
                        "description": "The payment status - represents a PendingOrder status or OrderStatus\r\n            depending on PaymentSource"
                      },
                      {
                        "kind": "optional",
                        "name": "dateCreated",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.432364",
                        "description": "The date the payment was created"
                      },
                      {
                        "kind": "optional",
                        "name": "dateLastUpdated",
                        "type": "string<date-time>",
                        "example": "2021-09-21T05:33:22.432364",
                        "description": "The date the payment was updated"
                      },
                      {
                        "kind": "optional",
                        "name": "vatAmount",
                        "type": "number<double>",
                        "example": "",
                        "description": "The VAT Amount"
                      },
                      {
                        "kind": "optional",
                        "name": "grossAmount",
                        "type": "number<double>",
                        "example": "",
                        "description": "The Gross Amount"
                      },
                      {
                        "kind": "optional",
                        "name": "netAmount",
                        "type": "number<double>",
                        "example": "",
                        "description": "The Net Amount"
                      },
                      {
                        "kind": "optional",
                        "name": "customPaymentParameters",
                        "type": "object",
                        "schema": [],
                        "example": {},
                        "description": "Custom payment parameters of the payment"
                      }
                    ],
                    "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.Payment",
                    "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.Payment[]",
                    "description": "The list of payments"
                  }
                ],
                "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.FulfilmentPaymentMapping",
                "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.FulfilmentPaymentMapping[]",
                "description": "A list of fulfilment-payment mappings"
              },
              {
                "kind": "optional",
                "name": "customPaymentInstructionParameters",
                "type": "object",
                "schema": [],
                "example": {},
                "description": "CustomPaymentInstructionParameters"
              }
            ],
            "modelRef": "#/definitions/FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.PaymentInstruction",
            "customType": "FictiveGlobal.Api.Rest.Dtos.v1.PaymentInstructions.PaymentInstruction",
            "isExpanded": true,
            "description": "Represents v1 DTO for the payment instruction"
          }
        ],
        "isExpanded": true,
        "statusCode": "204",
        "description": "No Content",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "400",
        "description": "Bad Request\r\n            <br />• The cancellation code is too long\r\n            <br />• Unable to amend payment instruction\r\n            <br />• The status can only be set to 'Cancelled'",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "401",
        "description": "Unauthorized\r\n            <br />• API Authentication Failure: Invalid Authentication Type/Credentials Provided",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "403",
        "description": "Forbidden\r\n            <br />• Cart is already in use and/or bound to another account",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "404",
        "description": "Not Found\r\n            <br />• Account cannot be found\r\n            <br />• Payment instruction cannot be found",
        "jsonExample": ""
      },
      {
        "isExpanded": true,
        "statusCode": "412",
        "description": "Precondition Failed\r\n            <br />• Can not amend payment instruction status that has already been cancelled\r\n            <br />• PATCH data validation failed.\r\n            <br />• Carts must contain a minimum of 1 line item.",
        "jsonExample": ""
      }
    ],
    "contentType": "application/json",
    "description": "This endpoint will provide the ability to update a payment instruction for a given account",
    "examples": {
      "languages": [
        {
          "id": "qWJXnJZl3nGOMCmXP7SU6",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request PATCH \\\n     --url https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions/{paymentInstructionReference} \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --header 'x-version: string' \\\n     --data '[\n     {}\n     ]'"
        },
        {
          "id": "62ImrL6YW-cYEvY-moYOx",
          "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 raw = JSON.stringify([\n   {}\n]);\n\nvar requestOptions = {\n   method: 'PATCH',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions/{paymentInstructionReference}\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "QFc6WMyPt9YTZqdTOkzI8",
          "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/{paymentInstructionReference}\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Patch.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest[\"x-version\"] = \"string\"\nrequest.body = JSON.dump([\n   {}\n])\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "AgnvTw9kbS999kTwXk9N0",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.fictive.com/REST/api/accounts/{accountReference}/payment-instructions/{paymentInstructionReference}\"\n\npayload = json.dumps([\n   {}\n])\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json',\n   'x-version': 'string'\n}\n\nresponse = requests.request(\"PATCH\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "qWJXnJZl3nGOMCmXP7SU6"
    },
    "results": {
      "languages": [
        {
          "id": "response-0-204",
          "language": "204",
          "code": "// No Content\n{\n  \"paymentInstructionReference\": \"\",\n  \"status\": \"\",\n  \"currency\": \"\",\n  \"description\": \"\",\n  \"cartReference\": \"\",\n  \"fulfilmentPaymentMappings\": [\n    {\n      \"fulfilments\": [\n        {\n          \"cartReference\": \"\",\n          \"fulfilmentReference\": \"\",\n          \"fulfilmentStatus\": \"\",\n          \"fulfilmentType\": \"\",\n          \"expectedDeliveryDate\": \"2021-09-21T05:33:22.3073453\",\n          \"supplierNotificationDate\": \"2021-09-21T05:33:22.3073453\",\n          \"addressReference\": \"\",\n          \"dateCreated\": \"2021-09-21T05:33:22.3073453\",\n          \"dateLastUpdated\": \"2021-09-21T05:33:22.3073453\",\n          \"customFulfilmentParameters\": {}\n        }\n      ],\n      \"payments\": [\n        {\n          \"cartReference\": \"\",\n          \"paymentReference\": \"\",\n          \"paymentDate\": \"2021-09-21T05:33:22.432364\",\n          \"paymentStatus\": \"\",\n          \"dateCreated\": \"2021-09-21T05:33:22.432364\",\n          \"dateLastUpdated\": \"2021-09-21T05:33:22.432364\",\n          \"vatAmount\": \"\",\n          \"grossAmount\": \"\",\n          \"netAmount\": \"\",\n          \"customPaymentParameters\": {}\n        }\n      ]\n    }\n  ],\n  \"customPaymentInstructionParameters\": {}\n}"
        },
        {
          "id": "response-1-400",
          "language": "400",
          "code": "// Bad Request\r\n            • The cancellation code is too long\r\n            • Unable to amend payment instruction\r\n            • The status can only be set to 'Cancelled'\n"
        },
        {
          "id": "response-2-401",
          "language": "401",
          "code": "// Unauthorized\r\n            • API Authentication Failure: Invalid Authentication Type/Credentials Provided\n"
        },
        {
          "id": "response-3-403",
          "language": "403",
          "code": "// Forbidden\r\n            • Cart is already in use and/or bound to another account\n"
        },
        {
          "id": "response-4-404",
          "language": "404",
          "code": "// Not Found\r\n            • Account cannot be found\r\n            • Payment instruction cannot be found\n"
        },
        {
          "id": "response-5-412",
          "language": "412",
          "code": "// Precondition Failed\r\n            • Can not amend payment instruction status that has already been cancelled\r\n            • PATCH data validation failed.\r\n            • Carts must contain a minimum of 1 line item.\n"
        }
      ],
      "selectedLanguageId": "response-0-204"
    }
  },
  "type": "api-oas-v2",
  "children": [
    {
      "text": ""
    }
  ]
}