PPanel Edge

commerce

由 openapi.json 自动生成的 59 个端点及其请求、响应和权限元数据。

此参考由已发布 API 契约生成。字段、请求头和权限要求如下。

下载完整 OpenAPI 文档 · SHA-256: ccaa20cec11fad96e369b88073ce3608a5b071ce55d6dc03fa31df7b0f08c525

标识符和数据结构与公开契约一致,说明直接给出调用规则。共享模型见 数据模型.

GET /api/v1/admin/apple/subscriptions

GET /api/v1/admin/apple/subscriptions

Apple external subscriptions

{
  "parameters": [
    {
      "in": "query",
      "name": "environment",
      "required": false,
      "schema": {
        "default": "production",
        "enum": [
          "sandbox",
          "production"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,64}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "user_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "auto_renew": {
                      "type": "boolean"
                    },
                    "current_product_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "current_transaction_id": {
                      "pattern": "^\\d{1,64}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "environment": {
                      "enum": [
                        "sandbox",
                        "production"
                      ],
                      "type": "string"
                    },
                    "grace_expires_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "last_signed_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "last_synced_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "next_product_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "original_transaction_id": {
                      "pattern": "^\\d{1,64}$",
                      "type": "string"
                    },
                    "state": {
                      "enum": [
                        "pending",
                        "active",
                        "grace",
                        "billing_retry",
                        "expired",
                        "revoked"
                      ],
                      "type": "string"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "environment",
                    "original_transaction_id",
                    "user_id",
                    "subscription_id",
                    "current_transaction_id",
                    "current_product_id",
                    "next_product_id",
                    "state",
                    "auto_renew",
                    "grace_expires_at",
                    "last_signed_at",
                    "last_synced_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Apple external subscriptions",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.order.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/apple/subscriptions/{originalTransactionId}/receipts

GET /api/v1/admin/apple/subscriptions/{originalTransactionId}/receipts

Apple external receipts in original milliunits

{
  "parameters": [
    {
      "in": "path",
      "name": "originalTransactionId",
      "required": true,
      "schema": {
        "pattern": "^\\d{1,64}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "environment",
      "required": false,
      "schema": {
        "default": "production",
        "enum": [
          "sandbox",
          "production"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,64}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "currency": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "environment": {
                      "enum": [
                        "sandbox",
                        "production"
                      ],
                      "type": "string"
                    },
                    "expires_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "kind": {
                      "enum": [
                        "external_receipt"
                      ],
                      "type": "string"
                    },
                    "plan_price_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "price_milli": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "product_id": {
                      "type": "string"
                    },
                    "purchase_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "revoked_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "source": {
                      "enum": [
                        "apple"
                      ],
                      "type": "string"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "transaction_id": {
                      "pattern": "^\\d{1,64}$",
                      "type": "string"
                    }
                  },
                  "required": [
                    "source",
                    "kind",
                    "environment",
                    "transaction_id",
                    "product_id",
                    "subscription_id",
                    "plan_price_id",
                    "purchase_at",
                    "expires_at",
                    "revoked_at",
                    "price_milli",
                    "currency"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Apple external receipts in original milliunits",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.order.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/apple/subscriptions/{originalTransactionId}/sync

POST /api/v1/admin/apple/subscriptions/{originalTransactionId}/sync

Query Apple and reconcile the subscription

{
  "parameters": [
    {
      "in": "path",
      "name": "originalTransactionId",
      "required": true,
      "schema": {
        "pattern": "^\\d{1,64}$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "environment": {
              "enum": [
                "sandbox",
                "production"
              ],
              "type": "string"
            }
          },
          "required": [
            "environment"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "duplicate": {
                "type": "boolean"
              },
              "stale": {
                "type": "boolean"
              },
              "subscription_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "duplicate",
              "stale",
              "subscription_id"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Query Apple and reconcile the subscription",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.apple.sync",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.payment.sync",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/orders

GET /api/v1/admin/orders

Orders

{
  "parameters": [
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "maxLength": 512,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "status",
      "required": false,
      "schema": {
        "maxLength": 40,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "user_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "include_total",
      "required": false,
      "schema": {
        "enum": [
          "true",
          "false"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "enum": [
          "purchase",
          "renewal",
          "traffic_reset",
          "top_up"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "plan_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "channel_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "refund_state",
      "required": false,
      "schema": {
        "enum": [
          "none",
          "partial",
          "full"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_min",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_max",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_from",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_to",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "q",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page",
      "required": false,
      "schema": {
        "maximum": 10001,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "order",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommerceOrder"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "next_cursor",
              "has_more"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Orders",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.order.read",
  "effectiveSecurity": []
}

GET /api/v1/admin/orders/{id}

GET /api/v1/admin/orders/{id}

Order details

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such order"
    }
  },
  "summary": "Order details",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.order.read",
  "effectiveSecurity": []
}

POST /api/v1/admin/orders/{id}/cancel

POST /api/v1/admin/orders/{id}/cancel

Close an unpaid order

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "description": "Resource ETag; missing 428, malformed 412, stale 409.",
      "in": "header",
      "name": "If-Match",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result",
      "headers": {
        "ETag": {
          "description": "Current resource version for If-Match.",
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Order changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Close an unpaid order",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.order.cancel",
  "x-body": "none",
  "x-body-limit": 0,
  "x-concurrency": {
    "etag": true,
    "ifMatch": true
  },
  "x-idempotency": "optional",
  "x-permission": "commerce.order.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/orders/{id}/receipt

GET /api/v1/admin/orders/{id}/receipt

Immutable order receipt for finance

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceReceipt"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such receipt"
    }
  },
  "summary": "Immutable order receipt for finance",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.order.read",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/orders/{id}/receipt.pdf

GET /api/v1/admin/orders/{id}/receipt.pdf

Download immutable PDF receipt

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "locale",
      "required": false,
      "schema": {
        "default": "zh-CN",
        "enum": [
          "zh-CN",
          "en-US"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/pdf": {
          "schema": {
            "format": "binary",
            "type": "string"
          }
        }
      },
      "description": "PDF receipt"
    },
    "304": {
      "description": "Private cached receipt unchanged"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such receipt"
    },
    "503": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Private storage unavailable"
    }
  },
  "summary": "Download immutable PDF receipt",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.order.read",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/payment-channels

GET /api/v1/admin/payment-channels

Channel instances in display order

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommerceChannel"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Channel instances in display order",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.channel.manage",
  "effectiveSecurity": []
}

POST /api/v1/admin/payment-channels

POST /api/v1/admin/payment-channels

Configure a channel instance

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "config": {
              "additionalProperties": {},
              "type": "object"
            },
            "currency": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "fee_bps": {
              "default": 0,
              "maximum": 10000,
              "minimum": 0,
              "type": "integer"
            },
            "fee_fixed_minor": {
              "default": "0",
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "i18n": {
              "additionalProperties": {
                "properties": {
                  "description": {
                    "maxLength": 2000,
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              },
              "type": "object"
            },
            "kind": {
              "pattern": "^(epay|stripe|alipay_f2f|crypto:[a-z0-9_]+)$",
              "type": "string"
            },
            "max_amount_minor": {
              "default": null,
              "pattern": "^\\d{1,18}$",
              "type": [
                "string",
                "null"
              ]
            },
            "min_amount_minor": {
              "default": null,
              "pattern": "^\\d{1,18}$",
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "secrets": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "sort": {
              "default": 0,
              "maximum": 100000,
              "minimum": 0,
              "type": "integer"
            },
            "source_locale": {
              "default": "en-US",
              "maxLength": 35,
              "minLength": 2,
              "type": "string"
            },
            "status": {
              "default": "disabled",
              "enum": [
                "enabled",
                "disabled"
              ],
              "type": "string"
            }
          },
          "required": [
            "kind",
            "name",
            "i18n",
            "currency",
            "config"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceChannel"
          }
        }
      },
      "description": "Result"
    },
    "422": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Invalid channel settings"
    }
  },
  "summary": "Configure a channel instance",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.channel.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.channel.manage",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/payment-channels/reorder

POST /api/v1/admin/payment-channels/reorder

Set channel display order

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "ids": {
              "items": {
                "format": "uuid",
                "type": "string"
              },
              "maxItems": 100,
              "type": "array"
            }
          },
          "required": [
            "ids"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "ok": {
                "enum": [
                  true
                ],
                "type": "boolean"
              }
            },
            "required": [
              "ok"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Set channel display order",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.channel.reorder",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.channel.manage",
  "effectiveSecurity": []
}

DELETE /api/v1/admin/payment-channels/{id}

DELETE /api/v1/admin/payment-channels/{id}

Delete an unused channel

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "204": {
      "description": "Deleted"
    }
  },
  "summary": "Delete an unused channel",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.channel.delete",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "optional",
  "x-permission": "commerce.channel.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/payment-channels/{id}

GET /api/v1/admin/payment-channels/{id}

Channel instance

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceChannel"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Channel instance",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.channel.manage",
  "effectiveSecurity": []
}

PUT /api/v1/admin/payment-channels/{id}

PUT /api/v1/admin/payment-channels/{id}

Update or enable a channel

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "description": "Resource ETag; missing 428, malformed 412, stale 409.",
      "in": "header",
      "name": "If-Match",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "config": {
              "additionalProperties": {},
              "type": "object"
            },
            "currency": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "fee_bps": {
              "default": 0,
              "maximum": 10000,
              "minimum": 0,
              "type": "integer"
            },
            "fee_fixed_minor": {
              "default": "0",
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "i18n": {
              "additionalProperties": {
                "properties": {
                  "description": {
                    "maxLength": 2000,
                    "type": "string"
                  },
                  "name": {
                    "maxLength": 200,
                    "minLength": 1,
                    "type": "string"
                  }
                },
                "required": [
                  "name"
                ],
                "type": "object"
              },
              "type": "object"
            },
            "kind": {
              "pattern": "^(epay|stripe|alipay_f2f|crypto:[a-z0-9_]+)$",
              "type": "string"
            },
            "max_amount_minor": {
              "default": null,
              "pattern": "^\\d{1,18}$",
              "type": [
                "string",
                "null"
              ]
            },
            "min_amount_minor": {
              "default": null,
              "pattern": "^\\d{1,18}$",
              "type": [
                "string",
                "null"
              ]
            },
            "name": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "secrets": {
              "additionalProperties": {
                "type": "string"
              },
              "type": "object"
            },
            "sort": {
              "default": 0,
              "maximum": 100000,
              "minimum": 0,
              "type": "integer"
            },
            "source_locale": {
              "default": "en-US",
              "maxLength": 35,
              "minLength": 2,
              "type": "string"
            },
            "status": {
              "default": "disabled",
              "enum": [
                "enabled",
                "disabled"
              ],
              "type": "string"
            }
          },
          "required": [
            "kind",
            "name",
            "i18n",
            "currency",
            "config"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceChannel"
          }
        }
      },
      "description": "Result",
      "headers": {
        "ETag": {
          "description": "Current resource version for If-Match.",
          "schema": {
            "type": "string"
          }
        }
      }
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Version changed"
    },
    "422": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Invalid channel settings"
    }
  },
  "summary": "Update or enable a channel",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.channel.update",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-concurrency": {
    "etag": true,
    "ifMatch": true
  },
  "x-idempotency": "optional",
  "x-permission": "commerce.channel.manage",
  "x-reauth": true,
  "effectiveSecurity": []
}

