{
    "openapi": "3.1.0",
    "info": {
        "title": "Paywio API",
        "version": "v1",
        "description": "Sell digital products as a Merchant of Record. All amounts are integer cents in USD, all times are unix seconds. Authenticate with `Authorization: Bearer sk_test_\u2026` (test mode) or `sk_live_\u2026` (live mode). POST requests accept an `Idempotency-Key` header (24 hours). Prices are never sent by you: a checkout always charges the price of the variant you choose."
    },
    "servers": [
        {
            "url": "https://api.paywio.com/v1"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "Products"
        },
        {
            "name": "Checkouts"
        },
        {
            "name": "Orders"
        },
        {
            "name": "Customers"
        },
        {
            "name": "Subscriptions"
        },
        {
            "name": "License keys"
        },
        {
            "name": "Coupons"
        },
        {
            "name": "Webhook endpoints"
        }
    ],
    "paths": {
        "/products": {
            "get": {
                "tags": [
                    "Products"
                ],
                "summary": "List products with their variants",
                "operationId": "getProducts",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/limit"
                    },
                    {
                        "$ref": "#/components/parameters/starting_after"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "object",
                                        "data",
                                        "has_more"
                                    ],
                                    "properties": {
                                        "object": {
                                            "const": "list"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Product"
                                            }
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/products/{id}": {
            "get": {
                "tags": [
                    "Products"
                ],
                "summary": "Retrieve a product",
                "operationId": "getProductsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Product"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/checkouts": {
            "post": {
                "tags": [
                    "Checkouts"
                ],
                "summary": "Create a checkout",
                "operationId": "postCheckouts",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/idempotency_key"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Checkout"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "description": "Returns a hosted payment page url that lasts 24 hours. No amount is ever accepted; unknown fields are rejected. An unusable coupon returns 422 with code `coupon_<reason>`.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CheckoutCreate"
                            }
                        }
                    }
                }
            }
        },
        "/checkouts/{id}": {
            "get": {
                "tags": [
                    "Checkouts"
                ],
                "summary": "Retrieve a checkout",
                "operationId": "getCheckoutsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Checkout"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/orders": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "List orders",
                "operationId": "getOrders",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "paid",
                                "refunded",
                                "partially_refunded",
                                "disputed",
                                "dispute_lost",
                                "dispute_won"
                            ]
                        },
                        "description": "Order status."
                    },
                    {
                        "name": "customer_email",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Exact customer email."
                    },
                    {
                        "name": "created[gte]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Created at or after (unix seconds)."
                    },
                    {
                        "name": "created[lte]",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        },
                        "description": "Created at or before (unix seconds)."
                    },
                    {
                        "$ref": "#/components/parameters/limit"
                    },
                    {
                        "$ref": "#/components/parameters/starting_after"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "object",
                                        "data",
                                        "has_more"
                                    ],
                                    "properties": {
                                        "object": {
                                            "const": "list"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Order"
                                            }
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/orders/{id}": {
            "get": {
                "tags": [
                    "Orders"
                ],
                "summary": "Retrieve an order",
                "operationId": "getOrdersId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Order"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/orders/{id}/refund": {
            "post": {
                "tags": [
                    "Orders"
                ],
                "summary": "Refund an order",
                "operationId": "postOrdersIdRefund",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/idempotency_key"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Refund"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "description": "The refund is requested from Stripe; the order status and your balance change when Stripe confirms (an `order.refunded` webhook follows).",
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "additionalProperties": false,
                                "properties": {
                                    "amount": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "description": "Cents to refund. Omit to refund everything that is left."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/customers": {
            "get": {
                "tags": [
                    "Customers"
                ],
                "summary": "List customers",
                "operationId": "getCustomers",
                "parameters": [
                    {
                        "name": "email",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Exact email."
                    },
                    {
                        "$ref": "#/components/parameters/limit"
                    },
                    {
                        "$ref": "#/components/parameters/starting_after"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "object",
                                        "data",
                                        "has_more"
                                    ],
                                    "properties": {
                                        "object": {
                                            "const": "list"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Customer"
                                            }
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/customers/{id}": {
            "get": {
                "tags": [
                    "Customers"
                ],
                "summary": "Retrieve a customer",
                "operationId": "getCustomersId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Customer"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/subscriptions": {
            "get": {
                "tags": [
                    "Subscriptions"
                ],
                "summary": "List subscriptions",
                "operationId": "getSubscriptions",
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "schema": {
                            "type": "string",
                            "enum": [
                                "active",
                                "past_due",
                                "canceled",
                                "unpaid",
                                "incomplete"
                            ]
                        },
                        "description": "Subscription status."
                    },
                    {
                        "name": "customer_email",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Exact customer email."
                    },
                    {
                        "$ref": "#/components/parameters/limit"
                    },
                    {
                        "$ref": "#/components/parameters/starting_after"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "object",
                                        "data",
                                        "has_more"
                                    ],
                                    "properties": {
                                        "object": {
                                            "const": "list"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Subscription"
                                            }
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/subscriptions/{id}": {
            "get": {
                "tags": [
                    "Subscriptions"
                ],
                "summary": "Retrieve a subscription",
                "operationId": "getSubscriptionsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Subscription"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/subscriptions/{id}/cancel": {
            "post": {
                "tags": [
                    "Subscriptions"
                ],
                "summary": "Cancel a subscription",
                "operationId": "postSubscriptionsIdCancel",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/idempotency_key"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Subscription"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "additionalProperties": true,
                                "properties": {
                                    "at_period_end": {
                                        "type": "boolean",
                                        "default": true,
                                        "description": "true: end at the close of the paid period. false: end now and revoke any license."
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/license-keys": {
            "get": {
                "tags": [
                    "License keys"
                ],
                "summary": "List the license keys of an order",
                "operationId": "getLicenseKeys",
                "parameters": [
                    {
                        "name": "order_id",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Order id (`ord_\u2026`).",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/LicenseKey"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "description": "For a subscription renewal order the keys of the subscription are returned."
            }
        },
        "/coupons": {
            "get": {
                "tags": [
                    "Coupons"
                ],
                "summary": "List coupons",
                "operationId": "getCoupons",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/limit"
                    },
                    {
                        "$ref": "#/components/parameters/starting_after"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "object",
                                        "data",
                                        "has_more"
                                    ],
                                    "properties": {
                                        "object": {
                                            "const": "list"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/Coupon"
                                            }
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Coupons"
                ],
                "summary": "Create a coupon",
                "operationId": "postCoupons",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/idempotency_key"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Coupon"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "description": "Type and value cannot be changed later. A subscription coupon discounts the first payment only.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/CouponCreate"
                            }
                        }
                    }
                }
            }
        },
        "/coupons/{id}": {
            "get": {
                "tags": [
                    "Coupons"
                ],
                "summary": "Retrieve a coupon",
                "operationId": "getCouponsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Coupon"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "delete": {
                "tags": [
                    "Coupons"
                ],
                "summary": "Delete a coupon",
                "operationId": "deleteCouponsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Deleted"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/webhook-endpoints": {
            "get": {
                "tags": [
                    "Webhook endpoints"
                ],
                "summary": "List webhook endpoints of the key's mode",
                "operationId": "getWebhookEndpoints",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/limit"
                    },
                    {
                        "$ref": "#/components/parameters/starting_after"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object",
                                    "required": [
                                        "object",
                                        "data",
                                        "has_more"
                                    ],
                                    "properties": {
                                        "object": {
                                            "const": "list"
                                        },
                                        "data": {
                                            "type": "array",
                                            "items": {
                                                "$ref": "#/components/schemas/WebhookEndpoint"
                                            }
                                        },
                                        "has_more": {
                                            "type": "boolean"
                                        }
                                    }
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "post": {
                "tags": [
                    "Webhook endpoints"
                ],
                "summary": "Create a webhook endpoint",
                "operationId": "postWebhookEndpoints",
                "parameters": [
                    {
                        "$ref": "#/components/parameters/idempotency_key"
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpointWithSecret"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "description": "The mode of the endpoint is the mode of the key. The signing `secret` is returned only here.",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEndpointCreate"
                            }
                        }
                    }
                }
            }
        },
        "/webhook-endpoints/{id}": {
            "get": {
                "tags": [
                    "Webhook endpoints"
                ],
                "summary": "Retrieve a webhook endpoint",
                "operationId": "getWebhookEndpointsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            },
            "patch": {
                "tags": [
                    "Webhook endpoints"
                ],
                "summary": "Update a webhook endpoint",
                "operationId": "patchWebhookEndpointsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/WebhookEndpoint"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/WebhookEndpointUpdate"
                            }
                        }
                    }
                }
            },
            "delete": {
                "tags": [
                    "Webhook endpoints"
                ],
                "summary": "Delete a webhook endpoint",
                "operationId": "deleteWebhookEndpointsId",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Success",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Deleted"
                                }
                            }
                        }
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        },
        "/webhook-endpoints/{id}/test": {
            "post": {
                "tags": [
                    "Webhook endpoints"
                ],
                "summary": "Send a test event",
                "operationId": "postWebhookEndpointsIdTest",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "$ref": "#/components/parameters/idempotency_key"
                    }
                ],
                "responses": {
                    "202": {
                        "description": "Success"
                    },
                    "401": {
                        "$ref": "#/components/responses/Error"
                    },
                    "404": {
                        "$ref": "#/components/responses/Error"
                    },
                    "422": {
                        "$ref": "#/components/responses/Error"
                    },
                    "429": {
                        "$ref": "#/components/responses/Error"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "API key (`sk_test_\u2026` or `sk_live_\u2026`). Cookies are never accepted."
            }
        },
        "parameters": {
            "limit": {
                "name": "limit",
                "in": "query",
                "schema": {
                    "type": "integer",
                    "minimum": 1,
                    "maximum": 100,
                    "default": 25
                },
                "description": "Page size."
            },
            "starting_after": {
                "name": "starting_after",
                "in": "query",
                "schema": {
                    "type": "string"
                },
                "description": "The id of the last object of the previous page."
            },
            "idempotency_key": {
                "name": "Idempotency-Key",
                "in": "header",
                "required": false,
                "schema": {
                    "type": "string",
                    "maxLength": 255
                },
                "description": "Replays the first response for 24 hours. The same key with a different body returns 409."
            }
        },
        "responses": {
            "Error": {
                "description": "Error",
                "content": {
                    "application/json": {
                        "schema": {
                            "$ref": "#/components/schemas/Error"
                        }
                    }
                }
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "required": [
                    "error"
                ],
                "properties": {
                    "error": {
                        "type": "object",
                        "required": [
                            "type",
                            "code",
                            "message",
                            "request_id"
                        ],
                        "properties": {
                            "type": {
                                "type": "string",
                                "enum": [
                                    "invalid_request",
                                    "authentication",
                                    "permission",
                                    "not_found",
                                    "rate_limit",
                                    "conflict",
                                    "api_error"
                                ]
                            },
                            "code": {
                                "type": "string"
                            },
                            "message": {
                                "type": "string"
                            },
                            "param": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            },
                            "request_id": {
                                "type": "string"
                            }
                        }
                    }
                }
            },
            "Deleted": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "deleted"
                ],
                "properties": {
                    "object": {
                        "type": "string"
                    },
                    "id": {
                        "type": "string"
                    },
                    "deleted": {
                        "const": true
                    }
                }
            },
            "Variant": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "name",
                    "price",
                    "currency",
                    "billing",
                    "active"
                ],
                "properties": {
                    "object": {
                        "const": "variant"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^var_[0-9a-z]{26}$",
                        "example": "var_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "name": {
                        "type": "string"
                    },
                    "price": {
                        "type": "integer"
                    },
                    "currency": {
                        "const": "usd"
                    },
                    "billing": {
                        "type": "string",
                        "enum": [
                            "one_time",
                            "month",
                            "year"
                        ]
                    },
                    "active": {
                        "type": "boolean"
                    }
                }
            },
            "Product": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "name",
                    "slug",
                    "status",
                    "delivery_type",
                    "variants"
                ],
                "properties": {
                    "object": {
                        "const": "product"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^prd_[0-9a-z]{26}$",
                        "example": "prd_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "name": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string"
                    },
                    "delivery_type": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "variants": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Variant"
                        }
                    }
                }
            },
            "CheckoutCreate": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "variant_id"
                ],
                "properties": {
                    "variant_id": {
                        "type": "string",
                        "pattern": "^var_[0-9a-z]{26}$",
                        "example": "var_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "customer_email": {
                        "type": "string",
                        "format": "email"
                    },
                    "coupon_code": {
                        "type": "string",
                        "maxLength": 40,
                        "description": "A coupon of your store; validated on the server."
                    },
                    "success_url": {
                        "type": "string",
                        "format": "uri",
                        "maxLength": 2048,
                        "description": "Where the buyer returns after paying. Must be https on your storefront address, a live custom domain, or a return domain you allowed in the dashboard."
                    },
                    "cancel_url": {
                        "type": "string",
                        "format": "uri",
                        "maxLength": 2048,
                        "description": "Where the buyer returns if they cancel. Same rules as `success_url`."
                    },
                    "metadata": {
                        "type": "object",
                        "maxProperties": 20,
                        "additionalProperties": {
                            "type": [
                                "string",
                                "number",
                                "boolean"
                            ]
                        },
                        "description": "Keys match `[A-Za-z0-9_.-]{1,40}`."
                    }
                }
            },
            "Checkout": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "url",
                    "status",
                    "livemode",
                    "variant_id",
                    "metadata",
                    "created",
                    "expires_at"
                ],
                "properties": {
                    "object": {
                        "const": "checkout"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^chk_[0-9a-z]{26}$",
                        "example": "chk_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "open",
                            "complete",
                            "expired"
                        ]
                    },
                    "livemode": {
                        "type": "boolean"
                    },
                    "variant_id": {
                        "type": "string",
                        "pattern": "^var_[0-9a-z]{26}$",
                        "example": "var_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "metadata": {
                        "type": "object"
                    },
                    "created": {
                        "type": "integer",
                        "description": "Unix seconds."
                    },
                    "expires_at": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Unix seconds."
                    }
                }
            },
            "Order": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "status",
                    "currency",
                    "subtotal",
                    "discount",
                    "tax",
                    "total",
                    "platform_fee",
                    "seller_net",
                    "product_id",
                    "variant_id",
                    "customer",
                    "livemode",
                    "paid_at"
                ],
                "properties": {
                    "object": {
                        "const": "order"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^ord_[0-9a-z]{26}$",
                        "example": "ord_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "status": {
                        "type": "string"
                    },
                    "currency": {
                        "const": "usd"
                    },
                    "subtotal": {
                        "type": "integer"
                    },
                    "discount": {
                        "type": "integer"
                    },
                    "tax": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "platform_fee": {
                        "type": "integer"
                    },
                    "seller_net": {
                        "type": "integer"
                    },
                    "product_id": {
                        "type": "string",
                        "pattern": "^prd_[0-9a-z]{26}$",
                        "example": "prd_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "variant_id": {
                        "type": "string",
                        "pattern": "^var_[0-9a-z]{26}$",
                        "example": "var_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "customer": {
                        "type": "object",
                        "required": [
                            "id",
                            "email",
                            "country"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "pattern": "^cus_[0-9a-z]{26}$",
                                "example": "cus_01j9z8k3m4n5p6q7r8s9t0v1w2"
                            },
                            "email": {
                                "type": "string"
                            },
                            "country": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "livemode": {
                        "type": "boolean"
                    },
                    "paid_at": {
                        "type": "integer",
                        "description": "Unix seconds."
                    }
                }
            },
            "Refund": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "order_id",
                    "amount",
                    "currency",
                    "status",
                    "created"
                ],
                "properties": {
                    "object": {
                        "const": "refund"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^ref_[0-9a-z]{26}$",
                        "example": "ref_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "order_id": {
                        "type": "string",
                        "pattern": "^ord_[0-9a-z]{26}$",
                        "example": "ord_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "amount": {
                        "type": "integer"
                    },
                    "currency": {
                        "const": "usd"
                    },
                    "status": {
                        "type": "string"
                    },
                    "created": {
                        "type": "integer",
                        "description": "Unix seconds."
                    }
                }
            },
            "Customer": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "email",
                    "name",
                    "country",
                    "created"
                ],
                "properties": {
                    "object": {
                        "const": "customer"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^cus_[0-9a-z]{26}$",
                        "example": "cus_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "email": {
                        "type": "string"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "country": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "created": {
                        "type": "integer",
                        "description": "Unix seconds."
                    }
                }
            },
            "Subscription": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "status",
                    "product_id",
                    "variant_id",
                    "customer",
                    "current_period_start",
                    "current_period_end",
                    "cancel_at_period_end",
                    "canceled_at",
                    "order_id",
                    "livemode"
                ],
                "properties": {
                    "object": {
                        "const": "subscription"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^sub_[0-9a-z]{26}$",
                        "example": "sub_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "past_due",
                            "canceled",
                            "unpaid",
                            "incomplete"
                        ]
                    },
                    "product_id": {
                        "type": "string",
                        "pattern": "^prd_[0-9a-z]{26}$",
                        "example": "prd_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "variant_id": {
                        "type": "string",
                        "pattern": "^var_[0-9a-z]{26}$",
                        "example": "var_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "customer": {
                        "type": "object",
                        "required": [
                            "id",
                            "email",
                            "country"
                        ],
                        "properties": {
                            "id": {
                                "type": "string",
                                "pattern": "^cus_[0-9a-z]{26}$",
                                "example": "cus_01j9z8k3m4n5p6q7r8s9t0v1w2"
                            },
                            "email": {
                                "type": "string"
                            },
                            "country": {
                                "type": [
                                    "string",
                                    "null"
                                ]
                            }
                        }
                    },
                    "current_period_start": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Unix seconds."
                    },
                    "current_period_end": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Unix seconds."
                    },
                    "cancel_at_period_end": {
                        "type": "boolean"
                    },
                    "canceled_at": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Unix seconds."
                    },
                    "order_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^ord_[0-9a-z]{26}$",
                        "example": "ord_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "livemode": {
                        "type": "boolean"
                    }
                }
            },
            "LicenseKey": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "order_id",
                    "subscription_id",
                    "key",
                    "status"
                ],
                "properties": {
                    "object": {
                        "const": "license_key"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^lic_[0-9a-z]{26}$",
                        "example": "lic_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "order_id": {
                        "type": "string",
                        "pattern": "^ord_[0-9a-z]{26}$",
                        "example": "ord_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "subscription_id": {
                        "type": [
                            "string",
                            "null"
                        ],
                        "pattern": "^sub_[0-9a-z]{26}$",
                        "example": "sub_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "key": {
                        "type": "string"
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "revoked"
                        ]
                    }
                }
            },
            "CouponCreate": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "code",
                    "type"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9_-]{2,39}$"
                    },
                    "name": {
                        "type": "string"
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "percent",
                            "amount"
                        ]
                    },
                    "percent_off": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 99
                    },
                    "amount_off": {
                        "type": "integer",
                        "minimum": 1,
                        "description": "Cents."
                    },
                    "starts_at": {
                        "type": "integer",
                        "description": "Unix seconds."
                    },
                    "expires_at": {
                        "type": "integer",
                        "description": "Unix seconds."
                    },
                    "max_redemptions": {
                        "type": "integer",
                        "minimum": 1
                    },
                    "product_ids": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "pattern": "^prd_[0-9a-z]{26}$",
                            "example": "prd_01j9z8k3m4n5p6q7r8s9t0v1w2"
                        },
                        "description": "Restrict to these products. Omit for all."
                    }
                }
            },
            "Coupon": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "code",
                    "name",
                    "type",
                    "percent_off",
                    "amount_off",
                    "currency",
                    "starts_at",
                    "expires_at",
                    "max_redemptions",
                    "redemptions_count",
                    "product_ids",
                    "active",
                    "created"
                ],
                "properties": {
                    "object": {
                        "const": "coupon"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^cpn_[0-9a-z]{26}$",
                        "example": "cpn_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "code": {
                        "type": "string"
                    },
                    "name": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "type": {
                        "type": "string",
                        "enum": [
                            "percent",
                            "amount"
                        ]
                    },
                    "percent_off": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "amount_off": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "currency": {
                        "type": [
                            "string",
                            "null"
                        ]
                    },
                    "starts_at": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Unix seconds."
                    },
                    "expires_at": {
                        "type": [
                            "integer",
                            "null"
                        ],
                        "description": "Unix seconds."
                    },
                    "max_redemptions": {
                        "type": [
                            "integer",
                            "null"
                        ]
                    },
                    "redemptions_count": {
                        "type": "integer"
                    },
                    "product_ids": {
                        "type": [
                            "array",
                            "null"
                        ],
                        "items": {
                            "type": "string",
                            "pattern": "^prd_[0-9a-z]{26}$",
                            "example": "prd_01j9z8k3m4n5p6q7r8s9t0v1w2"
                        }
                    },
                    "active": {
                        "type": "boolean"
                    },
                    "created": {
                        "type": "integer",
                        "description": "Unix seconds."
                    }
                }
            },
            "WebhookEndpointCreate": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "url"
                ],
                "properties": {
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "description": "https, port 443, public host."
                    },
                    "events": {
                        "type": "array",
                        "default": [
                            "*"
                        ],
                        "items": {
                            "type": "string",
                            "enum": [
                                "order.paid",
                                "order.refunded",
                                "subscription.created",
                                "subscription.renewed",
                                "subscription.payment_failed",
                                "subscription.canceled",
                                "license.revoked",
                                "dispute.created",
                                "dispute.closed",
                                "payout.sent",
                                "payout.failed",
                                "*"
                            ]
                        }
                    }
                }
            },
            "WebhookEndpointUpdate": {
                "type": "object",
                "additionalProperties": false,
                "properties": {
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string",
                            "enum": [
                                "order.paid",
                                "order.refunded",
                                "subscription.created",
                                "subscription.renewed",
                                "subscription.payment_failed",
                                "subscription.canceled",
                                "license.revoked",
                                "dispute.created",
                                "dispute.closed",
                                "payout.sent",
                                "payout.failed",
                                "*"
                            ]
                        }
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "disabled"
                        ]
                    }
                }
            },
            "WebhookEndpoint": {
                "type": "object",
                "required": [
                    "object",
                    "id",
                    "url",
                    "events",
                    "mode",
                    "status",
                    "created"
                ],
                "properties": {
                    "object": {
                        "const": "webhook_endpoint"
                    },
                    "id": {
                        "type": "string",
                        "pattern": "^whe_[0-9a-z]{26}$",
                        "example": "whe_01j9z8k3m4n5p6q7r8s9t0v1w2"
                    },
                    "url": {
                        "type": "string"
                    },
                    "events": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "mode": {
                        "type": "string",
                        "enum": [
                            "live",
                            "test"
                        ]
                    },
                    "status": {
                        "type": "string",
                        "enum": [
                            "active",
                            "disabled"
                        ]
                    },
                    "created": {
                        "type": "integer",
                        "description": "Unix seconds."
                    }
                }
            },
            "WebhookEndpointWithSecret": {
                "allOf": [
                    {
                        "$ref": "#/components/schemas/WebhookEndpoint"
                    },
                    {
                        "type": "object",
                        "required": [
                            "secret"
                        ],
                        "properties": {
                            "secret": {
                                "type": "string",
                                "description": "Signing secret (`whsec_\u2026`), shown only once."
                            }
                        }
                    }
                ]
            }
        }
    }
}