メインコンテンツへスキップ
サブスクリプション商品のコンテンツを更新します。コンテンツが変更された場合、新しいイミュータブルバージョンが自動的に作成されます。コンテンツが現在のバージョンと同一の場合、新しいバージョンは作成されません。
POST /v1/actions/subscription-product/update-product
認証: API Key

リクエストボディ

フィールド必須説明
idstringYes商品 ID(PROD_xxx フォーマット)
namestringNo更新後の商品名(64 文字以下)
billingPeriodstringNoweeklymonthlyquarterly、または yearly
pricesobjectNo更新後のマルチ通貨価格
descriptionstring | nullNo更新後の説明(null または "" で消去可能)
mediaarrayNo更新後のメディア
successUrlstring | nullNo更新後のリダイレクト URL(512 文字以下、有効な http(s) URL であること;null または "" で消去可能)
metadataobjectNo更新後のメタデータ(trialDays を含む場合あり)

リクエスト例

const { product } = await client.subscriptionProducts.update({
  id: "PROD_3F7H2J5L8N1Q4S6U",
  name: "Pro Plan v2",
  billingPeriod: BillingPeriod.Monthly,
  prices: {
    USD: { amount: "39.00", taxIncluded: false, taxCategory: TaxCategory.SaaS },
    EUR: { amount: "36.00", taxIncluded: false, taxCategory: TaxCategory.SaaS },
  },
  metadata: { trialDays: 7 },
});
// Uses callApi() helper from authentication.mdx
const result = await callApi("POST", "/v1/actions/subscription-product/update-product", {
  id: "PROD_3F7H2J5L8N1Q4S6U",
  name: "Pro Plan v2",
  billingPeriod: "monthly",
  prices: {
    USD: { amount: "39.00", taxIncluded: false, taxCategory: "saas" },
    EUR: { amount: "36.00", taxIncluded: false, taxCategory: "saas" },
  },
  metadata: { trialDays: 7 },
});
console.log(result.data);
// Uses callApi() helper from authentication.mdx
String body = """
    {"id":"PROD_3F7H2J5L8N1Q4S6U","name":"Pro Plan v2","billingPeriod":"monthly","prices":{"USD":{"amount":"39.00","taxIncluded":false,"taxCategory":"saas"},"EUR":{"amount":"36.00","taxIncluded":false,"taxCategory":"saas"}},"metadata":{"trialDays":7}}""";

String response = callApi("POST", "/v1/actions/subscription-product/update-product", body);
System.out.println(response);
# Uses call_api() helper from authentication.mdx
result = call_api("POST", "/v1/actions/subscription-product/update-product", {
    "id": "PROD_3F7H2J5L8N1Q4S6U",
    "name": "Pro Plan v2",
    "billingPeriod": "monthly",
    "prices": {
        "USD": {"amount": "39.00", "taxIncluded": False, "taxCategory": "saas"},
        "EUR": {"amount": "36.00", "taxIncluded": False, "taxCategory": "saas"},
    },
    "metadata": {"trialDays": 7},
})
print(result["data"])
// Uses callAPI() helper from authentication.mdx
body := map[string]interface{}{
    "id":            "PROD_3F7H2J5L8N1Q4S6U",
    "name":          "Pro Plan v2",
    "billingPeriod": "monthly",
    "prices": map[string]interface{}{
        "USD": map[string]interface{}{"amount": "39.00", "taxIncluded": false, "taxCategory": "saas"},
        "EUR": map[string]interface{}{"amount": "36.00", "taxIncluded": false, "taxCategory": "saas"},
    },
    "metadata": map[string]interface{}{"trialDays": 7},
}
result, err := callAPI("POST", "/v1/actions/subscription-product/update-product", body)
if err != nil {
    log.Fatal(err)
}
fmt.Println(string(result))
// Uses call_api() helper from authentication.mdx
let body = serde_json::json!({
    "id": "PROD_3F7H2J5L8N1Q4S6U",
    "name": "Pro Plan v2",
    "billingPeriod": "monthly",
    "prices": {
        "USD": {"amount": "39.00", "taxIncluded": false, "taxCategory": "saas"},
        "EUR": {"amount": "36.00", "taxIncluded": false, "taxCategory": "saas"}
    },
    "metadata": {"trialDays": 7}
});
let result = call_api("POST", "/v1/actions/subscription-product/update-product", &body).await?;
println!("{}", result);
/* Uses call_api() helper from authentication.mdx */
const char *body = "{\"id\":\"PROD_3F7H2J5L8N1Q4S6U\",\"name\":\"Pro Plan v2\",\"billingPeriod\":\"monthly\",\"prices\":{\"USD\":{\"amount\":\"39.00\",\"taxIncluded\":false,\"taxCategory\":\"saas\"},\"EUR\":{\"amount\":\"36.00\",\"taxIncluded\":false,\"taxCategory\":\"saas\"}},\"metadata\":{\"trialDays\":7}}";
char *response = call_api("POST", "/v1/actions/subscription-product/update-product", body);
printf("%s\n", response);
free(response);
// Uses callApi() helper from authentication.mdx
std::string body = R"({"id":"PROD_3F7H2J5L8N1Q4S6U","name":"Pro Plan v2","billingPeriod":"monthly","prices":{"USD":{"amount":"39.00","taxIncluded":false,"taxCategory":"saas"},"EUR":{"amount":"36.00","taxIncluded":false,"taxCategory":"saas"}},"metadata":{"trialDays":7}})";
std::string response = callApi("POST", "/v1/actions/subscription-product/update-product", body);
std::cout << response << std::endl;
MERCHANT_ID="MER_2aUyqjCzEIiEcYMKj7TZtw"
TIMESTAMP=$(date +%s)
BODY='{
  "id": "PROD_3F7H2J5L8N1Q4S6U",
  "name": "Pro Plan v2",
  "billingPeriod": "monthly",
  "prices": {
    "USD": { "amount": "39.00", "taxIncluded": false, "taxCategory": "saas" },
    "EUR": { "amount": "36.00", "taxIncluded": false, "taxCategory": "saas" }
  },
  "metadata": { "trialDays": 7 }
}'
BODY_HASH=$(echo -n "$BODY" | openssl dgst -sha256 -binary | base64 -w 0)
CANONICAL_REQUEST="POST
/v1/actions/subscription-product/update-product
$TIMESTAMP
$BODY_HASH"