GET /api/v1/admin/payment-channels/{id}/secret

GET /api/v1/admin/payment-channels/{id}/secret

Reveal channel secrets

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "callback_token": {
                "type": "string"
              },
              "secrets": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              }
            },
            "required": [
              "secrets",
              "callback_token"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Reveal channel secrets",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.channel.read_secret",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.channel.read_secret",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/payment-channels/{id}/test

POST /api/v1/admin/payment-channels/{id}/test

Test channel credentials

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "anyOf": [
              {
                "properties": {
                  "ok": {
                    "enum": [
                      true
                    ],
                    "type": "boolean"
                  }
                },
                "required": [
                  "ok"
                ],
                "type": "object"
              },
              {
                "properties": {
                  "ok": {
                    "enum": [
                      false
                    ],
                    "type": "boolean"
                  },
                  "reason": {
                    "type": "string"
                  }
                },
                "required": [
                  "ok",
                  "reason"
                ],
                "type": "object"
              }
            ]
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Test channel credentials",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.channel.test",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.channel.manage",
  "effectiveSecurity": []
}

GET /api/v1/admin/payment-events

GET /api/v1/admin/payment-events

Provider facts and exceptions

{
  "parameters": [
    {
      "in": "query",
      "name": "result",
      "required": false,
      "schema": {
        "enum": [
          "applied",
          "duplicate",
          "unmatched",
          "rejected",
          "amount_mismatch",
          "late_settled",
          "unapplied",
          "ignored"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "payment_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "maxLength": 512,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommercePaymentEvent"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "next_cursor",
              "has_more"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Provider facts and exceptions",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.payment.read",
  "effectiveSecurity": []
}

GET /api/v1/admin/payments

GET /api/v1/admin/payments

Payment attempts

{
  "parameters": [
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "maxLength": 512,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "status",
      "required": false,
      "schema": {
        "maxLength": 40,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "user_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "include_total",
      "required": false,
      "schema": {
        "enum": [
          "true",
          "false"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "enum": [
          "purchase",
          "renewal",
          "traffic_reset",
          "top_up"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "plan_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "channel_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "refund_state",
      "required": false,
      "schema": {
        "enum": [
          "none",
          "partial",
          "full"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_min",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_max",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_from",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_to",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "q",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page",
      "required": false,
      "schema": {
        "maximum": 10001,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "order",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "order_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommercePayment"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "next_cursor",
              "has_more"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Payment attempts",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.payment.read",
  "effectiveSecurity": []
}

GET /api/v1/admin/payments/{id}

GET /api/v1/admin/payments/{id}

Payment attempt

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommercePayment"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such payment"
    }
  },
  "summary": "Payment attempt",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.payment.read",
  "effectiveSecurity": []
}

POST /api/v1/admin/payments/{id}/sync

POST /api/v1/admin/payments/{id}/sync

Query a payment and settle its facts

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommercePayment"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Query a payment and settle its facts",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.payment.sync",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "optional",
  "x-permission": "commerce.payment.sync",
  "effectiveSecurity": []
}

GET /api/v1/admin/reconciliations

GET /api/v1/admin/reconciliations

Channel reconciliation runs

{
  "parameters": [
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "channel_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "digest": {
                      "type": "string"
                    },
                    "id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "period_end_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "period_start_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "row_count": {
                      "type": "integer"
                    },
                    "source": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "channel_id",
                    "period_start_at",
                    "period_end_at",
                    "source",
                    "digest",
                    "row_count",
                    "created_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Channel reconciliation runs",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.reconciliation.manage",
  "x-rate-limit": "commerce.reconciliation",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/reconciliations

POST /api/v1/admin/reconciliations

Import a complete CSV statement or pull a provider period

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "additionalProperties": false,
              "properties": {
                "channel_id": {
                  "format": "uuid",
                  "type": "string"
                },
                "csv": {
                  "maxLength": 1048576,
                  "type": "string"
                },
                "period_end_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "period_start_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "source": {
                  "enum": [
                    "csv"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "channel_id",
                "period_start_at",
                "period_end_at",
                "source",
                "csv"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "channel_id": {
                  "format": "uuid",
                  "type": "string"
                },
                "period_end_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "period_start_at": {
                  "format": "date-time",
                  "type": "string"
                },
                "source": {
                  "enum": [
                    "provider"
                  ],
                  "type": "string"
                }
              },
              "required": [
                "channel_id",
                "period_start_at",
                "period_end_at",
                "source"
              ],
              "type": "object"
            }
          ]
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "channel_id": {
                "format": "uuid",
                "type": "string"
              },
              "created_at": {
                "format": "date-time",
                "type": "string"
              },
              "digest": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "period_end_at": {
                "format": "date-time",
                "type": "string"
              },
              "period_start_at": {
                "format": "date-time",
                "type": "string"
              },
              "row_count": {
                "type": "integer"
              },
              "source": {
                "type": "string"
              }
            },
            "required": [
              "id",
              "channel_id",
              "period_start_at",
              "period_end_at",
              "source",
              "digest",
              "row_count",
              "created_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Conflicting statement snapshot"
    },
    "502": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Provider statement incomplete"
    }
  },
  "summary": "Import a complete CSV statement or pull a provider period",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.reconciliation.create",
  "x-body": "json",
  "x-body-limit": 1048576,
  "x-idempotency": "required",
  "x-permission": "commerce.reconciliation.manage",
  "x-rate-limit": "commerce.reconciliation",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/reconciliations/items/{id}/adjust

POST /api/v1/admin/reconciliations/items/{id}/adjust

Resolve a difference through the ledger adjustment command

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "pattern": "^[1-9]\\d{0,18}$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "amount_minor": {
              "pattern": "^-?[1-9]\\d{0,17}$",
              "type": "string"
            },
            "bucket": {
              "enum": [
                "cash",
                "gift"
              ],
              "type": "string"
            },
            "currency": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "reason": {
              "maxLength": 500,
              "minLength": 1,
              "type": "string"
            },
            "user_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "user_id",
            "bucket",
            "amount_minor",
            "currency",
            "reason"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "channel_id": {
                "format": "uuid",
                "type": "string"
              },
              "detail": {
                "additionalProperties": {},
                "type": "object"
              },
              "handled_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "outcome": {
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_payment_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "run_id": {
                "format": "uuid",
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "run_id",
              "channel_id",
              "outcome",
              "provider_payment_id",
              "payment_id",
              "refund_id",
              "detail",
              "status",
              "version",
              "handled_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "403": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Ledger adjustment permission required"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Difference changed"
    }
  },
  "summary": "Resolve a difference through the ledger adjustment command",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.reconciliation.adjust",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.reconciliation.manage",
  "x-rate-limit": "commerce.reconciliation",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/reconciliations/items/{id}/handle

POST /api/v1/admin/reconciliations/items/{id}/handle

Acknowledge or link a statement difference

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "pattern": "^[1-9]\\d{0,18}$",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "oneOf": [
            {
              "additionalProperties": false,
              "properties": {
                "action": {
                  "enum": [
                    "acknowledge"
                  ],
                  "type": "string"
                },
                "reason": {
                  "maxLength": 500,
                  "minLength": 1,
                  "type": "string"
                }
              },
              "required": [
                "action",
                "reason"
              ],
              "type": "object"
            },
            {
              "additionalProperties": false,
              "properties": {
                "action": {
                  "enum": [
                    "link"
                  ],
                  "type": "string"
                },
                "reason": {
                  "maxLength": 500,
                  "minLength": 1,
                  "type": "string"
                },
                "target_id": {
                  "format": "uuid",
                  "type": "string"
                }
              },
              "required": [
                "action",
                "target_id",
                "reason"
              ],
              "type": "object"
            }
          ]
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "channel_id": {
                "format": "uuid",
                "type": "string"
              },
              "detail": {
                "additionalProperties": {},
                "type": "object"
              },
              "handled_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "id": {
                "type": "string"
              },
              "outcome": {
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_payment_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "run_id": {
                "format": "uuid",
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "run_id",
              "channel_id",
              "outcome",
              "provider_payment_id",
              "payment_id",
              "refund_id",
              "detail",
              "status",
              "version",
              "handled_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Difference changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Acknowledge or link a statement difference",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.reconciliation.handle",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.reconciliation.manage",
  "x-rate-limit": "commerce.reconciliation",
  "x-reauth": true,
  "effectiveSecurity": []
}

GET /api/v1/admin/reconciliations/{id}/items

GET /api/v1/admin/reconciliations/{id}/items

Statement differences

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,19}$",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "channel_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "detail": {
                      "additionalProperties": {},
                      "type": "object"
                    },
                    "handled_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "id": {
                      "type": "string"
                    },
                    "outcome": {
                      "type": "string"
                    },
                    "payment_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "provider_payment_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "refund_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "run_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "version": {
                      "type": "integer"
                    }
                  },
                  "required": [
                    "id",
                    "run_id",
                    "channel_id",
                    "outcome",
                    "provider_payment_id",
                    "payment_id",
                    "refund_id",
                    "detail",
                    "status",
                    "version",
                    "handled_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Statement differences",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.reconciliation.manage",
  "x-rate-limit": "commerce.reconciliation",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/admin/refunds

GET /api/v1/admin/refunds

Balance refunds, including unapplied receipts

{
  "parameters": [
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "maxLength": 512,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "status",
      "required": false,
      "schema": {
        "maxLength": 40,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "user_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "include_total",
      "required": false,
      "schema": {
        "enum": [
          "true",
          "false"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "enum": [
          "purchase",
          "renewal",
          "traffic_reset",
          "top_up"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "plan_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "channel_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "refund_state",
      "required": false,
      "schema": {
        "enum": [
          "none",
          "partial",
          "full"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_min",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_max",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_from",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_to",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "q",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page",
      "required": false,
      "schema": {
        "maximum": 10001,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "order",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "order_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommerceRefund"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "next_cursor",
              "has_more"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Balance refunds, including unapplied receipts",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.refund.read",
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds

POST /api/v1/admin/refunds

Refund to cash and gift and reverse entitlements atomically

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "entitlement_action": {
              "enum": [
                "revoke",
                "shorten",
                "none"
              ],
              "type": "string"
            },
            "method": {
              "default": "balance",
              "enum": [
                "balance"
              ],
              "type": "string"
            },
            "order_id": {
              "format": "uuid",
              "type": "string"
            },
            "reason": {
              "maxLength": 1000,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "order_id",
            "amount_minor",
            "entitlement_action",
            "reason"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceRefund"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Order changed or not refundable"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Refund to cash and gift and reverse entitlements atomically",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.create",
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/original

POST /api/v1/admin/refunds/original

Request an original-route refund for approval

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "entitlement_action": {
              "enum": [
                "none",
                "revoke",
                "shorten"
              ],
              "type": "string"
            },
            "order_id": {
              "format": "uuid",
              "type": "string"
            },
            "reason": {
              "maxLength": 1000,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "order_id",
            "amount_minor",
            "entitlement_action",
            "reason"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "type": "string"
              },
              "next_attempt_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "order_id": {
                "format": "uuid",
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_refund_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_no": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "order_id",
              "payment_id",
              "refund_no",
              "method",
              "amount_minor",
              "currency",
              "status",
              "provider_refund_id",
              "attempts",
              "next_attempt_at",
              "last_error",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Order changed or refund not allowed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Request an original-route refund for approval",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.request",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.create",
  "x-rate-limit": "commerce.refund",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/original/preview

POST /api/v1/admin/refunds/original/preview

Preview original-route refund eligibility and locked provider amount

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "entitlement_action": {
              "enum": [
                "none",
                "revoke",
                "shorten"
              ],
              "type": "string"
            },
            "order_id": {
              "format": "uuid",
              "type": "string"
            },
            "reason": {
              "maxLength": 1000,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "order_id",
            "amount_minor",
            "entitlement_action",
            "reason"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "available_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "full": {
                "type": "boolean"
              },
              "fx_rate": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "payment_id": {
                "format": "uuid",
                "type": "string"
              },
              "provider_amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "provider_currency": {
                "type": "string"
              },
              "ratio_bps": {
                "type": "integer"
              }
            },
            "required": [
              "available_minor",
              "provider_amount_minor",
              "provider_currency",
              "fx_rate",
              "payment_id",
              "full",
              "ratio_bps"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Preview original-route refund eligibility and locked provider amount",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.preview",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "none",
  "x-permission": "commerce.refund.create",
  "x-rate-limit": "commerce.refund",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/preview

POST /api/v1/admin/refunds/preview

Preview a source-split refund

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "entitlement_action": {
              "enum": [
                "revoke",
                "shorten",
                "none"
              ],
              "type": "string"
            },
            "method": {
              "default": "balance",
              "enum": [
                "balance"
              ],
              "type": "string"
            },
            "order_id": {
              "format": "uuid",
              "type": "string"
            },
            "reason": {
              "maxLength": 1000,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "order_id",
            "amount_minor",
            "entitlement_action",
            "reason"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "available_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "cash_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "entitlement_action": {
                "type": "string"
              },
              "full": {
                "type": "boolean"
              },
              "gift_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "ratio_bps": {
                "type": "integer"
              }
            },
            "required": [
              "available_minor",
              "cash_minor",
              "gift_minor",
              "full",
              "ratio_bps",
              "entitlement_action"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Preview a source-split refund",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.preview",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "none",
  "x-permission": "commerce.refund.create",
  "effectiveSecurity": []
}

GET /api/v1/admin/refunds/{id}

GET /api/v1/admin/refunds/{id}

Refund details

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceRefund"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Refund details",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.refund.read",
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/{id}/approve

POST /api/v1/admin/refunds/{id}/approve

Approve an original-route refund

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "type": "string"
              },
              "next_attempt_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "order_id": {
                "format": "uuid",
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_refund_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_no": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "order_id",
              "payment_id",
              "refund_no",
              "method",
              "amount_minor",
              "currency",
              "status",
              "provider_refund_id",
              "attempts",
              "next_attempt_at",
              "last_error",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Refund changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Approve an original-route refund",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.approve",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.approve",
  "x-rate-limit": "commerce.refund",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/{id}/cancel

POST /api/v1/admin/refunds/{id}/cancel

Reject a requested original-route refund

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "type": "string"
              },
              "next_attempt_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "order_id": {
                "format": "uuid",
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_refund_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_no": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "order_id",
              "payment_id",
              "refund_no",
              "method",
              "amount_minor",
              "currency",
              "status",
              "provider_refund_id",
              "attempts",
              "next_attempt_at",
              "last_error",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Refund changed"
    }
  },
  "summary": "Reject a requested original-route refund",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.cancel",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.approve",
  "x-rate-limit": "commerce.refund",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/{id}/confirm-manual

POST /api/v1/admin/refunds/{id}/confirm-manual

Execute a previously previewed manual refund confirmation

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "expected_version": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            },
            "repair_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "repair_id",
            "expected_version"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "type": "string"
              },
              "next_attempt_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "order_id": {
                "format": "uuid",
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_refund_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_no": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "order_id",
              "payment_id",
              "refund_no",
              "method",
              "amount_minor",
              "currency",
              "status",
              "provider_refund_id",
              "attempts",
              "next_attempt_at",
              "last_error",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Preview stale or expired"
    }
  },
  "summary": "Execute a previously previewed manual refund confirmation",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.confirm_manual",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.approve",
  "x-rate-limit": "commerce.refund",
  "x-reauth": true,
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/{id}/manual-preview

POST /api/v1/admin/refunds/{id}/manual-preview

Preview receipt-backed manual refund confirmation

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "currency": {
              "pattern": "^[A-Z]{3}$",
              "type": "string"
            },
            "external_reference": {
              "maxLength": 200,
              "minLength": 1,
              "type": "string"
            },
            "paid_at": {
              "format": "date-time",
              "type": "string"
            },
            "reason": {
              "maxLength": 500,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "external_reference",
            "amount_minor",
            "currency",
            "paid_at",
            "reason"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "expected_version": {
                "type": "string"
              },
              "external_reference": {
                "type": "string"
              },
              "preview_expires_at": {
                "format": "date-time",
                "type": "string"
              },
              "provider_amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "provider_currency": {
                "type": "string"
              },
              "refund_id": {
                "format": "uuid",
                "type": "string"
              },
              "repair_id": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "repair_id",
              "expected_version",
              "preview_expires_at",
              "refund_id",
              "provider_amount_minor",
              "provider_currency",
              "external_reference"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Preview receipt-backed manual refund confirmation",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.manual_preview",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.approve",
  "x-rate-limit": "commerce.refund",
  "x-reauth": true,
  "effectiveSecurity": []
}

