メインコンテンツへスキップ
POST /v1/actions/subscription-product/create-product
認証: API Key

リクエストボディ

フィールド必須説明
storeIdstringはいストア ID(STO_xxx 形式)
namestringはい商品名
billingPeriodstringはいweeklymonthlyquarterly、または yearly
pricesobjectはいマルチ通貨価格設定(価格形式を参照)
descriptionstringいいえ商品説明(Markdown サポート)
mediaarrayいいえ商品画像/動画(メディア形式を参照)
successUrlstringいいえサブスクリプション成功後のリダイレクト URL
metadataobjectいいえカスタムキーバリューデータ。無料トライアル期間を提供するために trialDays(整数、1-365)を含めることができます

リクエスト例

import { WaffoPancake, BillingPeriod, TaxCategory } from "@waffo/pancake-ts";

const client = new WaffoPancake({
  merchantId: process.env.WAFFO_MERCHANT_ID!,
  privateKey: process.env.WAFFO_PRIVATE_KEY!,
});

const { product } = await client.subscriptionProducts.create({
  storeId: "STO_2D5F8G3H1K4M6N9P",
  name: "Pro Plan",
  billingPeriod: BillingPeriod.Monthly,
  prices: {
    USD: { amount: "29.00", taxIncluded: false, taxCategory: TaxCategory.SaaS },
    EUR: { amount: "27.00", taxIncluded: false, taxCategory: TaxCategory.SaaS },
  },
  description: "Full access to all Pro features.",
  successUrl: "https://example.com/welcome",
  metadata: { trialDays: 14 },
});

成功レスポンス

{
  "data": {
    "id": "PROD_3F7H2J5L8N1Q4S6U",
    "storeId": "STO_2D5F8G3H1K4M6N9P",
    "prodVersionId": null,
    "testVersionId": "PVER_9A2C5E8G1J4L7N0P",
    "prodStatus": "inactive",
    "testStatus": "active",
    "createdAt": "2026-03-30T10:30:00.000Z",
    "updatedAt": "2026-03-30T10:30:00.000Z",
    "version": {
      "id": "PVER_9A2C5E8G1J4L7N0P",
      "productId": "PROD_3F7H2J5L8N1Q4S6U",
      "versionNumber": 1,
      "name": "Pro Plan",
      "billingPeriod": "monthly",
      "description": "Full access to all Pro features.",
      "prices": {
        "USD": { "amount": "29.00", "taxIncluded": false, "taxCategory": "saas" },
        "EUR": { "amount": "27.00", "taxIncluded": false, "taxCategory": "saas" }
      },
      "media": [],
      "successUrl": "https://example.com/welcome",
      "metadata": { "trialDays": 14 },
      "createdAt": "2026-03-30T10:30:00.000Z"
    }
  }
}

エラーレスポンス

ステータス条件
400必須フィールドの欠落(storeIdnamebillingPeriodprices
400無効な billingPeriod
400trialDays が整数でないか、1-365 の範囲外です
404ストアが見つかりません