SIGNATURE=$(echo -n "$CANONICAL_REQUEST" | openssl dgst -sha256 -sign private_key.pem | base64 -w 0)

curl -X POST "https://api.waffo.ai/v1/actions/subscription-product/update-product" \
  -H "Content-Type: application/json" \
  -H "X-Merchant-Id: $MERCHANT_ID" \
  -H "X-Timestamp: $TIMESTAMP" \
  -H "X-Signature: $SIGNATURE" \
  -d "$BODY"
MERCHANT_ID="MER_2aUyqjCzEIiEcYMKj7TZtw"
TIMESTAMP=$(date +%s)
BODY='{
  "id": "PROD_3F7H2J5L8N1Q4S6U",
  "name": "Pro Plan v2",
  "billingPeriod": "monthly",
  "prices": {
    "USD": { "amount": "39.00", "taxIncluded": false, "taxCategory": "saas" },
    "EUR": { "amount": "36.00", "taxIncluded": false, "taxCategory": "saas" }
  },
  "metadata": { "trialDays": 7 }
}'
BODY_HASH=$(echo -n "$BODY" | openssl dgst -sha256 -binary | base64 -w 0)
CANONICAL_REQUEST="POST
/v1/actions/subscription-product/update-product
$TIMESTAMP
$BODY_HASH"

SIGNATURE=$(echo -n "$CANONICAL_REQUEST" | openssl dgst -sha256 -sign private_key.pem | base64 -w 0)

wget -qO- "https://api.waffo.ai/v1/actions/subscription-product/update-product" \
  --header="Content-Type: application/json" \
  --header="X-Merchant-Id: $MERCHANT_ID" \
  --header="X-Timestamp: $TIMESTAMP" \
  --header="X-Signature: $SIGNATURE" \
  --post-data="$BODY"

成功レスポンス (200)

{
  "data": {
    "product": {
      "id": "PROD_3F7H2J5L8N1Q4S6U",
      "storeId": "STO_2D5F8G3H1K4M6N9P",
      "name": "Pro Plan v2",
      "description": null,
      "billingPeriod": "monthly",
      "prices": {
        "USD": { "amount": "39.00", "taxCategory": "saas" },
        "EUR": { "amount": "36.00", "taxCategory": "saas" }
      },
      "media": [],
      "successUrl": null,
      "metadata": { "trialDays": 7 },
      "status": "active",
      "createdAt": "2026-03-30T10:30:00.000Z",
      "updatedAt": "2026-03-30T11:00:00.000Z"
    }
  }
}

レスポンスフィールド

サブスクリプション商品の作成レスポンスと同じです。
商品の更新は新しいイミュータブルバージョンを作成します。既存のサブスクリプションは元のバージョンを保持します。新規登録は最新バージョンを使用します。送信されたコンテンツが現在のバージョンと同一の場合、新しいバージョンは作成されません。

エラー

リトライポリシー:4xx は一切リトライしない — リクエストを修正してから再送信。5xx は指数バックオフでリトライ(5s 開始、最大 3 回)。
ステータスerrors[0].message意味推奨処理
400Missing header: x-context-merchant-idマーチャントコンテキスト header が転送されていないSDK 設定を修正
400Missing or invalid header: x-context-environment環境 header が欠落、または test / prod ではないX-Environmenttest または prod に設定
400Missing required field: idリクエストボディに id が含まれないid を追加して再送信
400Expected format: PROD_xxx, got "X"id が正しい Short ID ではないPROD_ 接頭辞付きの Short ID を使用
400Field name must be a non-empty string空文字列の name を渡したname を省略すれば元の値を保持、または非空文字列を渡す
400Invalid billingPeriodbillingPeriodweekly / monthly / quarterly / yearly の集合に含まれない4 つの許可値のいずれかに変更
400Field prices must be a non-empty object空の prices を渡したprices を省略すれば元の値を保持、または少なくとも 1 通貨を含める
400Invalid currency code: "X". Must be 3 uppercase letters (e.g., "USD", "EUR", "JPY")prices のキーが ISO 4217 コードに準拠していない3 文字の大文字を使用
400Invalid amount for X: "Y". Must be a positive number string (e.g., "9.99", "1000")金額文字列がパースできない正の十進数文字列を使用
400メッセージに has no version を含む対象環境(test または prod)にバージョンがまだない先にこの環境でバージョンを作成(test から公開、または test で作成)
401Unauthorized認証失敗API Key、タイムスタンプ、署名を確認
404Product not found / Current version not foundproduct ID が存在しない(または現行バージョン欠落)product ID を確認
500Internal server error一時的な下流障害指数バックオフでリトライ(5s 開始、最大 3 回)