GET /api/v1/admin/refunds/{id}/provider

GET /api/v1/admin/refunds/{id}/provider

Refund provider status, immutable amount and retry history

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "fx_rate": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "history": {
                "items": {
                  "properties": {
                    "created_at": {
                      "format": "date-time",
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  },
                  "required": [
                    "id",
                    "status",
                    "created_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "type": "string"
              },
              "next_attempt_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "order_id": {
                "format": "uuid",
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "provider_currency": {
                "type": "string"
              },
              "provider_refund_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "receipt": {
                "properties": {
                  "amount_minor": {
                    "pattern": "^\\d{1,18}$",
                    "type": "string"
                  },
                  "currency": {
                    "type": "string"
                  },
                  "external_reference": {
                    "type": "string"
                  },
                  "paid_at": {
                    "format": "date-time",
                    "type": "string"
                  }
                },
                "required": [
                  "external_reference",
                  "amount_minor",
                  "currency",
                  "paid_at"
                ],
                "type": [
                  "object",
                  "null"
                ]
              },
              "refund_address": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_no": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "order_id",
              "payment_id",
              "refund_no",
              "method",
              "amount_minor",
              "currency",
              "status",
              "provider_refund_id",
              "attempts",
              "next_attempt_at",
              "last_error",
              "version",
              "provider_amount_minor",
              "provider_currency",
              "refund_address",
              "fx_rate",
              "receipt",
              "history"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Refund not found"
    }
  },
  "summary": "Refund provider status, immutable amount and retry history",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-permission": "commerce.refund.read",
  "x-rate-limit": "commerce.refund",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/admin/refunds/{id}/retry

