{
  "openapi": "3.0.4",
  "info": {
    "title": "Order Processing",
    "description": "A suite of endpoints to guide your customer's purchasing journey.",
    "contact": {
      "name": "Stratus Team 8",
      "x-library-name": "Stratus.Common.OpenApi",
      "x-library-version": "2.0.3"
    },
    "version": "3.2"
  },
  "servers": [
    {
      "url": "https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service",
      "description": "Staging"
    },
    {
      "url": "https://mtapi.newdaytechnology.net/cl/merchant-gateway-service",
      "description": "Production"
    }
  ],
  "paths": {
    "/merchant/{customerRef}/spend-options": {
      "get": {
        "tags": [
          "Merchant"
        ],
        "summary": "Returns the unique spend option(s) available to a particular customer or applicant.",
        "description": "Returns the unique spend option(s) available to a particular customer or applicant.",
        "operationId": "SpendOptionsForCustomerRef",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "basketAmount",
            "in": "query",
            "description": "The total amount of the customer’s basket.",
            "schema": {
              "type": "number",
              "format": "double",
              "example": 1200
            },
            "example": 1200
          },
          {
            "name": "upfrontPaymentAmount",
            "in": "query",
            "description": "Optional up front payment amount.",
            "schema": {
              "type": "number",
              "format": "double",
              "example": 150
            },
            "example": 150
          },
          {
            "name": "futureSaleValueAmount",
            "in": "query",
            "description": "Optional future sale value amount.",
            "schema": {
              "type": "number",
              "format": "double",
              "example": 200
            },
            "example": 200
          },
          {
            "name": "promoOnly",
            "in": "query",
            "description": "Returns only the promotional offers if requested.",
            "schema": {
              "type": "boolean",
              "example": true
            },
            "example": true
          },
          {
            "name": "zeroPercentOnly",
            "in": "query",
            "description": "Returns the zero percent interest rate Spend Option(s) if requested.",
            "schema": {
              "type": "boolean",
              "example": true
            },
            "example": true
          },
          {
            "name": "spendType",
            "in": "query",
            "description": "Returns offers with requested spend type.",
            "schema": {
              "enum": [
                "Purchase",
                "Instalment",
                "BNPL"
              ],
              "type": "string",
              "description": "Specifies the spend-type of the spend option."
            },
            "example": "Instalment"
          },
          {
            "name": "orderBy",
            "in": "query",
            "description": "Returns the spend Option(s) in the requested order.",
            "schema": {
              "enum": [
                "InstalmentPaymentAmount",
                "Term",
                "TotalAmountPayable",
                "InterestRate"
              ],
              "type": "string",
              "description": "Used to sort spend options response"
            },
            "example": "InstalmentPaymentAmount"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The spend options are returned for the account",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SpendOptionsResponse"
                },
                "examples": {
                  "Example SpendOptionsResponse": {
                    "value": {
                      "options": [
                        {
                          "name": "6 Month spend option",
                          "description": "A 6 month instalment spend option",
                          "offerId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "offerCode": "some-offer-code",
                          "offerStatus": "Active",
                          "offerSource": "Product",
                          "spendType": "Instalment",
                          "interestRate": 0.25,
                          "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "duration": 6,
                          "illustration": {
                            "monthlyPayment": {
                              "value": 20,
                              "currencyCode": "GBP"
                            },
                            "interestToPay": {
                              "value": 10,
                              "currencyCode": "GBP"
                            },
                            "totalRepayable": {
                              "value": 100,
                              "currencyCode": "GBP"
                            }
                          },
                          "endDate": "2024-12-24T09:30:00+00:00",
                          "settlementPercentage": 0.05,
                          "refundPercentage": 0.1,
                          "chargebackPercentage": 0.1
                        }
                      ],
                      "futureSaleValueAmount": null
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpendOptionsResponse"
                },
                "examples": {
                  "Example SpendOptionsResponse": {
                    "value": {
                      "options": [
                        {
                          "name": "6 Month spend option",
                          "description": "A 6 month instalment spend option",
                          "offerId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "offerCode": "some-offer-code",
                          "offerStatus": "Active",
                          "offerSource": "Product",
                          "spendType": "Instalment",
                          "interestRate": 0.25,
                          "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "duration": 6,
                          "illustration": {
                            "monthlyPayment": {
                              "value": 20,
                              "currencyCode": "GBP"
                            },
                            "interestToPay": {
                              "value": 10,
                              "currencyCode": "GBP"
                            },
                            "totalRepayable": {
                              "value": 100,
                              "currencyCode": "GBP"
                            }
                          },
                          "endDate": "2024-12-24T09:30:00+00:00",
                          "settlementPercentage": 0.05,
                          "refundPercentage": 0.1,
                          "chargebackPercentage": 0.1
                        }
                      ],
                      "futureSaleValueAmount": null
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpendOptionsResponse"
                },
                "examples": {
                  "Example SpendOptionsResponse": {
                    "value": {
                      "options": [
                        {
                          "name": "6 Month spend option",
                          "description": "A 6 month instalment spend option",
                          "offerId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "offerCode": "some-offer-code",
                          "offerStatus": "Active",
                          "offerSource": "Product",
                          "spendType": "Instalment",
                          "interestRate": 0.25,
                          "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "duration": 6,
                          "illustration": {
                            "monthlyPayment": {
                              "value": 20,
                              "currencyCode": "GBP"
                            },
                            "interestToPay": {
                              "value": 10,
                              "currencyCode": "GBP"
                            },
                            "totalRepayable": {
                              "value": 100,
                              "currencyCode": "GBP"
                            }
                          },
                          "endDate": "2024-12-24T09:30:00+00:00",
                          "settlementPercentage": 0.05,
                          "refundPercentage": 0.1,
                          "chargebackPercentage": 0.1
                        }
                      ],
                      "futureSaleValueAmount": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The product associated with the account does not exist, or the account is closed, or no interest rates can be found for the account, or there is insufficient credit available for the account",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The promotional offers service is currently unavailable"
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request GET \\\n  --url 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/spend-options?basketAmount=1200&upfrontPaymentAmount=150&futureSaleValueAmount=200&promoOnly=true&zeroPercentOnly=true&spendType=Instalment&orderBy=InstalmentPaymentAmount' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/spend-options?basketAmount=1200&upfrontPaymentAmount=150&futureSaleValueAmount=200&promoOnly=true&zeroPercentOnly=true&spendType=Instalment&orderBy=InstalmentPaymentAmount\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = null;\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"GET\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/spend-options?basketAmount=1200&upfrontPaymentAmount=150&futureSaleValueAmount=200&promoOnly=true&zeroPercentOnly=true&spendType=Instalment&orderBy=InstalmentPaymentAmount\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/spend-options',\n  qs: {\n    basketAmount: '1200',\n    upfrontPaymentAmount: '150',\n    futureSaleValueAmount: '200',\n    promoOnly: 'true',\n    zeroPercentOnly: 'true',\n    spendType: 'Instalment',\n    orderBy: 'InstalmentPaymentAmount'\n  },\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'context-tenantId': 'SOME_STRING_VALUE'\n  }\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/spend-options": {
      "get": {
        "tags": [
          "Merchant"
        ],
        "summary": "Returns the spend options available to a particular Product.",
        "description": "Returns the spend options available to a particular Product.",
        "operationId": "SpendOptionsForProduct",
        "parameters": [
          {
            "name": "basketAmount",
            "in": "query",
            "description": "The total amount of the customer’s basket.",
            "schema": {
              "type": "number",
              "format": "double",
              "example": 100
            },
            "example": 100
          },
          {
            "name": "productId",
            "in": "query",
            "description": "Identifier assigned to the product.",
            "schema": {
              "type": "string",
              "format": "uuid",
              "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "promoOnly",
            "in": "query",
            "description": "Returns only the promotional offers if requested.",
            "schema": {
              "type": "boolean",
              "example": true
            },
            "example": true
          },
          {
            "name": "zeroPercentOnly",
            "in": "query",
            "description": "Returns the zero percent interest rate Spend Option(s) if requested.",
            "schema": {
              "type": "boolean",
              "example": true
            },
            "example": true
          },
          {
            "name": "spendType",
            "in": "query",
            "description": "Returns offers with requested spend type.",
            "schema": {
              "enum": [
                "Purchase",
                "Instalment",
                "BNPL"
              ],
              "type": "string",
              "description": "Specifies the spend-type of the spend option."
            },
            "example": "Instalment"
          },
          {
            "name": "orderBy",
            "in": "query",
            "description": "Returns the spend Option(s) in the requested order.",
            "schema": {
              "enum": [
                "InstalmentPaymentAmount",
                "Term",
                "TotalAmountPayable",
                "InterestRate"
              ],
              "type": "string",
              "description": "Used to sort spend options response"
            },
            "example": "InstalmentPaymentAmount"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The preboarding spend options are returned",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SpendOptionsResponse"
                },
                "examples": {
                  "Example SpendOptionsResponse": {
                    "value": {
                      "options": [
                        {
                          "name": "6 Month spend option",
                          "description": "A 6 month instalment spend option",
                          "offerId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "offerCode": "some-offer-code",
                          "offerStatus": "Active",
                          "offerSource": "Product",
                          "spendType": "Instalment",
                          "interestRate": 0.25,
                          "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "duration": 6,
                          "illustration": {
                            "monthlyPayment": {
                              "value": 20,
                              "currencyCode": "GBP"
                            },
                            "interestToPay": {
                              "value": 10,
                              "currencyCode": "GBP"
                            },
                            "totalRepayable": {
                              "value": 100,
                              "currencyCode": "GBP"
                            }
                          },
                          "endDate": "2024-12-24T09:30:00+00:00",
                          "settlementPercentage": 0.05,
                          "refundPercentage": 0.1,
                          "chargebackPercentage": 0.1
                        }
                      ],
                      "futureSaleValueAmount": null
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpendOptionsResponse"
                },
                "examples": {
                  "Example SpendOptionsResponse": {
                    "value": {
                      "options": [
                        {
                          "name": "6 Month spend option",
                          "description": "A 6 month instalment spend option",
                          "offerId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "offerCode": "some-offer-code",
                          "offerStatus": "Active",
                          "offerSource": "Product",
                          "spendType": "Instalment",
                          "interestRate": 0.25,
                          "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "duration": 6,
                          "illustration": {
                            "monthlyPayment": {
                              "value": 20,
                              "currencyCode": "GBP"
                            },
                            "interestToPay": {
                              "value": 10,
                              "currencyCode": "GBP"
                            },
                            "totalRepayable": {
                              "value": 100,
                              "currencyCode": "GBP"
                            }
                          },
                          "endDate": "2024-12-24T09:30:00+00:00",
                          "settlementPercentage": 0.05,
                          "refundPercentage": 0.1,
                          "chargebackPercentage": 0.1
                        }
                      ],
                      "futureSaleValueAmount": null
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SpendOptionsResponse"
                },
                "examples": {
                  "Example SpendOptionsResponse": {
                    "value": {
                      "options": [
                        {
                          "name": "6 Month spend option",
                          "description": "A 6 month instalment spend option",
                          "offerId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "offerCode": "some-offer-code",
                          "offerStatus": "Active",
                          "offerSource": "Product",
                          "spendType": "Instalment",
                          "interestRate": 0.25,
                          "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                          "duration": 6,
                          "illustration": {
                            "monthlyPayment": {
                              "value": 20,
                              "currencyCode": "GBP"
                            },
                            "interestToPay": {
                              "value": 10,
                              "currencyCode": "GBP"
                            },
                            "totalRepayable": {
                              "value": 100,
                              "currencyCode": "GBP"
                            }
                          },
                          "endDate": "2024-12-24T09:30:00+00:00",
                          "settlementPercentage": 0.05,
                          "refundPercentage": 0.1,
                          "chargebackPercentage": 0.1
                        }
                      ],
                      "futureSaleValueAmount": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The merchant id is empty guid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The product does not exist, or the merchant id claim is not valid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "The promotional offers service is currently unavailable"
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request GET \\\n  --url 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/spend-options?basketAmount=100&productId=bf62723f-f664-4527-b95b-4dfee33e427d&promoOnly=true&zeroPercentOnly=true&spendType=Instalment&orderBy=InstalmentPaymentAmount' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/spend-options?basketAmount=100&productId=bf62723f-f664-4527-b95b-4dfee33e427d&promoOnly=true&zeroPercentOnly=true&spendType=Instalment&orderBy=InstalmentPaymentAmount\");\nvar request = new RestRequest(Method.GET);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = null;\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"GET\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/spend-options?basketAmount=100&productId=bf62723f-f664-4527-b95b-4dfee33e427d&promoOnly=true&zeroPercentOnly=true&spendType=Instalment&orderBy=InstalmentPaymentAmount\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'GET',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/spend-options',\n  qs: {\n    basketAmount: '100',\n    productId: 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    promoOnly: 'true',\n    zeroPercentOnly: 'true',\n    spendType: 'Instalment',\n    orderBy: 'InstalmentPaymentAmount'\n  },\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'context-tenantId': 'SOME_STRING_VALUE'\n  }\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/{customerRef}/authorisation": {
      "post": {
        "tags": [
          "Merchant"
        ],
        "summary": "Obtain an approval for the purchase amount.",
        "description": "Obtain an approval for the purchase amount.",
        "operationId": "Authorise",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "idempotency-key",
            "in": "header",
            "description": "Identifier for idempotency, this header is required when making a request with an upfront payment.",
            "schema": {
              "type": "string"
            },
            "example": "EE735673-05F2-4C56-8A68-60170BDA4524"
          },
          {
            "name": "sca-token",
            "in": "header",
            "description": "Token of the SCA session.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "customer-access-token",
            "in": "header",
            "description": "The access token of the customer.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client-session-id",
            "in": "header",
            "description": "The unique session identifier set by the client.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "retail-channel",
            "in": "header",
            "description": "The channel of the transaction, either \"online\" or \"inStore\".",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Details required to obtain an authorisation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorisationRequest"
              },
              "examples": {
                "Example AuthorisationRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "orderReference": "someOrderReference",
                    "description": "A new FunBikes purchase",
                    "verificationId": "someVerificationId",
                    "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                    "upfrontPaymentAmount": null,
                    "paymentToken": null,
                    "paymentSessionId": null,
                    "fraudSignals": null
                  }
                }
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorisationRequest"
              },
              "examples": {
                "Example AuthorisationRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "orderReference": "someOrderReference",
                    "description": "A new FunBikes purchase",
                    "verificationId": "someVerificationId",
                    "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                    "upfrontPaymentAmount": null,
                    "paymentToken": null,
                    "paymentSessionId": null,
                    "fraudSignals": null
                  }
                }
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AuthorisationRequest"
              },
              "examples": {
                "Example AuthorisationRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "orderReference": "someOrderReference",
                    "description": "A new FunBikes purchase",
                    "verificationId": "someVerificationId",
                    "spendOptionId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                    "upfrontPaymentAmount": null,
                    "paymentToken": null,
                    "paymentSessionId": null,
                    "fraudSignals": null
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request was successfully processed and outcome of this processing can be one of two possibilities \n             1. \"Authorised\" along with authorisationId \n             2. \"Declined\" along with a reason",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorisationResponse"
                },
                "examples": {
                  "Authorisation Declined": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Declined",
                      "declineReason": "Declined (Please speak to your credit issuer)",
                      "redirect": null,
                      "upfrontPaymentAmount": null,
                      "futureSaleValueAmount": null
                    }
                  },
                  "Authorisation Succeeded": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Authorised",
                      "declineReason": null,
                      "redirect": null,
                      "upfrontPaymentAmount": null,
                      "futureSaleValueAmount": null
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorisationResponse"
                },
                "examples": {
                  "Authorisation Declined": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Declined",
                      "declineReason": "Declined (Please speak to your credit issuer)",
                      "redirect": null,
                      "upfrontPaymentAmount": null,
                      "futureSaleValueAmount": null
                    }
                  },
                  "Authorisation Succeeded": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Authorised",
                      "declineReason": null,
                      "redirect": null,
                      "upfrontPaymentAmount": null,
                      "futureSaleValueAmount": null
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuthorisationResponse"
                },
                "examples": {
                  "Authorisation Declined": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Declined",
                      "declineReason": "Declined (Please speak to your credit issuer)",
                      "redirect": null,
                      "upfrontPaymentAmount": null,
                      "futureSaleValueAmount": null
                    }
                  },
                  "Authorisation Succeeded": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Authorised",
                      "declineReason": null,
                      "redirect": null,
                      "upfrontPaymentAmount": null,
                      "futureSaleValueAmount": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid, the body will contain further details",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Request could not be processed. Possible reasons are: Merchant not found, action restricted, invalid SpendOptionId",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:unavailable",
                      "title": "Service unavailable.",
                      "status": 503
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation \\\n  --header 'client-session-id: SOME_STRING_VALUE' \\\n  --header 'content-type: application/json' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE' \\\n  --header 'customer-access-token: SOME_STRING_VALUE' \\\n  --header 'idempotency-key: EE735673-05F2-4C56-8A68-60170BDA4524' \\\n  --header 'retail-channel: SOME_STRING_VALUE' \\\n  --header 'sca-token: SOME_STRING_VALUE' \\\n  --data '{\"amount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"orderReference\":\"0000123456\",\"description\":\"A fridge\",\"verificationId\":\"string\",\"spendOptionId\":\"efb4929f-e781-4503-9035-18926cae56fd\",\"upfrontPaymentAmount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"paymentToken\":\"string\",\"paymentSessionId\":\"string\",\"fraudSignals\":{\"riskFlag\":\"string\",\"fulfillmentType\":\"string\",\"deliveryAddress\":{\"postcode\":\"string\"}}}'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nrequest.AddHeader(\"sca-token\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"customer-access-token\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"client-session-id\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"retail-channel\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"orderReference\\\":\\\"0000123456\\\",\\\"description\\\":\\\"A fridge\\\",\\\"verificationId\\\":\\\"string\\\",\\\"spendOptionId\\\":\\\"efb4929f-e781-4503-9035-18926cae56fd\\\",\\\"upfrontPaymentAmount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"paymentToken\\\":\\\"string\\\",\\\"paymentSessionId\\\":\\\"string\\\",\\\"fraudSignals\\\":{\\\"riskFlag\\\":\\\"string\\\",\\\"fulfillmentType\\\":\\\"string\\\",\\\"deliveryAddress\\\":{\\\"postcode\\\":\\\"string\\\"}}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = JSON.stringify({\n  \"amount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"orderReference\": \"0000123456\",\n  \"description\": \"A fridge\",\n  \"verificationId\": \"string\",\n  \"spendOptionId\": \"efb4929f-e781-4503-9035-18926cae56fd\",\n  \"upfrontPaymentAmount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"paymentToken\": \"string\",\n  \"paymentSessionId\": \"string\",\n  \"fraudSignals\": {\n    \"riskFlag\": \"string\",\n    \"fulfillmentType\": \"string\",\n    \"deliveryAddress\": {\n      \"postcode\": \"string\"\n    }\n  }\n});\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nxhr.setRequestHeader(\"sca-token\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"customer-access-token\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"client-session-id\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"retail-channel\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation',\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'idempotency-key': 'EE735673-05F2-4C56-8A68-60170BDA4524',\n    'sca-token': 'SOME_STRING_VALUE',\n    'customer-access-token': 'SOME_STRING_VALUE',\n    'client-session-id': 'SOME_STRING_VALUE',\n    'retail-channel': 'SOME_STRING_VALUE',\n    'context-tenantId': 'SOME_STRING_VALUE',\n    'content-type': 'application/json'\n  },\n  body: {\n    amount: {value: 50, currencyCode: 'GBP'},\n    orderReference: '0000123456',\n    description: 'A fridge',\n    verificationId: 'string',\n    spendOptionId: 'efb4929f-e781-4503-9035-18926cae56fd',\n    upfrontPaymentAmount: {value: 50, currencyCode: 'GBP'},\n    paymentToken: 'string',\n    paymentSessionId: 'string',\n    fraudSignals: {\n      riskFlag: 'string',\n      fulfillmentType: 'string',\n      deliveryAddress: {postcode: 'string'}\n    }\n  },\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/{customerRef}/authorisation/{authorisationId}/upward-adjustment": {
      "post": {
        "tags": [
          "Merchant"
        ],
        "summary": "Obtain a new approval for an upward adjustment of the amount using the details from the original authorisation",
        "description": "Obtain a new approval for an upward adjustment of the amount using the details from the original authorisation",
        "operationId": "UpwardAdjustment",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "authorisationId",
            "in": "path",
            "description": "Identifier assigned to the approved authorisation request.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "5200aa31-2a3a-47ab-a82e-3a91bf3068d8"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "idempotency-key",
            "in": "header",
            "description": "Identifier for idempotency",
            "schema": {
              "type": "string"
            },
            "example": "EE735673-05F2-4C56-8A68-60170BDA4524"
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Details required to obtain an upward adjustment.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpwardAdjustmentRequest"
              },
              "examples": {
                "Example UpwardAdjustmentRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    }
                  }
                }
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/UpwardAdjustmentRequest"
              },
              "examples": {
                "Example UpwardAdjustmentRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    }
                  }
                }
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/UpwardAdjustmentRequest"
              },
              "examples": {
                "Example UpwardAdjustmentRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request was successfully processed and outcome of this processing can be one of two possibilities \n             1. \"Authorised\" along with authorisationId \n             2. \"Declined\" along with a reason",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UpwardAdjustmentResponse"
                },
                "examples": {
                  "Upward Adjustment Declined": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Declined",
                      "declineReason": "Declined (Please speak to your credit issuer)"
                    }
                  },
                  "Upward Adjustment Succeeded": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Authorised",
                      "declineReason": null
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpwardAdjustmentResponse"
                },
                "examples": {
                  "Upward Adjustment Declined": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Declined",
                      "declineReason": "Declined (Please speak to your credit issuer)"
                    }
                  },
                  "Upward Adjustment Succeeded": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Authorised",
                      "declineReason": null
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpwardAdjustmentResponse"
                },
                "examples": {
                  "Upward Adjustment Declined": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Declined",
                      "declineReason": "Declined (Please speak to your credit issuer)"
                    }
                  },
                  "Upward Adjustment Succeeded": {
                    "value": {
                      "authorisationId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "result": "Authorised",
                      "declineReason": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid, the body will contain further details",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Request could not be processed. Possible reasons are: Merchant not found, action restricted, invalid SpendOptionId",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:unavailable",
                      "title": "Service unavailable.",
                      "status": 503
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/upward-adjustment \\\n  --header 'content-type: application/json' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE' \\\n  --header 'idempotency-key: EE735673-05F2-4C56-8A68-60170BDA4524' \\\n  --data '{\"amount\":{\"value\":50,\"currencyCode\":\"GBP\"}}'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/upward-adjustment\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"}}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = JSON.stringify({\n  \"amount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  }\n});\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/upward-adjustment\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/upward-adjustment',\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'idempotency-key': 'EE735673-05F2-4C56-8A68-60170BDA4524',\n    'context-tenantId': 'SOME_STRING_VALUE',\n    'content-type': 'application/json'\n  },\n  body: {amount: {value: 50, currencyCode: 'GBP'}},\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/{customerRef}/authorisation/{authorisationId}/settle": {
      "post": {
        "tags": [
          "Merchant"
        ],
        "summary": "Settle an authorisation.",
        "description": "Settle an authorisation.",
        "operationId": "Settle",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "authorisationId",
            "in": "path",
            "description": "Identifier assigned to the approved authorisation request.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "5200aa31-2a3a-47ab-a82e-3a91bf3068d8"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "idempotency-key",
            "in": "header",
            "description": "Identifier for idempotency",
            "schema": {
              "type": "string"
            },
            "example": "EE735673-05F2-4C56-8A68-60170BDA4524"
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Details required to settle an authorisation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettleRequest"
              },
              "examples": {
                "Example SettleRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "description": "A new FunBikes purchase",
                    "orderReference": null,
                    "debitOrder": "Credit"
                  }
                }
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/SettleRequest"
              },
              "examples": {
                "Example SettleRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "description": "A new FunBikes purchase",
                    "orderReference": null,
                    "debitOrder": "Credit"
                  }
                }
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/SettleRequest"
              },
              "examples": {
                "Example SettleRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "description": "A new FunBikes purchase",
                    "orderReference": null,
                    "debitOrder": "Credit"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Transaction is settled",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/SettleResponse"
                },
                "examples": {
                  "Example SettleResponse": {
                    "value": {
                      "transactionId": "71b17112-4762-407b-aefb-374dd4fcdb64"
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettleResponse"
                },
                "examples": {
                  "Example SettleResponse": {
                    "value": {
                      "transactionId": "71b17112-4762-407b-aefb-374dd4fcdb64"
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/SettleResponse"
                },
                "examples": {
                  "Example SettleResponse": {
                    "value": {
                      "transactionId": "71b17112-4762-407b-aefb-374dd4fcdb64"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The authorisation id or the merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:unavailable",
                      "title": "Service unavailable.",
                      "status": 503
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/settle \\\n  --header 'content-type: application/json' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE' \\\n  --header 'idempotency-key: EE735673-05F2-4C56-8A68-60170BDA4524' \\\n  --data '{\"amount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"description\":\"string\",\"orderReference\":\"0000123456\",\"debitOrder\":\"Credit\"}'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/settle\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"description\\\":\\\"string\\\",\\\"orderReference\\\":\\\"0000123456\\\",\\\"debitOrder\\\":\\\"Credit\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = JSON.stringify({\n  \"amount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"description\": \"string\",\n  \"orderReference\": \"0000123456\",\n  \"debitOrder\": \"Credit\"\n});\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/settle\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/settle',\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'idempotency-key': 'EE735673-05F2-4C56-8A68-60170BDA4524',\n    'context-tenantId': 'SOME_STRING_VALUE',\n    'content-type': 'application/json'\n  },\n  body: {\n    amount: {value: 50, currencyCode: 'GBP'},\n    description: 'string',\n    orderReference: '0000123456',\n    debitOrder: 'Credit'\n  },\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/{customerRef}/authorisation/{authorisationId}/reverse": {
      "post": {
        "tags": [
          "Merchant"
        ],
        "summary": "Reverse an authorisation.",
        "description": "Reverse an authorisation.",
        "operationId": "Reverse",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "authorisationId",
            "in": "path",
            "description": "Identifier assigned to the approved authorisation request.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "5200aa31-2a3a-47ab-a82e-3a91bf3068d8"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "idempotency-key",
            "in": "header",
            "description": "Identifier for idempotency",
            "schema": {
              "type": "string"
            },
            "example": "EE735673-05F2-4C56-8A68-60170BDA4524"
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Details required to reverse an auhtorisation.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseRequest"
              },
              "examples": {
                "Example ReverseRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "reverseOrder": null
                  }
                }
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseRequest"
              },
              "examples": {
                "Example ReverseRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "reverseOrder": null
                  }
                }
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ReverseRequest"
              },
              "examples": {
                "Example ReverseRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "reverseOrder": null
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A reversal is successful and a unique authorisation Reversal Id is created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ReverseResponse"
                },
                "examples": {
                  "Example ReverseResponse": {
                    "value": {
                      "authorisationReversalId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "remainingFloat": {
                        "value": 1000,
                        "currencyCode": "GBP"
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReverseResponse"
                },
                "examples": {
                  "Example ReverseResponse": {
                    "value": {
                      "authorisationReversalId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "remainingFloat": {
                        "value": 1000,
                        "currencyCode": "GBP"
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ReverseResponse"
                },
                "examples": {
                  "Example ReverseResponse": {
                    "value": {
                      "authorisationReversalId": "71b17112-4762-407b-aefb-374dd4fcdb64",
                      "remainingFloat": {
                        "value": 1000,
                        "currencyCode": "GBP"
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The authorisation id, or the merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Reversal amount is greater than the remaining authorised amount",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:unavailable",
                      "title": "Service unavailable.",
                      "status": 503
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/reverse \\\n  --header 'content-type: application/json' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE' \\\n  --header 'idempotency-key: EE735673-05F2-4C56-8A68-60170BDA4524' \\\n  --data '{\"amount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"reverseOrder\":\"Credit\"}'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/reverse\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"reverseOrder\\\":\\\"Credit\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = JSON.stringify({\n  \"amount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"reverseOrder\": \"Credit\"\n});\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/reverse\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/authorisation/5200aa31-2a3a-47ab-a82e-3a91bf3068d8/reverse',\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'idempotency-key': 'EE735673-05F2-4C56-8A68-60170BDA4524',\n    'context-tenantId': 'SOME_STRING_VALUE',\n    'content-type': 'application/json'\n  },\n  body: {amount: {value: 50, currencyCode: 'GBP'}, reverseOrder: 'Credit'},\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/{customerRef}/transaction/{transactionId}/refund": {
      "post": {
        "tags": [
          "Merchant"
        ],
        "summary": "Refund a settled transaction.",
        "description": "Refund a settled transaction.",
        "operationId": "Refund",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "transactionId",
            "in": "path",
            "description": "Identifier assigned to a successful Settle request.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "0b2a58d0-307c-4500-98ab-013378efc6f4"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "idempotency-key",
            "in": "header",
            "description": "Identifier for idempotency",
            "schema": {
              "type": "string"
            },
            "example": "EE735673-05F2-4C56-8A68-60170BDA4524"
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Details required to refund a transaction.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundRequest"
              },
              "examples": {
                "Example RefundRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "description": "A new FunBikes purchase",
                    "refundInterest": true,
                    "creditOrder": null,
                    "refundTarget": null
                  }
                }
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/RefundRequest"
              },
              "examples": {
                "Example RefundRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "description": "A new FunBikes purchase",
                    "refundInterest": true,
                    "creditOrder": null,
                    "refundTarget": null
                  }
                }
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/RefundRequest"
              },
              "examples": {
                "Example RefundRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "description": "A new FunBikes purchase",
                    "refundInterest": true,
                    "creditOrder": null,
                    "refundTarget": null
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A refund is successful and a unique Refund Transaction Id is created",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/RefundResponse"
                },
                "examples": {
                  "Example RefundResponse": {
                    "value": {
                      "refundTransactionId": "71b17112-4762-407b-aefb-374dd4fcdb64"
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundResponse"
                },
                "examples": {
                  "Example RefundResponse": {
                    "value": {
                      "refundTransactionId": "71b17112-4762-407b-aefb-374dd4fcdb64"
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/RefundResponse"
                },
                "examples": {
                  "Example RefundResponse": {
                    "value": {
                      "refundTransactionId": "71b17112-4762-407b-aefb-374dd4fcdb64"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The transaction id, or the merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "The amount to be refunded exceeds the settled transaction amount, the settled transaction was already refunded, or the supplied transaction id does not match the account",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "This merchant has issued too many transaction refunds",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:unavailable",
                      "title": "Service unavailable.",
                      "status": 503
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/transaction/0b2a58d0-307c-4500-98ab-013378efc6f4/refund \\\n  --header 'content-type: application/json' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE' \\\n  --header 'idempotency-key: EE735673-05F2-4C56-8A68-60170BDA4524' \\\n  --data '{\"amount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"description\":\"Some description\",\"refundInterest\":true,\"creditOrder\":\"Credit\",\"refundTarget\":\"string\"}'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/transaction/0b2a58d0-307c-4500-98ab-013378efc6f4/refund\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"description\\\":\\\"Some description\\\",\\\"refundInterest\\\":true,\\\"creditOrder\\\":\\\"Credit\\\",\\\"refundTarget\\\":\\\"string\\\"}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = JSON.stringify({\n  \"amount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"description\": \"Some description\",\n  \"refundInterest\": true,\n  \"creditOrder\": \"Credit\",\n  \"refundTarget\": \"string\"\n});\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/transaction/0b2a58d0-307c-4500-98ab-013378efc6f4/refund\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/transaction/0b2a58d0-307c-4500-98ab-013378efc6f4/refund',\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'idempotency-key': 'EE735673-05F2-4C56-8A68-60170BDA4524',\n    'context-tenantId': 'SOME_STRING_VALUE',\n    'content-type': 'application/json'\n  },\n  body: {\n    amount: {value: 50, currencyCode: 'GBP'},\n    description: 'Some description',\n    refundInterest: true,\n    creditOrder: 'Credit',\n    refundTarget: 'string'\n  },\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    },
    "/merchant/{customerRef}/initiate": {
      "post": {
        "tags": [
          "Merchant"
        ],
        "summary": "Check if Strong Customer Authentication is required for the customers purchase. Strong Customer Authentication will use Finance amount.",
        "description": "Check if Strong Customer Authentication is required for the customers purchase.",
        "operationId": "Initiate",
        "parameters": [
          {
            "name": "customerRef",
            "in": "path",
            "description": "Identifier assigned to the Customer.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "123456789"
          },
          {
            "name": "context-merchantId",
            "in": "header",
            "description": "Identifier assigned to the Merchant.",
            "required": true,
            "schema": {
              "type": "string"
            },
            "example": "bf62723f-f664-4527-b95b-4dfee33e427d"
          },
          {
            "name": "idempotency-key",
            "in": "header",
            "description": "Identifier for idempotency",
            "schema": {
              "type": "string"
            },
            "example": "EE735673-05F2-4C56-8A68-60170BDA4524"
          },
          {
            "name": "customer-access-token",
            "in": "header",
            "description": "The access token of the customer.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "client-session-id",
            "in": "header",
            "description": "The unique session identifier set by the client.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "context-tenantId",
            "in": "header",
            "description": "Identifier assigned to the tenant.",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "requestBody": {
          "description": "Details required to initiate a transaction.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InitiateRequest"
              },
              "examples": {
                "Example InitiateRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "upfrontPaymentAmount": null,
                    "forceStepUp": null,
                    "scaCheckOnly": null
                  }
                }
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/InitiateRequest"
              },
              "examples": {
                "Example InitiateRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "upfrontPaymentAmount": null,
                    "forceStepUp": null,
                    "scaCheckOnly": null
                  }
                }
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/InitiateRequest"
              },
              "examples": {
                "Example InitiateRequest": {
                  "value": {
                    "amount": {
                      "value": 1000,
                      "currencyCode": "GBP"
                    },
                    "upfrontPaymentAmount": null,
                    "forceStepUp": null,
                    "scaCheckOnly": null
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "A initiate request is successful",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/InitiateResponse"
                },
                "examples": {
                  "Example InitiateResponse": {
                    "value": {
                      "scaToken": "someJwt",
                      "expiresAt": "2024-12-24 09:30:00.000",
                      "status": "Authenticated",
                      "links": [
                        {
                          "href": "https://localhost/sca/sca-token",
                          "rel": "ui",
                          "type": "GET"
                        }
                      ],
                      "exemptions": [],
                      "factors": [],
                      "lowValueTransactionLimits": null
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitiateResponse"
                },
                "examples": {
                  "Example InitiateResponse": {
                    "value": {
                      "scaToken": "someJwt",
                      "expiresAt": "2024-12-24 09:30:00.000",
                      "status": "Authenticated",
                      "links": [
                        {
                          "href": "https://localhost/sca/sca-token",
                          "rel": "ui",
                          "type": "GET"
                        }
                      ],
                      "exemptions": [],
                      "factors": [],
                      "lowValueTransactionLimits": null
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/InitiateResponse"
                },
                "examples": {
                  "Example InitiateResponse": {
                    "value": {
                      "scaToken": "someJwt",
                      "expiresAt": "2024-12-24 09:30:00.000",
                      "status": "Authenticated",
                      "links": [
                        {
                          "href": "https://localhost/sca/sca-token",
                          "rel": "ui",
                          "type": "GET"
                        }
                      ],
                      "exemptions": [],
                      "factors": [],
                      "lowValueTransactionLimits": null
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "The request is invalid",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/ValidationProblemDetails"
                },
                "examples": {
                  "Example ValidationProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:validation",
                      "title": "One or more validation errors occurred.",
                      "errors": {
                        "amount": [
                          "AmountNotProvided"
                        ]
                      }
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorised.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:authenticationFailed",
                      "title": "Unauthorised.",
                      "status": 401
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Forbidden.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:forbidden",
                      "title": "Forbidden.",
                      "status": 403
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "The merchant customer id or its associated account cannot be found",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/NotFoundProblemDetails"
                },
                "examples": {
                  "Example NotFoundProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:missing",
                      "title": "SpendOptionIdNotFound",
                      "status": 404
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Account spend is restricted",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableEntityProblemDetails"
                },
                "examples": {
                  "Example UnprocessableEntityProblemDetails": {
                    "value": {
                      "type": "newday:merchantgateway:error:unprocessable",
                      "title": "SpendOptionIdInvalid",
                      "status": 422
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "The number of requests exceeded the maximum allowed.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:tooManyRequests",
                      "title": "The number of requests exceeded the maximum allowed.",
                      "status": 429
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "An internal server error occurred.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:error",
                      "title": "An internal server error occurred.",
                      "status": 500
                    }
                  }
                }
              }
            }
          },
          "502": {
            "description": "Bad gateway.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:badGateway",
                      "title": "Bad gateway.",
                      "status": 502
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Service unavailable.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:unavailable",
                      "title": "Service unavailable.",
                      "status": 503
                    }
                  }
                }
              }
            }
          },
          "504": {
            "description": "Gateway timeout.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetails"
                },
                "examples": {
                  "example": {
                    "value": {
                      "type": "stratus:merchant-gateway:error:gatewayTimeout",
                      "title": "Gateway timeout.",
                      "status": 504
                    }
                  }
                }
              }
            }
          }
        },
        "x-codeSamples": [
          {
            "lang": "Shell + Curl",
            "source": "curl --request POST \\\n  --url https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/initiate \\\n  --header 'client-session-id: SOME_STRING_VALUE' \\\n  --header 'content-type: application/json' \\\n  --header 'context-merchantId: bf62723f-f664-4527-b95b-4dfee33e427d' \\\n  --header 'context-tenantId: SOME_STRING_VALUE' \\\n  --header 'customer-access-token: SOME_STRING_VALUE' \\\n  --header 'idempotency-key: EE735673-05F2-4C56-8A68-60170BDA4524' \\\n  --data '{\"amount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"upfrontPaymentAmount\":{\"value\":50,\"currencyCode\":\"GBP\"},\"forceStepUp\":true,\"scaCheckOnly\":true}'"
          },
          {
            "lang": "Csharp + Restsharp",
            "source": "var client = new RestClient(\"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/initiate\");\nvar request = new RestRequest(Method.POST);\nrequest.AddHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nrequest.AddHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nrequest.AddHeader(\"customer-access-token\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"client-session-id\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nrequest.AddHeader(\"content-type\", \"application/json\");\nrequest.AddParameter(\"application/json\", \"{\\\"amount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"upfrontPaymentAmount\\\":{\\\"value\\\":50,\\\"currencyCode\\\":\\\"GBP\\\"},\\\"forceStepUp\\\":true,\\\"scaCheckOnly\\\":true}\", ParameterType.RequestBody);\nIRestResponse response = client.Execute(request);"
          },
          {
            "lang": "Javascript + Xhr",
            "source": "const data = JSON.stringify({\n  \"amount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"upfrontPaymentAmount\": {\n    \"value\": 50,\n    \"currencyCode\": \"GBP\"\n  },\n  \"forceStepUp\": true,\n  \"scaCheckOnly\": true\n});\n\nconst xhr = new XMLHttpRequest();\nxhr.withCredentials = true;\n\nxhr.addEventListener(\"readystatechange\", function () {\n  if (this.readyState === this.DONE) {\n    console.log(this.responseText);\n  }\n});\n\nxhr.open(\"POST\", \"https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/initiate\");\nxhr.setRequestHeader(\"context-merchantId\", \"bf62723f-f664-4527-b95b-4dfee33e427d\");\nxhr.setRequestHeader(\"idempotency-key\", \"EE735673-05F2-4C56-8A68-60170BDA4524\");\nxhr.setRequestHeader(\"customer-access-token\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"client-session-id\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"context-tenantId\", \"SOME_STRING_VALUE\");\nxhr.setRequestHeader(\"content-type\", \"application/json\");\n\nxhr.send(data);"
          },
          {
            "lang": "Node + Request",
            "source": "const request = require('request');\n\nconst options = {\n  method: 'POST',\n  url: 'https://mtapi.stg-newdaytechnology.net/cl/merchant-gateway-service/merchant/123456789/initiate',\n  headers: {\n    'context-merchantId': 'bf62723f-f664-4527-b95b-4dfee33e427d',\n    'idempotency-key': 'EE735673-05F2-4C56-8A68-60170BDA4524',\n    'customer-access-token': 'SOME_STRING_VALUE',\n    'client-session-id': 'SOME_STRING_VALUE',\n    'context-tenantId': 'SOME_STRING_VALUE',\n    'content-type': 'application/json'\n  },\n  body: {\n    amount: {value: 50, currencyCode: 'GBP'},\n    upfrontPaymentAmount: {value: 50, currencyCode: 'GBP'},\n    forceStepUp: true,\n    scaCheckOnly: true\n  },\n  json: true\n};\n\nrequest(options, function (error, response, body) {\n  if (error) throw new Error(error);\n\n  console.log(body);\n});\n"
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Amount": {
        "required": [
          "currencyCode",
          "value"
        ],
        "type": "object",
        "properties": {
          "value": {
            "type": "number",
            "description": "The monetary amount",
            "format": "double",
            "example": 50
          },
          "currencyCode": {
            "type": "string",
            "description": "The three character ISO currency code for the amount",
            "example": "GBP"
          }
        },
        "additionalProperties": false,
        "description": "Represents a monetary amount with value and currency code"
      },
      "AuthorisationRequest": {
        "required": [
          "amount"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "orderReference": {
            "type": "string",
            "description": "Order reference provided by the Merchant.",
            "nullable": true,
            "example": "0000123456"
          },
          "description": {
            "type": "string",
            "description": "An optional description to associate with the authorisation request.",
            "nullable": true,
            "example": "A fridge"
          },
          "verificationId": {
            "type": "string",
            "description": "Unique session identifier required to support the device biometrics process.",
            "nullable": true
          },
          "spendOptionId": {
            "type": "string",
            "description": "Identifier assigned to the SpendOptions (Interest rate, Term duration and Spend type options as selected by the customer).",
            "nullable": true,
            "example": "efb4929f-e781-4503-9035-18926cae56fd"
          },
          "upfrontPaymentAmount": {
            "$ref": "#/components/schemas/Amount"
          },
          "paymentToken": {
            "type": "string",
            "description": "An encoded token that can be used to process the payment.",
            "nullable": true
          },
          "paymentSessionId": {
            "type": "string",
            "description": "The identifier of the payment session created for this authorisation.",
            "nullable": true
          },
          "fraudSignals": {
            "$ref": "#/components/schemas/FraudSignals"
          }
        },
        "additionalProperties": false,
        "description": "Model used when requesting an authorisation."
      },
      "AuthorisationResponse": {
        "type": "object",
        "properties": {
          "authorisationId": {
            "type": "string",
            "description": "Identifier assigned to the approved authorisation request.",
            "format": "uuid",
            "nullable": true,
            "example": "6fe486cf-3193-40ef-a850-f7659e717c6e"
          },
          "result": {
            "$ref": "#/components/schemas/AuthorisationStatus"
          },
          "declineReason": {
            "type": "string",
            "description": "Declined reason if the request has been declined.",
            "nullable": true,
            "example": "Declined (Please speak to your credit issuer)"
          },
          "redirect": {
            "$ref": "#/components/schemas/PaymentRedirectUrl"
          },
          "upfrontPaymentAmount": {
            "$ref": "#/components/schemas/Amount"
          },
          "futureSaleValueAmount": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "additionalProperties": false,
        "description": "Model returned when an authorisation is created."
      },
      "AuthorisationStatus": {
        "enum": [
          "Authorised",
          "Declined",
          "AdditionalStepNeeded"
        ],
        "type": "string"
      },
      "FraudSignals": {
        "type": "object",
        "properties": {
          "riskFlag": {
            "type": "string",
            "description": "A flag indicating the risk level associated with the transaction.",
            "nullable": true
          },
          "fulfillmentType": {
            "type": "string",
            "description": "The fulfilment type for the order.",
            "nullable": true
          },
          "deliveryAddress": {
            "$ref": "#/components/schemas/FraudSignalsDeliveryAddress"
          }
        },
        "additionalProperties": false,
        "description": "Optional fraud signal data to assist with risk assessment."
      },
      "FraudSignalsDeliveryAddress": {
        "type": "object",
        "properties": {
          "postcode": {
            "type": "string",
            "description": "The postcode of the delivery address.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Delivery address details for fraud signal assessment."
      },
      "Illustration": {
        "type": "object",
        "properties": {
          "monthlyPayment": {
            "$ref": "#/components/schemas/Amount"
          },
          "interestToPay": {
            "$ref": "#/components/schemas/Amount"
          },
          "totalRepayable": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "additionalProperties": false,
        "description": "Repayment terms of the offer. Applicable to instalment offers only."
      },
      "InitiateLink": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string",
            "description": "The web URL available to traverse to."
          },
          "rel": {
            "type": "string",
            "description": "The relationship to the SCA session. 'ui' is the authentication customer interface."
          },
          "type": {
            "type": "string",
            "description": "The http method for accessing the href."
          }
        },
        "additionalProperties": false,
        "description": "Links revelant to traversing the SCA session."
      },
      "InitiateLowValueTransactionLimits": {
        "type": "object",
        "properties": {
          "remainingCount": {
            "type": "number",
            "description": "The remaining number of low-value transactions allowed before requiring SCA step-up.",
            "format": "double",
            "nullable": true
          },
          "remainingAmount": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "additionalProperties": false,
        "description": "Low value transaction limits."
      },
      "InitiateRequest": {
        "required": [
          "amount"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "upfrontPaymentAmount": {
            "$ref": "#/components/schemas/Amount"
          },
          "forceStepUp": {
            "type": "boolean",
            "description": "Enable Merchant/Lender Fraud Tooling to override exemptions and force PSD2 step up",
            "nullable": true
          },
          "scaCheckOnly": {
            "type": "boolean",
            "description": "When provided with a customer reference and transaction details, SCA check endpoint evaluates a transaction against applicable SCA exemptions, \nit also returns SCA step-up options available - OTP or Mobile Authentication. \nIt is informational only and has no side effects, such as incrementing low-value transaction counters.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Model used when initiating if Strong Customer Authentication is required."
      },
      "InitiateResponse": {
        "type": "object",
        "properties": {
          "scaToken": {
            "type": "string",
            "description": "Token of the SCA session.",
            "nullable": true,
            "example": "eyJlbmMiOiJBMjU2R0NNIiwiYWxnIjoiUlNBLU9BRVAtMjU2In0.O01BFr_XxGzKEUb_Z9vQOW3DX2cQFxojrRy2JyM5_nqKnrpAa0rvcPI_ViT2PdPRogBwjHGRDM2uNLd1BberKQlaZYuqPGXnpzDQjosF0tQlgdtY3uEZUMT-9WPP8jCxxQg0AGIm4abkp1cgzAWBQzm1QYL8fwaz16MS48ExRz41dLhA0aEWE4e7TYzjrfaK8M4wIUlQCFIl-wS1N3U8W2XeUc9MLYGmHft_Rd9KJs1c-9KKdUQf6tEzJ92TGEC7TRZX4hGdtszIq3GGGBQaW8P9jPozqaDdrikF18D0btRHNf3_57sR_CPEGYX0O4mY775CLWqB4Y1adNn-fZ0xoA.ln7IYZDF9TdBIK6i.ZhQ3Q5TY827KFQw8DdRRzQVJVFdIE03B6AxMNZ1sQIjlUB4QUxg-UYqjPJESPUmFsODeshGWLa5t4tUri5j6uC4mFDbkbemPmNKIQiY5m8yc.5KKhrggMRm7ydVRQKJaT0g"
          },
          "expiresAt": {
            "type": "string",
            "description": "Timestamp for the expiry of the SCA session, in ISO 8601 format.",
            "nullable": true,
            "example": "2024-07-19T09:14:44.568Z"
          },
          "status": {
            "$ref": "#/components/schemas/SCAStatus"
          },
          "links": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/InitiateLink"
            },
            "description": "Links revelant to traversing the SCA session."
          },
          "exemptions": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "SCA exemptions available, such as Low Value Transaction (LVT) or Trusted Retailer.",
            "example": [
              "Low value transaction",
              "Trusted Retailer"
            ]
          },
          "factors": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "SCA authentication factors available, such as SMS or MobileAuthentication.",
            "example": [
              "SMS",
              "MobileAuthentication"
            ]
          },
          "lowValueTransactionLimits": {
            "$ref": "#/components/schemas/InitiateLowValueTransactionLimits"
          }
        },
        "additionalProperties": false,
        "description": "Model returned when initiating an authorisation."
      },
      "NotFoundProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "OfferSource": {
        "enum": [
          "Promotional",
          "Product"
        ],
        "type": "string",
        "description": "Specifies the source of the parent offer. Applicable to instalment offers only."
      },
      "OfferStatus": {
        "enum": [
          "Active",
          "Inactive",
          "Expired"
        ],
        "type": "string",
        "description": "Specifies whether the parent offer is Active, Inactive or Expired. Applicable to instalment offers only."
      },
      "PaymentRedirectUrl": {
        "type": "object",
        "properties": {
          "href": {
            "type": "string",
            "description": "Contains the redirect URL to the payment UI."
          }
        },
        "additionalProperties": false,
        "description": "The payment redirect URL model."
      },
      "ProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "RefundRequest": {
        "required": [
          "amount"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "description": {
            "type": "string",
            "description": "An optional description to associate with the refund.",
            "nullable": true,
            "example": "Some description"
          },
          "refundInterest": {
            "type": "boolean",
            "description": "Interest associated to the Settled transaction will be refunded if requested.",
            "nullable": true,
            "example": true
          },
          "creditOrder": {
            "$ref": "#/components/schemas/SplitOrder"
          },
          "refundTarget": {
            "type": "string",
            "description": "Indicator to specify the target of the refund, e.g. 'fsv' for future sale value.",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Model used when refunding a transaction."
      },
      "RefundResponse": {
        "type": "object",
        "properties": {
          "refundTransactionId": {
            "type": "string",
            "description": "Identifier assigned to a successful refund request.",
            "format": "uuid",
            "example": "6fe486cf-3193-40ef-a850-f7659e717c6e"
          }
        },
        "additionalProperties": false,
        "description": "Model returned when refunding a transaction."
      },
      "ReverseRequest": {
        "required": [
          "amount"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "reverseOrder": {
            "$ref": "#/components/schemas/SplitOrder"
          }
        },
        "additionalProperties": false,
        "description": "Model used when Reversing an authorisation."
      },
      "ReverseResponse": {
        "type": "object",
        "properties": {
          "authorisationReversalId": {
            "type": "string",
            "description": "Identifier assigned to a successful reversal request.",
            "format": "uuid",
            "example": "d10e902a-1ffa-4a5f-b585-6ee6b1d42a2c"
          },
          "remainingFloat": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "additionalProperties": false,
        "description": "Model returned when reversing an authorisation."
      },
      "SCAStatus": {
        "enum": [
          "Authenticated",
          "AuthenticationRequired"
        ],
        "type": "string"
      },
      "SettleRequest": {
        "required": [
          "amount"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          },
          "description": {
            "type": "string",
            "description": "An optional description to associate with the settle request.",
            "nullable": true
          },
          "orderReference": {
            "type": "string",
            "description": "Order reference provided by the Merchant.",
            "nullable": true,
            "example": "0000123456"
          },
          "debitOrder": {
            "$ref": "#/components/schemas/SplitOrder"
          }
        },
        "additionalProperties": false,
        "description": "Model used when Settling a transaction."
      },
      "SettleResponse": {
        "type": "object",
        "properties": {
          "transactionId": {
            "type": "string",
            "description": "Identifier assigned to a successful Settle request.",
            "format": "uuid",
            "example": "6fe486cf-3193-40ef-a850-f7659e717c6e"
          }
        },
        "additionalProperties": false,
        "description": "Model returned when settling a transaction."
      },
      "SpendOption": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name of the Spend option.",
            "nullable": true,
            "example": "Promotional Offer A"
          },
          "description": {
            "type": "string",
            "description": "Description of the spend option.",
            "nullable": true,
            "example": "The description of the spend option"
          },
          "offerId": {
            "type": "string",
            "description": "Identifier assigned to the Promotional offer.",
            "format": "uuid",
            "nullable": true,
            "example": "cb097cd5-1ad7-4b90-a656-bdc3a5757fd4"
          },
          "offerCode": {
            "type": "string",
            "description": "A code that uniquely identifies the promotional offer.",
            "nullable": true,
            "example": "offer-code"
          },
          "offerStatus": {
            "$ref": "#/components/schemas/OfferStatus"
          },
          "offerSource": {
            "$ref": "#/components/schemas/OfferSource"
          },
          "spendType": {
            "$ref": "#/components/schemas/SpendType"
          },
          "interestRate": {
            "type": "number",
            "description": "The interest rate of the spend option.",
            "format": "double",
            "nullable": true,
            "example": 0.02
          },
          "spendOptionId": {
            "type": "string",
            "description": "Identifier assigned to the SpendOptions (Interest rate, Term duration and Spend type options as selected by the customer).",
            "format": "uuid",
            "nullable": true,
            "example": "cb097cd5-1ad7-4b90-a656-bdc3a5757fd4"
          },
          "duration": {
            "type": "integer",
            "description": "The duration of the offer.",
            "format": "int32",
            "nullable": true,
            "example": 12
          },
          "illustration": {
            "$ref": "#/components/schemas/Illustration"
          },
          "endDate": {
            "type": "string",
            "description": "The date and time when the promotional offers ends.",
            "format": "date-time",
            "nullable": true,
            "example": "2024-01-01T00:00:00+00:00"
          },
          "settlementPercentage": {
            "type": "number",
            "description": "Subsidy or commission percentage rate to apply to settlements, based the current merchant's active rate card.",
            "format": "double",
            "example": 0.02
          },
          "refundPercentage": {
            "type": "number",
            "description": "Subsidy or commission percentage rate to apply to refunds, based the current merchant's active rate card.",
            "format": "double",
            "nullable": true,
            "example": 0.02
          },
          "chargebackPercentage": {
            "type": "number",
            "description": "Subsidy or commission percentage rate to apply to charge-backs, based the current merchant's active rate card.",
            "format": "double",
            "nullable": true,
            "example": 0.02
          },
          "futureSaleValueAmount": {
            "type": "number",
            "description": "Optional future sale value.\nOnly present in the output if a future sale value amount exists.",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Spend option."
      },
      "SpendOptionOrderType": {
        "enum": [
          "InstalmentPaymentAmount",
          "Term",
          "TotalAmountPayable",
          "InterestRate"
        ],
        "type": "string",
        "description": "Used to sort spend options response"
      },
      "SpendOptionsResponse": {
        "type": "object",
        "properties": {
          "options": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SpendOption"
            },
            "description": "The list of Spend options."
          },
          "upfrontPaymentAmount": {
            "type": "number",
            "description": "Optional upfront payment.\nOnly present in the output if an upfront payment amount exists.",
            "format": "double",
            "nullable": true
          },
          "futureSaleValueAmount": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false,
        "description": "Model used when a list of spend options is returned."
      },
      "SpendType": {
        "enum": [
          "Purchase",
          "Instalment",
          "BNPL"
        ],
        "type": "string",
        "description": "Specifies the spend-type of the spend option."
      },
      "SplitOrder": {
        "enum": [
          "Credit",
          "UpfrontPayment"
        ],
        "type": "string",
        "description": "Possible values: Credit, UpfrontPayment."
      },
      "UnprocessableEntityProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": {}
      },
      "UpwardAdjustmentRequest": {
        "required": [
          "amount"
        ],
        "type": "object",
        "properties": {
          "amount": {
            "$ref": "#/components/schemas/Amount"
          }
        },
        "additionalProperties": false,
        "description": "Model used when requesting an upward adjustment."
      },
      "UpwardAdjustmentResponse": {
        "type": "object",
        "properties": {
          "authorisationId": {
            "type": "string",
            "description": "Identifier assigned to the approved upward adjustment request.",
            "format": "uuid",
            "nullable": true,
            "example": "6fe486cf-3193-40ef-a850-f7659e717c6e"
          },
          "result": {
            "$ref": "#/components/schemas/AuthorisationStatus"
          },
          "declineReason": {
            "type": "string",
            "description": "Declined reason if the request has been declined.",
            "nullable": true,
            "example": "Declined (Please speak to your credit issuer)"
          }
        },
        "additionalProperties": false,
        "description": "Model returned when an upward adjustment is created."
      },
      "ValidationProblemDetails": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "nullable": true
          },
          "title": {
            "type": "string",
            "nullable": true
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "detail": {
            "type": "string",
            "nullable": true
          },
          "instance": {
            "type": "string",
            "nullable": true
          },
          "errors": {
            "type": "object",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        "additionalProperties": {}
      }
    }
  },
  "tags": [
    {
      "name": "Merchant"
    }
  ],
  "x-pub-settings": {
    "pub-ready": true,
    "team": "",
    "tags": [
      "Order Processing",
      "NewPay",
      "Retailers"
    ],
    "commitDate": 1781183539000
  }
}