{
  "openapi": "3.1.0",
  "info": {
    "title": "Dime Partner API v1",
    "version": "",
    "description": ":::warning Deprecation planned\n\n**v1 will be deprecated.** It remains fully supported for now, but all new\nintegrations should use [the v2 API](../v2/dime-v2.yaml), and existing\nintegrations should plan to migrate.\n\n:::\n\nThe original Dime partner API.\n\nv2 takes plain JSON instead of a signed payload, returns resources without\na wrapper, and reports every failure in one consistent error shape. See\n**Moving from v1** on the API reference home page for the differences.\n\n## Authentication\n\nTwo credentials work together:\n\n- Your **client key** goes in the `client_key` header and identifies you.\n- Your **secret key** signs the request parameters.\n\nSign the parameters as a JWT and send them as `data`:\n\n```json\n{\n  \"lang\": \"en\",\n  \"data\": \"<JWT signed with your secret key>\"\n}\n```\n\nTwo endpoints are exceptions and take plain JSON: `/donate-orders` and\n`/card-request/open-verify`.\n\n## Responses\n\nEvery response is wrapped:\n\n```json\n{\n  \"statusCode\": 200,\n  \"headers\": { \"Access-Control-Allow-Origin\": \"*\" },\n  \"body\": {\n    \"message\": \"Successful created api order request\",\n    \"response\": { \"order_url\": \"https://pay.dimepay.app/e-order/...\" }\n  }\n}\n```\n\n`statusCode` repeats the HTTP status. The payload is under `body.response`.\n\n## Errors\n\nA validation failure returns `body.message` as an **array** listing every\nrule that failed, not just the first.\n\nA bad or missing signature returns **500**, not 401. This is documented as\nthe API behaves today.\n",
    "contact": {
      "name": "Dime Payment Services",
      "url": "https://dimepay.net"
    }
  },
  "servers": [
    {
      "url": "https://sandbox.api.dimepay.app/dapi/v1",
      "description": "Sandbox — safe for testing, no real money moves. Every production\naccount can enable sandbox mode, so this is the only host these docs\ntarget. Swap the host for production once your integration is ready.\n"
    }
  ],
  "security": [
    {
      "ClientKey": []
    }
  ],
  "tags": [
    {
      "name": "Orders",
      "description": "Take a payment through a hosted checkout page."
    },
    {
      "name": "Card Requests",
      "description": "Capture and store a customer's card."
    },
    {
      "name": "Payments",
      "description": "Charge a stored card, then capture, void, or refund."
    },
    {
      "name": "Invoices",
      "description": "Bill a customer."
    },
    {
      "name": "Payment Links",
      "description": "Shareable URLs that collect a payment."
    },
    {
      "name": "Subscriptions",
      "description": "Manage recurring billing."
    }
  ],
  "paths": {
    "/orders": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Create an order",
        "operationId": "createApiOrder",
        "description": "Returns `order_url`, the hosted page where the customer pays.\n\nSign the parameters below with your secret key and send the result as\n`data`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              },
              "examples": {
                "signed": {
                  "summary": "The request as sent",
                  "value": {
                    "lang": "en",
                    "data": "eyJhbGciOiJIUzI1NiJ9.eyJpZCI6Ii4uLiJ9.signature"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The order was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "examples": {
                  "created": {
                    "summary": "Captured from a live sandbox response",
                    "value": {
                      "statusCode": 200,
                      "headers": {
                        "Access-Control-Allow-Origin": "*"
                      },
                      "body": {
                        "message": "Successful created api order request",
                        "response": {
                          "order_url": "https://pay.dimepay.app/e-order/oB7ydv_jQWus44bV"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/orders/{token}": {
      "get": {
        "tags": [
          "Orders"
        ],
        "summary": "Retrieve an order",
        "operationId": "getApiOrder",
        "description": "Reads an order.\n\nThe path segment is **not** the plain token: sign the token string with\nyour secret key and put the resulting JWT in the path. An unsigned\ntoken fails with `jwt malformed`.\n",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "required": true,
            "description": "The order's token, signed as a JWT with your secret key.",
            "schema": {
              "type": "string"
            },
            "example": "eyJhbGciOiJIUzI1NiJ9.b2p1Q2NWN3ZlVTlIWjBWZA.signature"
          }
        ],
        "responses": {
          "200": {
            "description": "The order.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "examples": {
                  "found": {
                    "summary": "Captured from a live sandbox response",
                    "value": {
                      "statusCode": 200,
                      "headers": {
                        "Access-Control-Allow-Origin": "*"
                      },
                      "body": {
                        "message": "Successful created api order request",
                        "response": {
                          "order": {
                            "id": "379cce2e-6243-4233-a892-f2733726a011",
                            "token": "ojuCcV7veU9HZ0Vd"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "The token was not a valid signed payload, or no such order exists.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "examples": {
                  "malformed": {
                    "summary": "An unsigned token was sent",
                    "value": {
                      "statusCode": 500,
                      "headers": {
                        "Access-Control-Allow-Origin": "*"
                      },
                      "body": {
                        "message": "JsonWebTokenError: jwt malformed"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/donate-orders": {
      "post": {
        "tags": [
          "Orders"
        ],
        "summary": "Create a donation order",
        "operationId": "createDonationOrder",
        "description": "A donation-flavoured order. Unlike `/orders`, this route takes the\nparameters as plain JSON — it carries no signature check.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateOrderParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The donation order was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/card-request": {
      "post": {
        "tags": [
          "Card Requests"
        ],
        "summary": "Open a card request",
        "operationId": "createApiCard",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data`.",
          "properties": {
            "webhookUrl": {
              "type": "string",
              "format": "uri",
              "description": "Where to POST the result.",
              "example": "https://example.com"
            },
            "callbackUrl": {
              "type": "string",
              "format": "uri",
              "example": "https://example.com"
            },
            "redirectUrl": {
              "type": "string",
              "format": "uri",
              "example": "https://example.com"
            },
            "currency": {
              "$ref": "_shared.yaml#/components/schemas/Currency"
            },
            "id": {
              "type": "string",
              "description": "Your own reference for this request.",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            }
          }
        },
        "description": "Returns `card_url`, the hosted page for card entry.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "The card request was opened.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "examples": {
                  "created": {
                    "summary": "Captured from a live sandbox response",
                    "value": {
                      "statusCode": 201,
                      "headers": {
                        "Access-Control-Allow-Origin": "*"
                      },
                      "body": {
                        "message": "Successfully created api card request",
                        "response": {
                          "card_url": "https://pay.dimepay.app/e-card/mQWTngFTEsif77u/cr_URQhkAkLE-IgX",
                          "token": "cr_URQhkAkLE-IgX",
                          "status": "STARTED",
                          "currency": "USD",
                          "verification_attempts": 0,
                          "last_four_digits": null,
                          "card_scheme": null,
                          "card_expiry": null,
                          "expired": false,
                          "metadata": {
                            "type": "API",
                            "key_id": "c92c7114-a234-4240-8216-5ff31c25d630",
                            "webhook_url": "https://example.com/hooks"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/card-request/verify": {
      "put": {
        "tags": [
          "Card Requests"
        ],
        "summary": "Verify a card request",
        "operationId": "verifyCard",
        "description": "Confirms the customer controls the card by matching the amount charged\nto it. Signed, so only the merchant can call it.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/card-request/open-verify": {
      "put": {
        "tags": [
          "Card Requests"
        ],
        "summary": "Verify a card request without a signature",
        "operationId": "openVerifyCard",
        "security": [],
        "description": "The same verification as `/card-request/verify`, but it carries no\nsignature check — it exists for the hosted page, which holds no secret\nkey.\n\nParameters are sent as plain JSON rather than inside `data`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/VerifyParams"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/card-request/{token}": {
      "get": {
        "tags": [
          "Card Requests"
        ],
        "summary": "Retrieve a card request",
        "operationId": "getApiCardRequest",
        "description": "Reads the request's state. Never returns the card itself.",
        "parameters": [
          {
            "$ref": "#/components/parameters/CardRequestToken"
          },
          {
            "name": "merchant_id",
            "in": "query",
            "required": true,
            "description": "Your merchant token.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The card request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "500": {
            "description": "The signature failed, or no such card request exists. A missing\nrecord returns 500 rather than 404 — documented as it behaves.\n",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                },
                "examples": {
                  "notFound": {
                    "value": {
                      "statusCode": 500,
                      "headers": {
                        "Access-Control-Allow-Origin": "*"
                      },
                      "body": {
                        "message": "Card request not found",
                        "response": {
                          "type": "String",
                          "message": "Card request not found"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "Card Requests"
        ],
        "summary": "Save a captured card",
        "operationId": "saveApiCard",
        "security": [],
        "description": "Called by the hosted page once the customer submits their card. Carries\nno signature check, since the page holds no secret key.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CardRequestToken"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The card was saved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          }
        }
      }
    },
    "/cards/{token}": {
      "get": {
        "tags": [
          "Card Requests"
        ],
        "summary": "Retrieve the stored card",
        "operationId": "getApiCard",
        "description": "Returns the card token to use when taking payments. Fails until the\nrequest has been verified.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/CardRequestToken"
          }
        ],
        "responses": {
          "200": {
            "description": "The stored card.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "description": "The card request has not been verified.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payments/sale": {
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Charge a card",
        "operationId": "paymentSale",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data` for a sale or auth.",
          "required": [
            "token",
            "id",
            "currency",
            "subtotal",
            "total",
            "tax",
            "email",
            "ipAddress"
          ],
          "properties": {
            "token": {
              "type": "string",
              "description": "A card token from a verified card request.",
              "example": "ob9gWGGx5ACvn6KU"
            },
            "id": {
              "type": "string",
              "maxLength": 100,
              "description": "Your identifier for the order being paid.",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "currency": {
              "$ref": "_shared.yaml#/components/schemas/Currency"
            },
            "settlement_country": {
              "type": "string",
              "maxLength": 100,
              "description": "Country the payment settles in, as an ISO 3166-1 alpha-2 or alpha-3 code\nor the English country name. Selects the merchant's processing\nconfiguration for the currency in that country; defaults to the\nmerchant's own country.\n",
              "example": "TT"
            },
            "subtotal": {
              "type": "number",
              "minimum": 0,
              "example": 1000
            },
            "total": {
              "type": "number",
              "minimum": 0,
              "example": 1100
            },
            "tax": {
              "type": "number",
              "minimum": 0,
              "example": 100
            },
            "email": {
              "type": "string",
              "format": "email",
              "example": "buyer@example.com"
            },
            "ipAddress": {
              "type": "string",
              "description": "The buyer's IP, required by the processor for risk scoring.",
              "example": "198.51.100.10"
            },
            "referenceTransactionId": {
              "type": "string",
              "example": "order-1024"
            },
            "orderComments": {
              "type": "string",
              "example": "Leave at the door."
            }
          }
        },
        "description": "Authorizes and captures in one step.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaymentResult"
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payments/auth": {
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Authorize a card",
        "operationId": "paymentAuthentication",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data` for a sale or auth.",
          "required": [
            "token",
            "id",
            "currency",
            "subtotal",
            "total",
            "tax",
            "email",
            "ipAddress"
          ],
          "properties": {
            "token": {
              "type": "string",
              "description": "A card token from a verified card request.",
              "example": "ob9gWGGx5ACvn6KU"
            },
            "id": {
              "type": "string",
              "maxLength": 100,
              "description": "Your identifier for the order being paid.",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "currency": {
              "$ref": "_shared.yaml#/components/schemas/Currency"
            },
            "settlement_country": {
              "type": "string",
              "maxLength": 100,
              "description": "Country the payment settles in, as an ISO 3166-1 alpha-2 or alpha-3 code\nor the English country name. Selects the merchant's processing\nconfiguration for the currency in that country; defaults to the\nmerchant's own country.\n",
              "example": "TT"
            },
            "subtotal": {
              "type": "number",
              "minimum": 0,
              "example": 1000
            },
            "total": {
              "type": "number",
              "minimum": 0,
              "example": 1100
            },
            "tax": {
              "type": "number",
              "minimum": 0,
              "example": 100
            },
            "email": {
              "type": "string",
              "format": "email",
              "example": "buyer@example.com"
            },
            "ipAddress": {
              "type": "string",
              "description": "The buyer's IP, required by the processor for risk scoring.",
              "example": "198.51.100.10"
            },
            "referenceTransactionId": {
              "type": "string",
              "example": "order-1024"
            },
            "orderComments": {
              "type": "string",
              "example": "Leave at the door."
            }
          }
        },
        "description": "Holds the funds without taking them.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaymentResult"
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payments/capture": {
      "put": {
        "tags": [
          "Payments"
        ],
        "summary": "Capture an authorization",
        "operationId": "paymentCapture",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data` for capture, void, or refund.",
          "required": [
            "transaction_id"
          ],
          "properties": {
            "transaction_id": {
              "type": "string",
              "format": "uuid",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "amount": {
              "type": "number",
              "exclusiveMinimum": 0,
              "description": "Omit to act on the full amount.",
              "example": 1100
            },
            "skip_processor": {
              "type": "boolean",
              "description": "Record the action without calling the processor.",
              "example": true
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaymentResult"
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payments/void": {
      "put": {
        "tags": [
          "Payments"
        ],
        "summary": "Void a transaction",
        "operationId": "paymentVoid",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data` for capture, void, or refund.",
          "required": [
            "transaction_id"
          ],
          "properties": {
            "transaction_id": {
              "type": "string",
              "format": "uuid",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "amount": {
              "type": "number",
              "exclusiveMinimum": 0,
              "description": "Omit to act on the full amount.",
              "example": 1100
            },
            "skip_processor": {
              "type": "boolean",
              "description": "Record the action without calling the processor.",
              "example": true
            }
          }
        },
        "description": "Releases a hold before settlement. Use refund afterwards.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaymentResult"
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payments/refund": {
      "put": {
        "tags": [
          "Payments"
        ],
        "summary": "Refund a transaction",
        "operationId": "paymentRefund",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data` for capture, void, or refund.",
          "required": [
            "transaction_id"
          ],
          "properties": {
            "transaction_id": {
              "type": "string",
              "format": "uuid",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "amount": {
              "type": "number",
              "exclusiveMinimum": 0,
              "description": "Omit to act on the full amount.",
              "example": 1100
            },
            "skip_processor": {
              "type": "boolean",
              "description": "Record the action without calling the processor.",
              "example": true
            }
          }
        },
        "description": "Omit `amount` inside `data` for a full refund.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "$ref": "#/components/responses/PaymentResult"
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payments/hosted-page": {
      "post": {
        "tags": [
          "Payments"
        ],
        "summary": "Create a hosted checkout",
        "operationId": "createHostedPage",
        "description": "An alias of `POST /orders`, behind the same handler. Returns an order\nwith an `order_url`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The order was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/invoices": {
      "post": {
        "tags": [
          "Invoices"
        ],
        "summary": "Create an invoice",
        "operationId": "createApiInvoice",
        "x-signed-payload-schema": {
          "type": "object",
          "description": "The parameters to sign into `data`.",
          "required": [
            "customer_id",
            "currency",
            "invoice_date",
            "due_date",
            "status",
            "products"
          ],
          "properties": {
            "customer_id": {
              "type": "string",
              "format": "uuid",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "currency": {
              "$ref": "_shared.yaml#/components/schemas/Currency"
            },
            "invoice_date": {
              "type": "string",
              "format": "date-time",
              "example": "2026-08-26T00:48:52.252Z"
            },
            "due_date": {
              "type": "string",
              "format": "date-time",
              "example": "2026-08-26T00:48:52.252Z"
            },
            "status": {
              "type": "string",
              "enum": [
                "PAID",
                "UNPAID",
                "OVERDUE",
                "CANCELLED"
              ],
              "example": "PAID"
            },
            "products": {
              "type": "array",
              "minItems": 1,
              "items": {
                "type": "object",
                "properties": {
                  "product_id": {
                    "type": "string",
                    "format": "uuid",
                    "description": "A product in your own catalog.",
                    "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
                  },
                  "name": {
                    "type": "string",
                    "description": "For a custom line item.",
                    "example": "Sample Item"
                  },
                  "price": {
                    "type": "number",
                    "example": 1100
                  },
                  "currency": {
                    "$ref": "_shared.yaml#/components/schemas/Currency"
                  },
                  "quantity": {
                    "type": "integer",
                    "minimum": 1,
                    "example": 1
                  }
                }
              }
            }
          }
        },
        "description": "The customer must already exist under your merchant, and any product\nreferenced must be in your own catalog.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The invoice was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "404": {
            "description": "The customer or a referenced product does not exist for you.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/payment-links": {
      "post": {
        "tags": [
          "Payment Links"
        ],
        "summary": "Create a payment link",
        "operationId": "createApiPaymentLink",
        "x-signed-payload-schema": {
          "type": "object",
          "required": [
            "name",
            "type",
            "currency"
          ],
          "properties": {
            "name": {
              "type": "string",
              "example": "Sample Item"
            },
            "type": {
              "type": "string",
              "enum": [
                "OPEN",
                "STATIC",
                "PRODUCT"
              ],
              "example": "OPEN"
            },
            "currency": {
              "$ref": "_shared.yaml#/components/schemas/Currency"
            },
            "open_total": {
              "type": "boolean",
              "example": true
            },
            "total": {
              "type": "number",
              "example": 1100
            },
            "subtotal": {
              "type": "number",
              "example": 1000
            }
          }
        },
        "description": "A link is `OPEN` (the payer names the amount), `STATIC` (a fixed\namount), or `PRODUCT` (priced from your catalog).\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The link was created.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/subscriptions/cancel": {
      "put": {
        "tags": [
          "Subscriptions"
        ],
        "summary": "Change a subscription's status",
        "operationId": "changeSubscriptionStatus",
        "x-signed-payload-schema": {
          "type": "object",
          "required": [
            "id",
            "status"
          ],
          "properties": {
            "id": {
              "type": "string",
              "format": "uuid",
              "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
            },
            "status": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "PAUSED",
                "CANCELLED"
              ],
              "example": "ACTIVE"
            }
          }
        },
        "description": "Cancel a subscription, or pause and resume it.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The subscription was updated.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    },
    "/subscriptions/dime-billing": {
      "post": {
        "tags": [
          "Subscriptions"
        ],
        "summary": "Bill a subscription invoice",
        "operationId": "processDimeBilling",
        "description": "Charges the stored card against an outstanding invoice.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignedRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The billing result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Envelope"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/ValidationFailed"
          },
          "500": {
            "$ref": "#/components/responses/PayloadRejected"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ClientKey": {
        "type": "apiKey",
        "in": "header",
        "name": "client_key",
        "description": "Identifies the merchant. Pair it with a `data` field in the body,\nsigned with the matching secret key.\n"
      }
    },
    "schemas": {
      "SignedRequest": {
        "type": "object",
        "description": "Every write endpoint takes this shape. The real parameters live inside\n`data` as a JWT signed with your secret key.\n",
        "required": [
          "data"
        ],
        "properties": {
          "data": {
            "type": "string",
            "description": "A JWT signed with your secret key, holding the parameters.",
            "example": "example"
          },
          "lang": {
            "type": "string",
            "default": "en",
            "example": "example"
          }
        }
      },
      "Envelope": {
        "type": "object",
        "description": "Every v1 response carries this wrapper. The payload is under `body`,\nand `statusCode` repeats the HTTP status.\n",
        "required": [
          "statusCode",
          "body"
        ],
        "properties": {
          "statusCode": {
            "type": "integer",
            "description": "Repeats the HTTP status code.",
            "example": 200
          },
          "headers": {
            "type": "object",
            "additionalProperties": true
          },
          "body": {
            "type": "object",
            "properties": {
              "message": {
                "oneOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  }
                ],
                "description": "A string on success. On a validation failure, an array holding\nevery rule that failed.\n"
              },
              "response": {
                "description": "The payload, when the endpoint returns one."
              }
            }
          }
        }
      },
      "Currency": {
        "type": "string",
        "enum": [
          "USD",
          "JMD",
          "GBP",
          "EUR",
          "TTD",
          "BBD",
          "XCD",
          "GYD",
          "SRD"
        ],
        "example": "JMD"
      },
      "LineItem": {
        "type": "object",
        "required": [
          "name",
          "price",
          "quantity"
        ],
        "properties": {
          "id": {
            "type": "string",
            "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
          },
          "name": {
            "type": "string",
            "example": "Sample Item"
          },
          "price": {
            "type": "number",
            "example": 1100
          },
          "quantity": {
            "type": "integer",
            "minimum": 1,
            "example": 1
          },
          "sku": {
            "type": "string",
            "example": "SAMPLE"
          }
        }
      },
      "BillingPerson": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "Sample Item"
          },
          "email": {
            "type": "string",
            "format": "email",
            "example": "buyer@example.com"
          },
          "phone": {
            "type": "string",
            "example": "example"
          },
          "street": {
            "type": "string",
            "example": "example"
          },
          "city": {
            "type": "string",
            "example": "example"
          },
          "stateOrProvinceName": {
            "type": "string",
            "example": "Sample Item"
          },
          "stateOrProvinceCode": {
            "type": "string",
            "example": "parameter_missing"
          },
          "postalCode": {
            "type": "string",
            "example": "parameter_missing"
          },
          "countryCode": {
            "type": "string",
            "example": "JM"
          },
          "countryName": {
            "type": "string",
            "example": "Jamaica"
          }
        }
      },
      "CreateOrderParams": {
        "type": "object",
        "description": "The parameters to sign into `data`. On `/donate-orders` they are sent\nas the body directly.\n",
        "required": [
          "id",
          "currency",
          "subtotal",
          "total",
          "tax",
          "email",
          "fulfilled"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "maxLength": 100,
            "description": "Your own identifier for the order.",
            "example": "3f8a1e02-9c4d-4b71-a5e3-6d2f0b8c7a19"
          },
          "currency": {
            "$ref": "#/components/schemas/Currency"
          },
          "settlement_country": {
            "type": "string",
            "maxLength": 100,
            "description": "Country the order settles in, as an ISO 3166-1 alpha-2 or alpha-3 code\nor the English country name. Selects the merchant's processing\nconfiguration for the currency in that country; defaults to the\nmerchant's own country.\n",
            "example": "TT"
          },
          "subtotal": {
            "type": "number",
            "minimum": 0,
            "example": 1000
          },
          "total": {
            "type": "number",
            "minimum": 0,
            "example": 1100
          },
          "tax": {
            "type": "number",
            "minimum": 0,
            "example": 100
          },
          "email": {
            "type": "string",
            "format": "email",
            "example": "buyer@example.com"
          },
          "fulfilled": {
            "type": "boolean",
            "description": "Whether the goods have already been delivered.",
            "example": true
          },
          "ipAddress": {
            "type": "string",
            "description": "The buyer's IP address.",
            "example": "198.51.100.10"
          },
          "referenceTransactionId": {
            "type": "string",
            "example": "order-1024"
          },
          "description": {
            "type": "string",
            "example": "A short description."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LineItem"
            }
          },
          "billingPerson": {
            "$ref": "#/components/schemas/BillingPerson"
          },
          "is_subscription": {
            "type": "boolean",
            "example": true
          },
          "tokenize": {
            "type": "boolean",
            "example": true
          },
          "subscription_instructions": {
            "type": "object",
            "properties": {
              "recurring_frequency": {
                "type": "string",
                "enum": [
                  "WEEKLY",
                  "MONTHLY",
                  "YEARLY"
                ],
                "example": "WEEKLY"
              },
              "billing_cycles": {
                "type": "integer",
                "minimum": 1,
                "example": 12
              }
            }
          }
        }
      },
      "VerifyParams": {
        "type": "object",
        "required": [
          "token",
          "value"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "The card request token.",
            "example": "ob9gWGGx5ACvn6KU"
          },
          "value": {
            "type": "number",
            "minimum": 0,
            "description": "The amount the customer saw on their statement.",
            "example": 1.23
          }
        }
      }
    },
    "responses": {
      "ValidationFailed": {
        "description": "One or more parameters were rejected. `body.message` is an array\nlisting every failure, not just the first.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Envelope"
            },
            "examples": {
              "missingFields": {
                "summary": "Captured from a live sandbox response",
                "value": {
                  "statusCode": 400,
                  "headers": {
                    "Access-Control-Allow-Origin": "*"
                  },
                  "body": {
                    "message": [
                      "Order ID is required",
                      "Order ID must be a UUID",
                      "Subtotal is required",
                      "Total is required",
                      "Email is required"
                    ]
                  }
                }
              }
            }
          }
        }
      },
      "PayloadRejected": {
        "description": "The signature could not be verified, or the key was missing.\n\nNote this returns **500**, not 401. The behaviour is documented as it\nis, rather than as it ought to be.\n",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Envelope"
            },
            "examples": {
              "badPayload": {
                "summary": "Captured from a live sandbox response",
                "value": {
                  "statusCode": 500,
                  "headers": {
                    "Access-Control-Allow-Origin": "*"
                  },
                  "body": {
                    "message": "Error verifying api payload",
                    "response": {
                      "type": "String",
                      "message": "Error verifying api payload"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "PaymentResult": {
        "description": "The resulting transaction, inside the v1 envelope.",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Envelope"
            }
          }
        }
      }
    },
    "parameters": {
      "CardRequestToken": {
        "name": "token",
        "in": "path",
        "required": true,
        "description": "The card request token.",
        "schema": {
          "type": "string"
        },
        "example": "cr_URQhkAkLE-IgX"
      }
    }
  }
}