POST /api/v1/admin/refunds/{id}/retry

Retry querying a failed refund

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "attempts": {
                "type": "integer"
              },
              "currency": {
                "type": "string"
              },
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "last_error": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "method": {
                "type": "string"
              },
              "next_attempt_at": {
                "format": "date-time",
                "type": [
                  "string",
                  "null"
                ]
              },
              "order_id": {
                "format": "uuid",
                "type": "string"
              },
              "payment_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              },
              "provider_refund_id": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "refund_no": {
                "type": "string"
              },
              "status": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "id",
              "order_id",
              "payment_id",
              "refund_no",
              "method",
              "amount_minor",
              "currency",
              "status",
              "provider_refund_id",
              "attempts",
              "next_attempt_at",
              "last_error",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Refund changed"
    }
  },
  "summary": "Retry querying a failed refund",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.refund.retry",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "required",
  "x-permission": "commerce.refund.approve",
  "x-rate-limit": "commerce.refund",
  "x-reauth": true,
  "effectiveSecurity": []
}

GET /api/v1/me/apple/account-token

GET /api/v1/me/apple/account-token

Stable StoreKit appAccountToken

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "app_account_token": {
                "format": "uuid",
                "type": "string"
              }
            },
            "required": [
              "app_account_token"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Stable StoreKit appAccountToken",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/me/apple/subscriptions

GET /api/v1/me/apple/subscriptions

My Apple subscriptions

{
  "parameters": [
    {
      "in": "query",
      "name": "environment",
      "required": false,
      "schema": {
        "default": "production",
        "enum": [
          "sandbox",
          "production"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,64}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "properties": {
                    "auto_renew": {
                      "type": "boolean"
                    },
                    "current_product_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "current_transaction_id": {
                      "pattern": "^\\d{1,64}$",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "environment": {
                      "enum": [
                        "sandbox",
                        "production"
                      ],
                      "type": "string"
                    },
                    "grace_expires_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "last_signed_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "last_synced_at": {
                      "format": "date-time",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "next_product_id": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "original_transaction_id": {
                      "pattern": "^\\d{1,64}$",
                      "type": "string"
                    },
                    "state": {
                      "enum": [
                        "pending",
                        "active",
                        "grace",
                        "billing_retry",
                        "expired",
                        "revoked"
                      ],
                      "type": "string"
                    },
                    "subscription_id": {
                      "format": "uuid",
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "user_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "environment",
                    "original_transaction_id",
                    "user_id",
                    "subscription_id",
                    "current_transaction_id",
                    "current_product_id",
                    "next_product_id",
                    "state",
                    "auto_renew",
                    "grace_expires_at",
                    "last_signed_at",
                    "last_synced_at"
                  ],
                  "type": "object"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "items",
              "has_more",
              "next_cursor"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "My Apple subscriptions",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/apple/transactions

POST /api/v1/me/apple/transactions

Restore or verify an Apple purchase

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "environment": {
              "enum": [
                "sandbox",
                "production"
              ],
              "type": "string"
            },
            "transaction_id": {
              "pattern": "^\\d{1,64}$",
              "type": "string"
            }
          },
          "required": [
            "environment",
            "transaction_id"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "stale": {
                "type": "boolean"
              },
              "subscription_id": {
                "format": "uuid",
                "type": [
                  "string",
                  "null"
                ]
              }
            },
            "required": [
              "subscription_id",
              "stale"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Restore or verify an Apple purchase",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.apple.purchase",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/me/orders

GET /api/v1/me/orders

My orders

{
  "parameters": [
    {
      "in": "query",
      "name": "page_size",
      "required": false,
      "schema": {
        "default": 20,
        "maximum": 100,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "cursor",
      "required": false,
      "schema": {
        "maxLength": 512,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "status",
      "required": false,
      "schema": {
        "maxLength": 40,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "user_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "include_total",
      "required": false,
      "schema": {
        "enum": [
          "true",
          "false"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "kind",
      "required": false,
      "schema": {
        "enum": [
          "purchase",
          "renewal",
          "traffic_reset",
          "top_up"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "plan_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "channel_id",
      "required": false,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "refund_state",
      "required": false,
      "schema": {
        "enum": [
          "none",
          "partial",
          "full"
        ],
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_min",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "amount_max",
      "required": false,
      "schema": {
        "pattern": "^\\d{1,18}$",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_from",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "created_to",
      "required": false,
      "schema": {
        "format": "date-time",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "q",
      "required": false,
      "schema": {
        "maxLength": 64,
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "page",
      "required": false,
      "schema": {
        "maximum": 10001,
        "minimum": 1,
        "type": "integer"
      }
    },
    {
      "in": "query",
      "name": "order",
      "required": false,
      "schema": {
        "enum": [
          "asc",
          "desc"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "has_more": {
                "type": "boolean"
              },
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommerceOrder"
                },
                "type": "array"
              },
              "next_cursor": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "total": {
                "type": "integer"
              }
            },
            "required": [
              "items",
              "next_cursor",
              "has_more"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "My orders",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "effectiveSecurity": []
}

POST /api/v1/me/orders

POST /api/v1/me/orders

Create an order

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "activation_mode": {
              "enum": [
                "immediate",
                "queued"
              ],
              "type": "string"
            },
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "channel_id": {
              "format": "uuid",
              "type": "string"
            },
            "code": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "coupon": {
              "enum": [
                "none"
              ],
              "type": "string"
            },
            "kind": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "top_up"
              ],
              "type": "string"
            },
            "plan_id": {
              "format": "uuid",
              "type": "string"
            },
            "price_id": {
              "format": "uuid",
              "type": "string"
            },
            "quote_fingerprint": {
              "pattern": "^[a-f0-9]{64}$",
              "type": "string"
            },
            "subscription_id": {
              "format": "uuid",
              "type": "string"
            },
            "use_gift": {
              "type": "boolean"
            },
            "user_code_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "kind"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Order conflict"
    }
  },
  "summary": "Create an order",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.order.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-rate-limit": "commerce.checkout",
  "effectiveSecurity": []
}

POST /api/v1/me/orders/quote

POST /api/v1/me/orders/quote

Quote a purchase or renewal

{
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "properties": {
            "activation_mode": {
              "enum": [
                "immediate",
                "queued"
              ],
              "type": "string"
            },
            "amount_minor": {
              "pattern": "^\\d{1,18}$",
              "type": "string"
            },
            "channel_id": {
              "format": "uuid",
              "type": "string"
            },
            "code": {
              "maxLength": 64,
              "minLength": 1,
              "type": "string"
            },
            "coupon": {
              "enum": [
                "none"
              ],
              "type": "string"
            },
            "kind": {
              "enum": [
                "purchase",
                "renewal",
                "traffic_reset",
                "top_up"
              ],
              "type": "string"
            },
            "plan_id": {
              "format": "uuid",
              "type": "string"
            },
            "price_id": {
              "format": "uuid",
              "type": "string"
            },
            "quote_fingerprint": {
              "pattern": "^[a-f0-9]{64}$",
              "type": "string"
            },
            "subscription_id": {
              "format": "uuid",
              "type": "string"
            },
            "use_gift": {
              "type": "boolean"
            },
            "user_code_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "kind"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceQuote"
          }
        }
      },
      "description": "Result"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote unavailable"
    }
  },
  "summary": "Quote a purchase or renewal",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.quote",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "effectiveSecurity": []
}

GET /api/v1/me/orders/{id}

GET /api/v1/me/orders/{id}

My order

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "304": {
      "description": "Unchanged"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such order"
    }
  },
  "summary": "My order",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "effectiveSecurity": []
}

POST /api/v1/me/orders/{id}/cancel

POST /api/v1/me/orders/{id}/cancel

Cancel my unpaid order

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such order"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Order changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Cancel my unpaid order",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.order.cancel",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "optional",
  "effectiveSecurity": []
}

POST /api/v1/me/orders/{id}/combined-payments

POST /api/v1/me/orders/{id}/combined-payments

Reserve cash and start one online payment

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "balance_minor": {
              "pattern": "^[1-9]\\d{0,17}$",
              "type": "string"
            },
            "channel_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "channel_id",
            "balance_minor"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommercePayment"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Checkout unavailable or no such order"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Payment conflict"
    },
    "422": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Invalid allocation"
    },
    "502": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Channel error"
    }
  },
  "summary": "Reserve cash and start one online payment",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.payment.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-mfa": true,
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/orders/{id}/pay-with-balance

POST /api/v1/me/orders/{id}/pay-with-balance

Pay an order with cash balance

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such order"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Insufficient balance or order not payable"
    }
  },
  "summary": "Pay an order with cash balance",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.order.pay_balance",
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "required",
  "x-mfa": true,
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/orders/{id}/payments

POST /api/v1/me/orders/{id}/payments

Start a channel payment

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "channel_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "channel_id"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommercePayment"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such order"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Order not payable"
    },
    "502": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Channel unavailable"
    }
  },
  "summary": "Start a channel payment",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.payment.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "required",
  "x-rate-limit": "commerce.checkout",
  "effectiveSecurity": []
}

