---
search:
  tags:
    - テスト購入
    - POST
seo:
  description: >-
    サンドボックス専用（それ以外は404）。必要なスコープ:… Reference for the POST
    /products/{product_id}/test-purchase/refund endpoint in the Cozeni 外部 API.
sidebar:
  label: テスト購入を返金する（サンドボックスのみ）
  badge: POST
title: テスト購入を返金する（サンドボックスのみ）
type: openapi-operation
---
サンドボックス専用（それ以外は404）。必要なスコープ: products:write。本文なし。キーの所有者本人が購入者の、その商品の成立済みの注文をすべて返金する。購入権の失効は返金のWebhookの経路で行う（この要求ではDBを書かない）。対象が無ければ200（nothing_to_refund）で、打ち直しても失敗しない。

`POST /products/{product_id}/test-purchase/refund`

**Responses**

- `200` — 返金を依頼した（refunded）、または対象が無い（nothing\_to\_refund）。
- `400` — invalid\_input。未知フィールド、無効なcursor・入力を含む。
- `401` — unauthorized。失効、期限切れ、環境違いを含む。
- `403` — insufficient\_scope。
- `404` — not\_found（サンドボックス以外）/ product\_not\_found（他人の商品・存在しない商品）。
- `409` — creator\_not\_ready（売上の受け取り先が未登録・販売者の情報が未承認など。blockers は GET /account の sales.blockers と同じ）/ product\_archived / checkout\_link\_disabled / subscription\_not\_supported（サブスクの商品はテスト購入できない）。
- `429` — rate\_limited。
- `500` — internal。
- `502` — stripe\_error。Stripe の処理に失敗した。打ち直せる。
- `503` — unavailable。

Response example, 200:

```json
{
  "status": "refunded",
  "refund_count": 0
}
```
