{
  "openapi": "3.0.0",
  "info": {
    "title": "\u00c1skell API",
    "description": "# Authentication\nAuthentication is via `Authorization` header. When using this documentation to test the API you should prepend your given api key with `\"Api-Key \"`. \n\nYou are given two types of API keys, one public and one secret. Your public key is safe to use in javascript so that it is public to the world. It can only \nbe used to generate a temporary payment method, which in turn has to be confirmed using your secret api key.\n\nSee [the documentation](https://docs.askell.is/) for more information.\n\n\n## API V2\nSubscription V2 methods are documented separately at [/api/swagger/v2/](/api/swagger/v2/).",
    "termsOfService": "https://www.askell.is/terms-conditions",
    "contact": {
      "name": "Documentation",
      "url": "https://docs.askell.is"
    },
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://askell.is/api/"
    }
  ],
  "security": [
    {
      "Secret-Api-Key": []
    },
    {
      "Public-Api-Key": []
    }
  ],
  "tags": [
    {
      "name": "Hello",
      "description": "Test operations, requires secret api key."
    },
    {
      "name": "Checkout",
      "description": "Checkout operations, requires secret api key."
    },
    {
      "name": "Customer",
      "description": "Customer operations, requires secret api key."
    },
    {
      "name": "Subscription",
      "description": "Subscription operations, requires secret api key."
    },
    {
      "name": "Plan",
      "description": "Plan operations, requires a secret api key."
    },
    {
      "name": "Temporary payment method",
      "description": "Requires a public api key."
    },
    {
      "name": "Webhooks",
      "description": "Management of webhooks. Requires secret api key."
    },
    {
      "name": "Webhook calls",
      "description": "Webhook calls from \u00c1skell to your system."
    },
    {
      "name": "Transaction",
      "description": "Transaction operations, requires secret api key."
    },
    {
      "name": "Payment",
      "description": "Single payments, requires secret api key."
    }
  ],
  "paths": {
    "/hello/": {
      "get": {
        "tags": [
          "Hello"
        ],
        "summary": "Get a test response",
        "description": "Validates that you can successfully call the API with authorization. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Hello"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/plans/": {
      "get": {
        "tags": [
          "Plan"
        ],
        "summary": "Get a list of plans",
        "description": "Lists all plans. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Plan"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/transactions/{uuid}/receipt/": {
      "get": {
        "tags": [
          "Transaction"
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "description": "UUID of transaction",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Create a receipt for transaction",
        "description": "Create a receipt for transaction. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Transaction"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/transactions/": {
      "get": {
        "tags": [
          "Transaction"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "integer"
            },
            "description": "The number of items to return in the response. Default is 10, maximum is 1000. This parameter is optional, and if it is not present in the query string, no pagination is applied."
          },
          {
            "in": "query",
            "name": "search",
            "schema": {
              "type": "string"
            },
            "description": "Search across transaction uuid and external reference."
          },
          {
            "in": "query",
            "name": "state",
            "schema": {
              "type": "string"
            },
            "description": "Comma separated list of transaction states to include."
          },
          {
            "in": "query",
            "name": "subscription_id",
            "schema": {
              "type": "integer"
            },
            "description": "Filter to a specific subscription id."
          },
          {
            "in": "query",
            "name": "payment_id",
            "schema": {
              "type": "integer"
            },
            "description": "Filter to a specific payment id."
          },
          {
            "in": "query",
            "name": "created_at_after",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Filter transactions created on or after this date (YYYY-MM-DD)."
          },
          {
            "in": "query",
            "name": "created_at_before",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Filter transactions created on or before this date (YYYY-MM-DD)."
          },
          {
            "in": "query",
            "name": "paid_at_after",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Filter transactions settled on or after this date (YYYY-MM-DD)."
          },
          {
            "in": "query",
            "name": "paid_at_before",
            "schema": {
              "type": "string",
              "format": "date"
            },
            "description": "Filter transactions settled on or before this date (YYYY-MM-DD)."
          }
        ],
        "summary": "Get a list of transactions",
        "description": "Lists all transactions for the authenticated account. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Transaction"
                      }
                    },
                    {
                      "$ref": "#/components/schemas/TransactionPaginated"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/customers/": {
      "get": {
        "tags": [
          "Customer"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "integer"
            },
            "description": "The number of items to return in the response. Default is 10, maximum is 1000. This parameter is optional, and if it is not present in the query string, no pagination is applied."
          }
        ],
        "summary": "Get a list of customers",
        "description": "Lists all customers. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Customer"
                      }
                    },
                    {
                      "$ref": "#/components/schemas/CustomerPaginated"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "post": {
        "tags": [
          "Customer"
        ],
        "summary": "Create a customer",
        "description": "Create a customer in \u00c1skell. Requires a secret key. To make it easier linking customers to existing  systems, it is your responsibility to assign a reference to the customer so that you can look  them up later. This can be an id, a UUID or whatever suits you. It's best to keep it simple.\n",
        "requestBody": {
          "$ref": "#/components/requestBodies/Customer"
        },
        "responses": {
          "201": {
            "description": "Successful operation"
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/customers/{customerReference}/subscriptions/": {
      "get": {
        "tags": [
          "Customer"
        ],
        "summary": "Get all subscriptions for a customer",
        "parameters": [
          {
            "name": "customerReference",
            "in": "path",
            "description": "Customer reference (customer_reference) in your system of customer to return",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Subscription"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/customers/{customerReference}/subscriptions/add/": {
      "post": {
        "tags": [
          "Customer"
        ],
        "summary": "Add subscription to a customer",
        "parameters": [
          {
            "name": "customerReference",
            "in": "path",
            "description": "Customer reference (customer_reference) in your system of customer to return",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/CustomerAddSubscription"
        },
        "responses": {
          "201": {
            "description": "Successful operation"
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/customers/{customerReference}/": {
      "get": {
        "tags": [
          "Customer"
        ],
        "summary": "Get a customer",
        "description": "Get a customer which has already been created. You need to supply your chosen customer reference. Requires a secret key.\n",
        "parameters": [
          {
            "name": "customerReference",
            "in": "path",
            "description": "Customer reference (customer_reference) in your system of customer to return",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Customer"
                }
              }
            }
          },
          "404": {
            "description": "Not found"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "put": {
        "tags": [
          "Customer"
        ],
        "summary": "Update a customer",
        "description": "Update a customer which has already been created. You must supply all required fields. Requires a secret key.\n",
        "parameters": [
          {
            "name": "customerReference",
            "in": "path",
            "description": "Customer reference (customer_reference) in your system of customer to return",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation"
          },
          "404": {
            "description": "Not found"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "delete": {
        "tags": [
          "Customer"
        ],
        "summary": "Delete a customer",
        "description": "Delete a customer. Requires a secret key.\n",
        "parameters": [
          {
            "name": "customerReference",
            "in": "path",
            "description": "Customer reference (customer_reference) in your system of customer to return",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Successful operation"
          },
          "404": {
            "description": "Not found"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Customer"
        ],
        "summary": "Partially update a customer",
        "description": "Update a customer which has already been created. All fields are optional. Requires a secret key.",
        "parameters": [
          {
            "name": "customerReference",
            "in": "path",
            "description": "Customer reference (customer_reference) in your system of customer to return",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation"
          },
          "404": {
            "description": "Not found"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/customers/paymentmethod/": {
      "post": {
        "tags": [
          "Customer"
        ],
        "summary": "Add a payment method to customer.",
        "description": "Requires a secret key. You must first acquire a temporary payment method token using `/temporarypaymentmethod/` and use that in your post body.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CustomerAddPaymentMethod"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Successful operation"
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          },
          "404": {
            "description": "Customer not found"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/subscriptions/": {
      "get": {
        "tags": [
          "Subscription"
        ],
        "parameters": [
          {
            "in": "query",
            "name": "page_size",
            "schema": {
              "type": "integer"
            },
            "description": "The number of items to return in the response. Default is 10, maximum is 1000. This parameter is optional, and if it is not present in the query string, no pagination is applied."
          },
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            },
            "description": "The type of response returned. Valid values are `light`, `full`. Default is `full`. This parameter is optional, and if it is not present in the query string, the full response is returned."
          },
          {
            "in": "query",
            "name": "ordering",
            "schema": {
              "type": "string"
            },
            "description": "The ordering of records returned in response. Valid values are `active_until` (ascending), `-active_until` (descending), `start_date` (ascending), `-start_date` (descending). This parameter is optional, and if it is not present in the query string, the unordered response is returned."
          }
        ],
        "summary": "Get all subscriptions",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "anyOf": [
                    {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Subscription"
                      }
                    },
                    {
                      "$ref": "#/components/schemas/SubscriptionPaginated"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/subscriptions/multi/": {
      "post": {
        "tags": [
          "Subscription"
        ],
        "summary": "Create multiple subscriptions",
        "requestBody": {
          "$ref": "#/components/requestBodies/Subscription"
        },
        "responses": {
          "201": {
            "description": "Response when creating multiple subscriptions for one customer",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_201"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/subscriptions/{subscriptionId}/": {
      "get": {
        "tags": [
          "Subscription"
        ],
        "summary": "Get a single subscription",
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "description": "Subscription id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "patch": {
        "tags": [
          "Subscription"
        ],
        "summary": "Update a single subscription",
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "description": "Subscription id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/SubscriptionUpdate"
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Subscription"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/subscriptions/{subscriptionId}/cancel/": {
      "post": {
        "tags": [
          "Subscription"
        ],
        "summary": "Cancel a subscription",
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "description": "Subscription id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "201": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_200_1"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/subscriptions/{subscriptionId}/activate/": {
      "post": {
        "tags": [
          "Subscription"
        ],
        "summary": "Activate a cancelled subscription. This will only work if the latest subscription billing period has not passed.",
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "description": "Subscription id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_200_2"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/subscriptions/{subscriptionId}/set_expiry/": {
      "post": {
        "tags": [
          "Subscription"
        ],
        "summary": "Set a subscription expiry date",
        "description": "Sets the subscription expiry date by updating the latest billing log. Requires a secret key.",
        "parameters": [
          {
            "name": "subscriptionId",
            "in": "path",
            "description": "Subscription id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/SubscriptionSetExpiry"
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_200_2"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/checkouts/": {
      "post": {
        "tags": [
          "Checkout"
        ],
        "summary": "Create a hosted checkout card form",
        "description": "Creates a hosted checkout and returns a `checkout_url` that should be rendered in an iframe. The hosted page collects card details, handles 3D Secure when required, and posts completion messages to the embedding page. The resulting `token` is a reference to a payment method that can be added to a customer after checkout status becomes `tokencreated`.\n\nCreate a checkout either for a `plan` or directly for an account `payment_processor`. When using `payment_processor`, `currency` is required. To capture only the card details, set `capture_only` to `true`; this value is optional and defaults to `false`.\n\nIf supplied, `allowed_origin` must be an origin only, for example `https://merchant.example`, with no path, query string, or credentials. It controls the single parent page origin allowed to frame this checkout and receive checkout postMessage notifications. If omitted, all checkout origins configured for the account are allowed to frame the checkout.",
        "requestBody": {
          "$ref": "#/components/requestBodies/CheckoutCreate"
        },
        "responses": {
          "201": {
            "description": "Response when creating a checkout",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/checkout_response_201"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/checkouts/paymentprocessors/": {
      "get": {
        "tags": [
          "Checkout"
        ],
        "summary": "List payment processors available for checkout",
        "description": "Lists the account payment processors available to the secret API key and indicates whether each processor supports hosted checkout. Use this endpoint when creating a checkout directly with `payment_processor` instead of `plan`.",
        "responses": {
          "200": {
            "description": "Available payment processors",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CheckoutPaymentProcessorList"
                }
              }
            }
          },
          "400": {
            "description": "Invalid account configuration",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/temporarypaymentmethod/": {
      "post": {
        "tags": [
          "Temporary payment method"
        ],
        "summary": "Create a temporary payment method from a credit card",
        "description": "The resulting `token` is a reference to a temporary payment method. You have to confirm this payment method by e.g. using it to activate a subscription, or adding a new payment method to a customer. Requires a public api key. \n",
        "requestBody": {
          "$ref": "#/components/requestBodies/PaymentMethodCreate"
        },
        "responses": {
          "201": {
            "description": "Response when creating a temporary payment method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_201_2"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Public-Api-Key": []
          }
        ]
      }
    },
    "/temporarypaymentmethod/{token}/": {
      "get": {
        "tags": [
          "Temporary payment method"
        ],
        "summary": "Check the status of a temporary payment methd token when dealing with 3D secure.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "Temporary payment method token returned from /api/temporarypaymentmethod/",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "When the 'status' attribute of the response returns 'tokencreated', you can use the token to confirm payments.",
        "responses": {
          "200": {
            "description": "Response when creating a temporary payment method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_200_temporarypaymentmethod_get"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Public-Api-Key": []
          }
        ]
      }
    },
    "/checkouts/{token}/": {
      "get": {
        "tags": [
          "Checkout"
        ],
        "summary": "Check the status of a checkout.",
        "parameters": [
          {
            "name": "token",
            "in": "path",
            "description": "Token returned from /api/checkouts/",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "description": "Poll this endpoint after rendering the hosted checkout iframe. When the `status` attribute returns `tokencreated`, the checkout is complete and the token can be used to confirm payments.",
        "responses": {
          "200": {
            "description": "Response when creating a temporary payment method",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_200_temporarypaymentmethod_get"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Public-Api-Key": []
          }
        ]
      }
    },
    "/payments/": {
      "get": {
        "tags": [
          "Payment"
        ],
        "summary": "Get a list of Payments",
        "description": "Lists all payments. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Payment"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "post": {
        "tags": [
          "Payment"
        ],
        "summary": "Create a payment",
        "description": "Create a single payment in \u00c1skell. Requires a secret key. A payment is executed asynchronously which means that you will have to rely on checking the status of the payment after creating it, or rely on webhooks. You can check the status of the payment using the uuid supplied when the payment is initially created.\n\nInitially, the payment will have the state 'pending'. If the payment is successful, the state will be 'settled'. If the payment fails, the state will be 'failed'.\n If you decide to retry the payment, the payment might have the state 'retrying'.\n\nTo summarize, the four states are:\n\n* pending\n* settled\n* failed\n* retrying\n\n",
        "requestBody": {
          "$ref": "#/components/requestBodies/Payment"
        },
        "responses": {
          "201": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PaymentInitial"
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/payments/{uuid}/": {
      "get": {
        "tags": [
          "Payment"
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "description": "UUID of payment",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "summary": "Get a single Payment",
        "description": "Gets information about a single payment in detail. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Payment"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/payments/{uuid}/retry/": {
      "post": {
        "tags": [
          "Payment"
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "summary": "Retry a failed Payment",
        "description": "If a Payment is in the failed state, you can retry it up to 4 times. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Payment"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/payments/{uuid}/refund/": {
      "post": {
        "tags": [
          "Payment"
        ],
        "parameters": [
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "summary": "Refund a settled Payment",
        "description": "If a Payment is in the settled state and the payment processor supports refunds, you can refund it. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Payment"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value"
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/your-webhook-url/": {
      "post": {
        "tags": [
          "Webhook calls"
        ],
        "summary": "Called when subscription changed or renewed",
        "description": "We recommend that you verify all calls from us to your webhook endpoints. We sign each request with the `Hook-HMAC` header. The value is a HMAC digest derived from the body of the request and a secret key only known by the API and you. We also supply the type of event in the `Hook-Event` header.\n\nHere is a sample implementation in Python. This process is very similar to the one Shopify uses so more information can possibly be gleaned from their [documentation](https://shopify.dev/tutorials/manage-webhooks#verify-webhook).\n```\nimport base64\nimport hmac\nimport hashlib\n\nWEBHOOK_SECRET = \"Your webhook secret\".encode()\nWEBHOOK_DIGEST_TYPE = 'sha512'\n\ndef verify(hmac_header, digest_method, secret, message):\n   digestmod = getattr(hashlib, digest_method)\n   signed = base64.b64encode(\n       hmac.new(secret, message, digestmod).digest(),\n   ).strip()\n   return hmac.compare_digest(signed, hmac_header)\n\n# your view function\ndef handle_webhook(request):\n   # The signature\n   digest = request.META.get('HTTP_HOOK_HMAC').encode()\n   # The name of the webhook event\n   event = request.META.get('HTTP_HOOK_EVENT').encode()\n\n   body = request.body\n   if verify(digest, WEBHOOK_DIGEST_TYPE, WEBHOOK_SECRET, body):\n       payload = json.loads(body)\n       # ... the rest of your code here```\n",
        "requestBody": {
          "$ref": "#/components/requestBodies/SubscriptionMultiLite"
        },
        "responses": {
          "200": {
            "description": "Successful operation"
          }
        }
      }
    },
    "/webhooks/": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get a list of webhooks",
        "description": "Lists all your configured webhooks. Requires a secret key.",
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Webhook"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "post": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Create a webhook",
        "description": "Create a webhook so that \u00c1skell can call your system when certain events happen. Requires a secret key.",
        "requestBody": {
          "$ref": "#/components/requestBodies/Webhook"
        },
        "responses": {
          "201": {
            "description": "Successful operation"
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    },
    "/webhooks/{id}/": {
      "put": {
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Webhook id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "summary": "Update a webhook",
        "description": "Update entire webhook. Requires a secret key.",
        "requestBody": {
          "$ref": "#/components/requestBodies/Webhook"
        },
        "responses": {
          "200": {
            "description": "Successful operation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Webhook"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "patch": {
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Webhook id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "summary": "Partially update a webhook",
        "description": "Update chosen fields of a webhook. Requires a secret key.",
        "requestBody": {
          "$ref": "#/components/requestBodies/WebhookPatch"
        },
        "responses": {
          "200": {
            "description": "Successful operation"
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      },
      "delete": {
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "Webhook id",
            "required": true,
            "style": "simple",
            "explode": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "tags": [
          "Webhooks"
        ],
        "summary": "Delete a single webhook",
        "description": "Delete a webhook with the specified id. Requires a secret key.",
        "responses": {
          "204": {
            "description": "Successful operation"
          },
          "400": {
            "description": "Invalid status value",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_400"
                }
              }
            }
          }
        },
        "security": [
          {
            "Secret-Api-Key": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "Hello": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "success"
          },
          "message": {
            "type": "string",
            "example": "Hello, <Account name>"
          },
          "account": {
            "type": "string",
            "example": "<Account name>"
          }
        }
      },
      "Webhook": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 1
          },
          "event": {
            "type": "string",
            "example": "customer.created"
          },
          "url": {
            "type": "string",
            "example": "https://example.com/7dc7c920208bca93/"
          },
          "hmac_digest": {
            "type": "string",
            "example": "SHA512"
          },
          "hmac_secret": {
            "type": "string",
            "example": "j209ilskdjfk,jsa\u00e6.s7//+&."
          },
          "uuid": {
            "type": "string",
            "example": "fc4f3682-d276-4db4-a543-8317aa26e253"
          }
        }
      },
      "WebhookCreate": {
        "required": [
          "url",
          "event"
        ],
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "example": "https://example.com/7dc7c920208bca93/"
          },
          "event": {
            "type": "string",
            "example": "subscription.renewed"
          }
        }
      },
      "WebhookPatch": {
        "type": "object",
        "properties": {
          "url": {
            "type": "string",
            "example": "https://example.com/7dc7c920208bca93/"
          },
          "event": {
            "type": "string",
            "example": "subscription.renewed"
          }
        }
      },
      "Plan": {
        "type": "object",
        "required": [
          "id",
          "name",
          "reference",
          "interval",
          "interval_count",
          "amount",
          "currency",
          "enabled",
          "private",
          "electronic_only"
        ],
        "properties": {
          "id": {
            "type": "integer",
            "example": 1
          },
          "name": {
            "type": "string",
            "example": "Name of the plan."
          },
          "alternative_name": {
            "type": "string",
            "example": "A slightly longer name or more descriptive."
          },
          "reference": {
            "type": "string",
            "example": "SKU-1"
          },
          "interval": {
            "type": "string",
            "example": "day|week|month|year"
          },
          "interval_count": {
            "type": "integer",
            "example": 1
          },
          "amount": {
            "type": "string",
            "example": "1.0000"
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "trial_period_days": {
            "type": "integer",
            "example": 0
          },
          "description": {
            "type": "string",
            "example": "A longer description."
          },
          "enabled": {
            "type": "boolean",
            "example": true
          },
          "private": {
            "type": "boolean",
            "example": false
          },
          "electronic_only": {
            "type": "boolean",
            "example": true
          },
          "payment_processor": {
            "type": "object",
            "required": [
              "id"
            ],
            "properties": {
              "id": {
                "type": "integer",
                "example": 1
              },
              "name": {
                "type": "string",
                "example": "Adyen processor"
              },
              "type": {
                "type": "string",
                "example": "adyen"
              }
            }
          }
        }
      },
      "PaymentMethod": {
        "type": "object",
        "properties": {
          "verified": {
            "type": "boolean",
            "example": true
          },
          "canceled": {
            "type": "boolean",
            "example": false
          },
          "valid_until": {
            "type": "string",
            "format": "date-time",
            "example": "2022-11-01T00:00:00Z"
          },
          "display_info": {
            "type": "string",
            "example": "XXXX-XXXX-XXXX-2887 (MasterCard)"
          }
        }
      },
      "CheckoutCreate": {
        "type": "object",
        "description": "Create a hosted checkout either from a plan variant or directly from an account payment processor.",
        "properties": {
          "plan": {
            "type": "integer",
            "description": "Plan variant id. Use either `plan` or `payment_processor`.",
            "example": 1
          },
          "payment_processor": {
            "type": "integer",
            "description": "Account payment processor id returned from `/api/checkouts/paymentprocessors/`. Use either `plan` or `payment_processor`.",
            "example": 4
          },
          "currency": {
            "type": "string",
            "description": "Required when creating a checkout directly with `payment_processor`.",
            "example": "ISK"
          },
          "capture_only": {
            "type": "boolean",
            "description": "When true, only capture card details. Defaults to false.",
            "example": false
          },
          "allowed_origin": {
            "type": "string",
            "format": "uri",
            "description": "Optional iframe parent origin for this checkout, for example `https://merchant.example`. Must be an origin only, with no path, query string, or credentials. Overrides the account configured checkout origins for this checkout.",
            "example": "https://merchant.example"
          }
        },
        "oneOf": [
          {
            "type": "object",
            "required": [
              "plan"
            ]
          },
          {
            "type": "object",
            "required": [
              "payment_processor",
              "currency"
            ]
          }
        ]
      },
      "CheckoutPaymentProcessorList": {
        "type": "object",
        "properties": {
          "payment_processors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CheckoutPaymentProcessor"
            }
          }
        }
      },
      "CheckoutPaymentProcessor": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 4
          },
          "name": {
            "type": "string",
            "example": "Saltpay ISK"
          },
          "display_name": {
            "type": "string",
            "example": "Saltpay"
          },
          "payment_processor": {
            "type": "string",
            "example": "saltpay"
          },
          "allowed_currencies": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "ISK"
            ]
          },
          "supports_checkout": {
            "type": "boolean",
            "example": true
          },
          "error": {
            "type": "string",
            "description": "Present when the processor configuration could not be initialized.",
            "example": "Unable to initialize payment processor."
          }
        }
      },
      "PaymentMethodCreate": {
        "required": [
          "card_number",
          "cvv_number",
          "expiration_month",
          "expiration_year"
        ],
        "type": "object",
        "properties": {
          "card_number": {
            "type": "string",
            "example": "9999999999999999"
          },
          "expiration_year": {
            "maxLength": 2,
            "type": "string",
            "example": "22"
          },
          "expiration_month": {
            "maxLength": 2,
            "type": "string",
            "example": "11"
          },
          "cvv_number": {
            "type": "string",
            "example": "123"
          },
          "plan": {
            "type": "integer",
            "example": 1
          }
        }
      },
      "PaymentMethodTokenCreate": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          }
        }
      },
      "CustomerAddPaymentMethod": {
        "required": [
          "customer_reference",
          "token"
        ],
        "type": "object",
        "properties": {
          "customer_reference": {
            "type": "string",
            "example": "12345"
          },
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          }
        }
      },
      "CustomerCreate": {
        "required": [
          "customer_reference",
          "email",
          "first_name",
          "last_name"
        ],
        "type": "object",
        "properties": {
          "first_name": {
            "maxLength": 128,
            "type": "string",
            "example": "J\u00f3n"
          },
          "last_name": {
            "maxLength": 128,
            "type": "string",
            "example": "J\u00f3nsson"
          },
          "email": {
            "maxLength": 254,
            "type": "string",
            "example": "email@example.com"
          },
          "phone": {
            "maxLength": 32,
            "type": "string",
            "example": "+3545551234"
          },
          "customer_reference": {
            "maxLength": 256,
            "type": "string",
            "example": "1234"
          }
        }
      },
      "Customer": {
        "allOf": [
          {
            "$ref": "#/components/schemas/CustomerCreate"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64",
                "example": 1
              },
              "payment_method": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PaymentMethod"
                }
              }
            }
          }
        ]
      },
      "CustomerPaginated": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "next": {
            "type": "string",
            "example": "https://askell.is/api/customers/?page_size=1&page=2"
          },
          "previous": {
            "type": "string",
            "example": "https://askell.is/api/customers/?page_size=1&page=1"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Customer"
            }
          }
        }
      },
      "Payment": {
        "type": "object",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "string",
            "example": "100.00"
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "description": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "example": "settled",
            "enum": [
              "failed",
              "settled",
              "pending",
              "retrying"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          }
        }
      },
      "PaymentInitial": {
        "type": "object",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "amount": {
            "type": "string",
            "example": "100.00"
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "description": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "example": "pending",
            "enum": [
              "failed",
              "settled",
              "pending",
              "retrying"
            ]
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "transactions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          }
        }
      },
      "PaymentCreate": {
        "type": "object",
        "required": [
          "customer_reference",
          "amount",
          "currency"
        ],
        "properties": {
          "customer_reference": {
            "type": "string",
            "example": "12345"
          },
          "amount": {
            "type": "string",
            "example": "100.00"
          },
          "currency": {
            "type": "string",
            "example": "USD"
          },
          "description": {
            "type": "string"
          },
          "reference": {
            "type": "string"
          },
          "payment_options": {
            "type": "object",
            "properties": {
              "payment_processor": {
                "type": "string",
                "enum": [
                  "claim"
                ],
                "example": "claim"
              },
              "claimtemplate": {
                "type": "integer",
                "example": 1
              },
              "claimrule": {
                "type": "integer",
                "example": 1
              },
              "payment_date": {
                "type": "string",
                "format": "date-time",
                "example": "2025-11-01"
              },
              "payor_id": {
                "type": "string",
                "example": "1234567890 (must be a valid Icelandic kennitala)"
              }
            }
          }
        }
      },
      "Subscription": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 123
          },
          "trial_end": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "start_date": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "active_until": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "example": "REF-12345"
          },
          "description": {
            "type": "string"
          },
          "is_on_trial": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "cancelled": {
            "type": "boolean"
          },
          "cancel_date": {
            "type": "string",
            "format": "date-time"
          },
          "meta": {
            "type": "string",
            "format": "json"
          },
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          },
          "customer": {
            "type": "integer",
            "format": "int64",
            "example": 123
          },
          "plan": {
            "$ref": "#/components/schemas/Plan"
          },
          "billing_logs": {
            "type": "array",
            "readOnly": true,
            "items": {
              "$ref": "#/components/schemas/BillingLog"
            }
          }
        }
      },
      "SubscriptionPaginated": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "next": {
            "type": "string",
            "example": "https://askell.is/api/subcriptions/?page_size=1&page=2"
          },
          "previous": {
            "type": "string",
            "example": "https://askell.is/api/subcriptions/?page_size=1&page=1"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subscription"
            }
          }
        }
      },
      "SubscriptionNoBillingLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64",
            "example": 123
          },
          "trial_end": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "start_date": {
            "type": "string",
            "format": "date-time"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "active_until": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          },
          "reference": {
            "type": "string",
            "example": "REF-12345"
          },
          "description": {
            "type": "string"
          },
          "is_on_trial": {
            "type": "boolean"
          },
          "active": {
            "type": "boolean"
          },
          "cancelled": {
            "type": "boolean"
          },
          "cancel_date": {
            "type": "string",
            "format": "date-time"
          },
          "meta": {
            "type": "string",
            "format": "json"
          },
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          },
          "customer": {
            "$ref": "#/components/schemas/Customer"
          }
        }
      },
      "BillingLog": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "billing_log_type": {
            "type": "string",
            "enum": [
              "trial",
              "renewal"
            ]
          },
          "billing_date": {
            "type": "string",
            "format": "date-time"
          },
          "plan_billed_up_to": {
            "type": "string",
            "format": "date-time"
          },
          "total": {
            "type": "string",
            "format": "money",
            "nullable": true,
            "example": "6.99"
          },
          "transaction": {
            "$ref": "#/components/schemas/Transaction"
          }
        }
      },
      "Transaction": {
        "type": "object",
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid"
          },
          "data": {
            "type": "object",
            "description": "Arbitrary data on transaction from payment processor\n"
          },
          "state": {
            "type": "string",
            "enum": [
              "failed",
              "settled",
              "inital",
              "pending",
              "canceled",
              "refunded"
            ]
          },
          "amount": {
            "type": "string",
            "example": "6.99"
          },
          "currency": {
            "type": "string",
            "example": "USD"
          }
        }
      },
      "TransactionPaginated": {
        "type": "object",
        "properties": {
          "count": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "next": {
            "type": "string",
            "example": "https://askell.is/api/transactions/?page_size=1&page=2"
          },
          "previous": {
            "type": "string",
            "example": "https://askell.is/api/transactions/?page_size=1&page=1"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Transaction"
            }
          }
        }
      },
      "SubscriptionCreate": {
        "type": "object",
        "required": [
          "plan",
          "reference"
        ],
        "properties": {
          "plan": {
            "type": "integer",
            "format": "int64",
            "example": 1
          },
          "reference": {
            "type": "string",
            "example": "Sub-12345"
          },
          "start_date": {
            "type": "string",
            "format": "date-time",
            "example": "2022-11-01T00:00:00Z",
            "required": false
          },
          "amount": {
            "type": "string",
            "example": "1500",
            "required": "false",
            "description": "Amount to overwrite the plan amount"
          },
          "discount": {
            "type": "string",
            "example": "10",
            "required": "false",
            "description": "Discount percentage, from 0 to 100. A value of 10 means 10% discount, calculated on the next charge."
          },
          "description": {
            "type": "string",
            "example": "My custom note",
            "required": "false",
            "description": "An optional description for internal purposes."
          }
        }
      },
      "SubscriptionUpdate": {
        "type": "object",
        "properties": {
          "plan": {
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "format": "int64",
                "example": 1
              }
            }
          },
          "amount": {
            "type": "string",
            "example": "1500",
            "required": "false",
            "description": "Amount to overwrite the plan amount"
          },
          "discount": {
            "type": "string",
            "example": "10",
            "required": "false",
            "description": "Discount percentage, from 0 to 100. A value of 10 means 10% discount, calculated on the next charge."
          },
          "description": {
            "type": "string",
            "example": "My custom note",
            "required": "false",
            "description": "An optional description for internal purposes."
          }
        }
      },
      "SubscriptionSetExpiry": {
        "type": "object",
        "properties": {
          "expires": {
            "type": "string",
            "format": "date-time",
            "example": "2024-01-31T00:00:00Z"
          }
        }
      },
      "SubscriptionCreateMulti": {
        "type": "object",
        "properties": {
          "customer": {
            "$ref": "#/components/schemas/CustomerCreate"
          },
          "payment_method": {
            "$ref": "#/components/schemas/PaymentMethodTokenCreate"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SubscriptionCreate"
            }
          }
        }
      },
      "inline_response_400": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "example": "error"
          },
          "error": {
            "type": "string",
            "example": "Validation error"
          }
        }
      },
      "inline_response_201": {
        "type": "object",
        "properties": {
          "customer": {
            "$ref": "#/components/schemas/Customer"
          },
          "subscriptions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Subscription"
            }
          }
        }
      },
      "inline_response_200_1": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "example": "canceled"
          }
        }
      },
      "inline_response_200_2": {
        "type": "object",
        "properties": {
          "state": {
            "type": "string",
            "example": "active"
          }
        }
      },
      "checkout_response_201": {
        "type": "object",
        "description": "Response when creating a hosted checkout. Render `checkout_url` in an iframe and poll `/api/checkouts/{token}/` until status becomes `tokencreated`.",
        "properties": {
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          },
          "checkout_url": {
            "type": "string",
            "example": "https://askell.is/checkout/637302f0412e2e11adc0ba21adafcf11/"
          }
        }
      },
      "inline_response_201_2": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          },
          "card_verification_url": {
            "type": "string",
            "example": "https://askell.is/verify/637302f0412e2e11adc0ba21adafcf11/"
          }
        }
      },
      "inline_response_200_temporarypaymentmethod_get": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "example": "637302f0412e2e11adc0ba21adafcf11"
          },
          "status": {
            "type": "string",
            "description": "Checkout or temporary payment method status. `tokencreated` means the token is ready to use.",
            "example": "tokencreated"
          }
        }
      }
    },
    "requestBodies": {
      "Webhook": {
        "description": "Webhook object",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WebhookCreate"
            }
          }
        },
        "required": true
      },
      "WebhookPatch": {
        "description": "Webhook object",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/WebhookPatch"
            }
          }
        },
        "required": true
      },
      "Customer": {
        "description": "Customer object",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CustomerCreate"
            }
          }
        },
        "required": true
      },
      "Payment": {
        "description": "Payment object",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PaymentCreate"
            }
          }
        },
        "required": true
      },
      "CustomerAddSubscription": {
        "description": "Customer add subscription object",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SubscriptionCreate"
            }
          }
        },
        "required": true
      },
      "Subscription": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SubscriptionCreateMulti"
            }
          }
        }
      },
      "SubscriptionUpdate": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SubscriptionUpdate"
            }
          }
        }
      },
      "SubscriptionSetExpiry": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/SubscriptionSetExpiry"
            }
          }
        }
      },
      "CheckoutCreate": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/CheckoutCreate"
            }
          }
        }
      },
      "PaymentMethodCreate": {
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/PaymentMethodCreate"
            }
          }
        }
      },
      "SubscriptionMultiLite": {
        "description": "Response when creating multiple subscriptions for one customer",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": {
                "customer": {
                  "$ref": "#/components/schemas/Customer"
                },
                "subscriptions": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/SubscriptionNoBillingLog"
                  }
                }
              }
            },
            "V2BillingRun": {
              "description": "V2 billing run",
              "content": {
                "application/json": {
                  "schema": {
                    "$ref": "#/components/schemas/V2BillingRun"
                  }
                }
              }
            },
            "V2BillingRunList": {
              "description": "V2 billing run list",
              "content": {
                "application/json": {
                  "schema": {
                    "anyOf": [
                      {
                        "type": "array",
                        "items": {
                          "$ref": "#/components/schemas/V2BillingRun"
                        }
                      },
                      {
                        "type": "object",
                        "properties": {
                          "count": {
                            "type": "integer"
                          },
                          "next": {
                            "type": "string",
                            "nullable": true
                          },
                          "previous": {
                            "type": "string",
                            "nullable": true
                          },
                          "results": {
                            "type": "array",
                            "items": {
                              "$ref": "#/components/schemas/V2BillingRun"
                            }
                          }
                        }
                      }
                    ]
                  }
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "Secret-Api-Key": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      },
      "Public-Api-Key": {
        "type": "apiKey",
        "name": "Authorization",
        "in": "header"
      }
    }
  }
}