POST /api/v1/me/orders/{id}/plan-change/pay-balance

POST /api/v1/me/orders/{id}/plan-change/pay-balance

Pay a plan change with all source wallets locked first

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "description": "Resource ETag; missing 428, malformed 412, stale 409.",
      "in": "header",
      "name": "If-Match",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Pay a plan change with all source wallets locked first",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.plan_change.pay",
  "x-body": "none",
  "x-body-limit": 0,
  "x-concurrency": {
    "etag": false,
    "ifMatch": true
  },
  "x-idempotency": "required",
  "x-mfa": true,
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/me/orders/{id}/receipt

GET /api/v1/me/orders/{id}/receipt

Immutable paid-order receipt

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceReceipt"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such receipt"
    }
  },
  "summary": "Immutable paid-order receipt",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/me/orders/{id}/receipt.pdf

GET /api/v1/me/orders/{id}/receipt.pdf

Download immutable PDF receipt

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "in": "query",
      "name": "locale",
      "required": false,
      "schema": {
        "default": "zh-CN",
        "enum": [
          "zh-CN",
          "en-US"
        ],
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/pdf": {
          "schema": {
            "format": "binary",
            "type": "string"
          }
        }
      },
      "description": "PDF receipt"
    },
    "304": {
      "description": "Private cached receipt unchanged"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "No such receipt"
    },
    "503": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Private storage unavailable"
    }
  },
  "summary": "Download immutable PDF receipt",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/change

