{
  "openapi": "3.0.4",
  "info": {
    "title": "Worldpay",
    "version": "v1",
    "description": "Storefront endpoints of the OneBasket Worldpay payment provider."
  },
  "paths": {
    "/worldpay/config": {
      "get": {
        "tags": [
          "Config"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "getConfig",
        "summary": "Get Worldpay configuration"
      }
    },
    "/worldpay/payment-intents/{paymentIntentId}": {
      "get": {
        "tags": [
          "PaymentIntents"
        ],
        "parameters": [
          {
            "name": "paymentIntentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "getPaymentIntent",
        "summary": "Get a payment intent"
      }
    },
    "/worldpay/createzeroamountpaymentintent": {
      "post": {
        "tags": [
          "PaymentIntents"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CardSetupRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "createCardSetupIntent",
        "summary": "Create a zero amount payment intent"
      }
    },
    "/worldpay/payment-methods": {
      "get": {
        "tags": [
          "PaymentMethods"
        ],
        "parameters": [
          {
            "name": "paymentMethodIds",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "getPaymentMethods",
        "summary": "Get payment methods"
      }
    },
    "/worldpay/paypal/billing-agreements/setup": {
      "post": {
        "tags": [
          "PayPal"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePayPalBillingAgreementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "createBillingAgreement",
        "summary": "Set up a PayPal billing agreement"
      }
    },
    "/worldpay/paypal/billing-agreements/confirm": {
      "post": {
        "tags": [
          "PayPal"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConfirmPayPalBillingAgreementRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "confirmBillingAgreement",
        "summary": "Confirm a PayPal billing agreement"
      }
    },
    "/worldpay/paypal/billing-agreements/pay": {
      "post": {
        "tags": [
          "PayPal"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PayWithPayPalRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "payWithPayPal",
        "summary": "Pay with a PayPal billing agreement"
      }
    },
    "/worldpay/paypal/billing-agreements": {
      "get": {
        "tags": [
          "PayPal"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "getBillingAgreement",
        "summary": "Get the PayPal billing agreement"
      }
    },
    "/worldpay/payerauthsetup": {
      "post": {
        "tags": [
          "ThreeDs"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetupDeviceCollectionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "setupDeviceCollection",
        "summary": "Set up 3-D Secure device data collection"
      }
    },
    "/worldpay/payerauthenrollment": {
      "post": {
        "tags": [
          "ThreeDs"
        ],
        "parameters": [
          {
            "name": "User-Agent",
            "in": "header",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthenticateRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "authenticate",
        "summary": "Authenticate the payer with 3-D Secure"
      }
    },
    "/worldpay/payerauthchallengereceiver": {
      "post": {
        "tags": [
          "ThreeDs"
        ],
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "transactionId": {
                    "type": "string"
                  }
                }
              },
              "encoding": {
                "transactionId": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "payerAuthCallback",
        "summary": "Receive the 3-D Secure challenge result",
        "description": "Receives the 3-D Secure challenge completion callback from the card issuer's iframe. The browser calls this endpoint directly with a form POST. It returns HTML containing a postMessage script that notifies the parent window."
      }
    },
    "/worldpay/payerauthvalidateresults": {
      "post": {
        "tags": [
          "ThreeDs"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "verify",
        "summary": "Validate the 3-D Secure result"
      }
    },
    "/worldpay/tokens/saved": {
      "get": {
        "tags": [
          "Tokens"
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "getSavedTokens",
        "summary": "Get saved payment tokens"
      }
    },
    "/worldpay/tokens/convert-session": {
      "post": {
        "tags": [
          "Tokens"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ConvertSessionToTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "convertSessionToToken",
        "summary": "Convert a checkout session to a payment token"
      }
    },
    "/worldpay/tokens/use-existing": {
      "post": {
        "tags": [
          "Tokens"
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UseExistingTokenRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "operationId": "useExistingToken",
        "summary": "Pay with a saved payment token"
      }
    }
  },
  "components": {
    "schemas": {
      "AuthenticateRequest": {
        "required": [
          "cvcTransientToken",
          "deviceInfo",
          "paymentIntentId",
          "sessionId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "cvcTransientToken": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "deviceInfo": {
            "$ref": "#/components/schemas/DeviceInfo"
          },
          "sessionId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CardSetupRequest": {
        "required": [
          "billingCity",
          "billingCountryCode",
          "billingFirstName",
          "billingLastName",
          "billingPostalCode",
          "billingStreetLine1",
          "emailAddress",
          "phoneNumber"
        ],
        "type": "object",
        "properties": {
          "billingStreetLine1": {
            "type": "string",
            "nullable": true
          },
          "billingStreetLine2": {
            "type": "string",
            "nullable": true
          },
          "billingStreetLine3": {
            "type": "string",
            "nullable": true
          },
          "billingCity": {
            "type": "string",
            "nullable": true
          },
          "billingRegion": {
            "type": "string",
            "nullable": true
          },
          "billingCountryCode": {
            "type": "string",
            "nullable": true
          },
          "billingPostalCode": {
            "type": "string",
            "nullable": true
          },
          "billingFirstName": {
            "type": "string",
            "nullable": true
          },
          "billingLastName": {
            "type": "string",
            "nullable": true
          },
          "emailAddress": {
            "type": "string",
            "nullable": true
          },
          "phoneNumber": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ConfirmPayPalBillingAgreementRequest": {
        "required": [
          "billingAgreementToken",
          "expressCheckoutToken",
          "paymentIntentId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "billingAgreementToken": {
            "type": "string",
            "nullable": true
          },
          "expressCheckoutToken": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "ConvertSessionToTokenRequest": {
        "required": [
          "cardHolderName",
          "paymentIntentId",
          "sessionHref"
        ],
        "type": "object",
        "properties": {
          "sessionHref": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "cardHolderName": {
            "type": "string",
            "nullable": true
          },
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "CreatePayPalBillingAgreementRequest": {
        "required": [
          "paymentIntentId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "returnUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          },
          "cancelUrl": {
            "type": "string",
            "format": "uri",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DeviceInfo": {
        "type": "object",
        "properties": {
          "httpBrowserColorDepth": {
            "type": "string",
            "nullable": true
          },
          "httpBrowserJavaScriptEnabled": {
            "type": "boolean",
            "nullable": true
          },
          "httpBrowserLanguage": {
            "type": "string",
            "nullable": true
          },
          "httpBrowserScreenHeight": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "httpBrowserScreenWidth": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "httpBrowserTimeDifference": {
            "type": "string",
            "nullable": true
          },
          "requestedChallengeWindowSize": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "PayWithPayPalRequest": {
        "required": [
          "paymentIntentId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "SetupDeviceCollectionRequest": {
        "required": [
          "cvcTransientToken",
          "paymentIntentId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "cvcTransientToken": {
            "type": "string",
            "format": "uri",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateCardHolderNameByPaymentMethodRequest": {
        "required": [
          "cardHolderName",
          "paymentMethodId"
        ],
        "type": "object",
        "properties": {
          "paymentMethodId": {
            "type": "string",
            "nullable": true
          },
          "cardHolderName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateCardHolderNameByTokenIdRequest": {
        "required": [
          "cardHolderName",
          "tokenId"
        ],
        "type": "object",
        "properties": {
          "tokenId": {
            "type": "string",
            "nullable": true
          },
          "cardHolderName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UpdateCardOnFileNameRequest": {
        "required": [
          "cardHolderName",
          "paymentIntentId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "cardHolderName": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "UseExistingTokenRequest": {
        "required": [
          "paymentIntentId",
          "tokenId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "tokenId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "VerifyRequest": {
        "required": [
          "cvcTransientToken",
          "paymentIntentId"
        ],
        "type": "object",
        "properties": {
          "paymentIntentId": {
            "type": "string",
            "nullable": true
          },
          "cvcTransientToken": {
            "type": "string",
            "format": "uri",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "apiKey": {
        "type": "apiKey",
        "description": "Base64-encoded store identifier",
        "name": "x-api-key",
        "in": "header"
      },
      "bearerAuth": {
        "type": "http",
        "description": "JWT containing the contact identifier in the 'sub' claim",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      }
    }
  },
  "security": [
    {
      "apiKey": [],
      "bearerAuth": []
    }
  ],
  "servers": [
    {
      "url": "{baseUrl}",
      "description": "Your Storefront API host",
      "variables": {
        "baseUrl": {
          "default": "https://your-storefront-api-host",
          "description": "The Storefront API base URL for your store. Your Stadion technical contact provides it."
        }
      }
    }
  ]
}