POST /api/v1/me/subscriptions/{id}/change

Create a server-priced plan-change checkout order

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "description": "Resource ETag; missing 428, malformed 412, stale 409.",
      "in": "header",
      "name": "If-Match",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "quote_fingerprint": {
              "pattern": "^[a-f0-9]{64}$",
              "type": "string"
            },
            "target_plan_id": {
              "format": "uuid",
              "type": "string"
            },
            "target_price_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "target_plan_id",
            "target_price_id",
            "quote_fingerprint"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "201": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/CommerceOrder"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Create a server-priced plan-change checkout order",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.plan_change.create",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-concurrency": {
    "etag": false,
    "ifMatch": true
  },
  "x-idempotency": "required",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/me/subscriptions/{id}/change-paths

GET /api/v1/me/subscriptions/{id}/change-paths

Allowed target price options for an owned subscription

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "properties": {
                    "direction": {
                      "enum": [
                        "upgrade",
                        "downgrade"
                      ],
                      "type": "string"
                    },
                    "source_price_id": {
                      "format": "uuid",
                      "type": "string"
                    },
                    "target_price_id": {
                      "format": "uuid",
                      "type": "string"
                    }
                  },
                  "required": [
                    "source_price_id",
                    "target_price_id",
                    "direction"
                  ],
                  "type": "object"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    }
  },
  "summary": "Allowed target price options for an owned subscription",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/change/preview

POST /api/v1/me/subscriptions/{id}/change/preview

Quote an allowed plan change

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "target_plan_id": {
              "format": "uuid",
              "type": "string"
            },
            "target_price_id": {
              "format": "uuid",
              "type": "string"
            }
          },
          "required": [
            "target_plan_id",
            "target_price_id"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "applied_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "balance_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "credit_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "direction": {
                "enum": [
                  "upgrade",
                  "downgrade"
                ],
                "type": "string"
              },
              "due_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "effective_at": {
                "format": "date-time",
                "type": "string"
              },
              "excess_policy": {
                "enum": [
                  "balance",
                  "forfeit"
                ],
                "type": "string"
              },
              "fingerprint": {
                "type": "string"
              },
              "forfeited_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "subscription_id": {
                "format": "uuid",
                "type": "string"
              },
              "target_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "subscription_id",
              "version",
              "currency",
              "direction",
              "effective_at",
              "target_minor",
              "credit_minor",
              "applied_minor",
              "due_minor",
              "balance_minor",
              "forfeited_minor",
              "excess_policy",
              "fingerprint"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    }
  },
  "summary": "Quote an allowed plan change",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.plan_change.preview",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/paid-reset/preview

POST /api/v1/me/subscriptions/{id}/paid-reset/preview

Quote paid traffic reset with rounding and minimum

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {},
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "amount_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "amount_minor",
              "currency",
              "version"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    }
  },
  "summary": "Quote paid traffic reset with rounding and minimum",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.paid_reset.preview",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/unsubscribe

POST /api/v1/me/subscriptions/{id}/unsubscribe

Refund and end a subscription, or request original-route staff approval

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    },
    {
      "description": "Resource ETag; missing 428, malformed 412, stale 409.",
      "in": "header",
      "name": "If-Match",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {
            "quote_fingerprint": {
              "pattern": "^[a-f0-9]{64}$",
              "type": "string"
            },
            "reason": {
              "maxLength": 1000,
              "minLength": 1,
              "type": "string"
            }
          },
          "required": [
            "reason",
            "quote_fingerprint"
          ],
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "id": {
                "format": "uuid",
                "type": "string"
              },
              "state": {
                "enum": [
                  "awaiting_payment",
                  "scheduled",
                  "pending",
                  "completed",
                  "failed",
                  "cancelled"
                ],
                "type": "string"
              }
            },
            "required": [
              "id",
              "state"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    },
    "428": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "If-Match required"
    }
  },
  "summary": "Refund and end a subscription, or request original-route staff approval",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.unsubscribe.execute",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-concurrency": {
    "etag": false,
    "ifMatch": true
  },
  "x-idempotency": "required",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

POST /api/v1/me/subscriptions/{id}/unsubscribe/preview

POST /api/v1/me/subscriptions/{id}/unsubscribe/preview

Quote remaining refundable subscription value

{
  "parameters": [
    {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
        "format": "uuid",
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "additionalProperties": false,
          "properties": {},
          "type": "object"
        }
      }
    },
    "required": true
  },
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "credit_minor": {
                "pattern": "^\\d{1,18}$",
                "type": "string"
              },
              "currency": {
                "type": "string"
              },
              "fingerprint": {
                "type": "string"
              },
              "method": {
                "enum": [
                  "balance",
                  "original"
                ],
                "type": "string"
              },
              "quoted_at": {
                "format": "date-time",
                "type": "string"
              },
              "subscription_id": {
                "format": "uuid",
                "type": "string"
              },
              "version": {
                "type": "integer"
              }
            },
            "required": [
              "subscription_id",
              "version",
              "currency",
              "credit_minor",
              "method",
              "fingerprint",
              "quoted_at"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    },
    "404": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Subscription not found"
    },
    "409": {
      "content": {
        "application/problem+json": {
          "schema": {
            "$ref": "#/components/schemas/Problem"
          }
        }
      },
      "description": "Quote, path or version changed"
    }
  },
  "summary": "Quote remaining refundable subscription value",
  "tags": [
    "commerce"
  ],
  "x-audit": "commerce.unsubscribe.preview",
  "x-body": "json",
  "x-body-limit": 65536,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/public/checkout

GET /api/v1/public/checkout

Combined checkout availability

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "combined_payment": {
                "type": "boolean"
              }
            },
            "required": [
              "combined_payment"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Combined checkout availability",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "x-rate-limit": "commerce.checkout",
  "x-reauth": false,
  "effectiveSecurity": []
}

GET /api/v1/public/payment-channels

GET /api/v1/public/payment-channels

Enabled checkout channels

{
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "items": {
                "items": {
                  "$ref": "#/components/schemas/CommercePublicChannel"
                },
                "type": "array"
              }
            },
            "required": [
              "items"
            ],
            "type": "object"
          }
        }
      },
      "description": "Result"
    }
  },
  "summary": "Enabled checkout channels",
  "tags": [
    "commerce"
  ],
  "x-body": "none",
  "x-body-limit": 0,
  "x-idempotency": "none",
  "effectiveSecurity": []
}

本页目录

GET /api/v1/admin/apple/subscriptionsGET /api/v1/admin/apple/subscriptions/{originalTransactionId}/receiptsPOST /api/v1/admin/apple/subscriptions/{originalTransactionId}/syncGET /api/v1/admin/ordersGET /api/v1/admin/orders/{id}POST /api/v1/admin/orders/{id}/cancelGET /api/v1/admin/orders/{id}/receiptGET /api/v1/admin/orders/{id}/receipt.pdfGET /api/v1/admin/payment-channelsPOST /api/v1/admin/payment-channelsPOST /api/v1/admin/payment-channels/reorderDELETE /api/v1/admin/payment-channels/{id}GET /api/v1/admin/payment-channels/{id}PUT /api/v1/admin/payment-channels/{id}GET /api/v1/admin/payment-channels/{id}/secretPOST /api/v1/admin/payment-channels/{id}/testGET /api/v1/admin/payment-eventsGET /api/v1/admin/paymentsGET /api/v1/admin/payments/{id}POST /api/v1/admin/payments/{id}/syncGET /api/v1/admin/reconciliationsPOST /api/v1/admin/reconciliationsPOST /api/v1/admin/reconciliations/items/{id}/adjustPOST /api/v1/admin/reconciliations/items/{id}/handleGET /api/v1/admin/reconciliations/{id}/itemsGET /api/v1/admin/refundsPOST /api/v1/admin/refundsPOST /api/v1/admin/refunds/originalPOST /api/v1/admin/refunds/original/previewPOST /api/v1/admin/refunds/previewGET /api/v1/admin/refunds/{id}POST /api/v1/admin/refunds/{id}/approvePOST /api/v1/admin/refunds/{id}/cancelPOST /api/v1/admin/refunds/{id}/confirm-manualPOST /api/v1/admin/refunds/{id}/manual-previewGET /api/v1/admin/refunds/{id}/providerPOST /api/v1/admin/refunds/{id}/retryGET /api/v1/me/apple/account-tokenGET /api/v1/me/apple/subscriptionsPOST /api/v1/me/apple/transactionsGET /api/v1/me/ordersPOST /api/v1/me/ordersPOST /api/v1/me/orders/quoteGET /api/v1/me/orders/{id}POST /api/v1/me/orders/{id}/cancelPOST /api/v1/me/orders/{id}/combined-paymentsPOST /api/v1/me/orders/{id}/pay-with-balancePOST /api/v1/me/orders/{id}/paymentsPOST /api/v1/me/orders/{id}/plan-change/pay-balanceGET /api/v1/me/orders/{id}/receiptGET /api/v1/me/orders/{id}/receipt.pdfPOST /api/v1/me/subscriptions/{id}/changeGET /api/v1/me/subscriptions/{id}/change-pathsPOST /api/v1/me/subscriptions/{id}/change/previewPOST /api/v1/me/subscriptions/{id}/paid-reset/previewPOST /api/v1/me/subscriptions/{id}/unsubscribePOST /api/v1/me/subscriptions/{id}/unsubscribe/previewGET /api/v1/public/checkoutGET /api/v1/public/payment-channels