Skip to main content
Publish a subscription product from test to production environment. This is a one-way, first-publish-only operation.
POST /v1/actions/subscription-product/publish-product
Authentication: API Key
Do not include the X-Environment header for this endpoint. Publishing is always one-way from test to production.

Request Body

FieldTypeRequiredDescription
idstringYesProduct ID (PROD_xxx format)

Example Request

await client.subscriptionProducts.publish({
  id: "PROD_3F7H2J5L8N1Q4S6U",
});
// Uses callApi() helper from authentication.mdx
const result = await callApi("POST", "/v1/actions/subscription-product/publish-product", {
  id: "PROD_3F7H2J5L8N1Q4S6U",
});
console.log(result.data);
// Uses callApi() helper from authentication.mdx
String body = """
    {"id":"PROD_3F7H2J5L8N1Q4S6U"}""";

String response = callApi("POST", "/v1/actions/subscription-product/publish-product", body);
System.out.println(response);
# Uses call_api() helper from authentication.mdx
result = call_api("POST", "/v1/actions/subscription-product/publish-product", {
    "id": "PROD_3F7H2J5L8N1Q4S6U",
})
print(result["data"])
// Uses callAPI() helper from authentication.mdx
body := map[string]interface{}{
    "id": "PROD_3F7H2J5L8N1Q4S6U",
}
result, err := callAPI("POST", "/v1/actions/subscription-product/publish-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"
});
let result = call_api("POST", "/v1/actions/subscription-product/publish-product", &body).await?;
println!("{}", result);
/* Uses call_api() helper from authentication.mdx */
const char *body = "{\"id\":\"PROD_3F7H2J5L8N1Q4S6U\"}";
char *response = call_api("POST", "/v1/actions/subscription-product/publish-product", body);
printf("%s\n", response);
free(response);
// Uses callApi() helper from authentication.mdx
std::string body = R"({"id":"PROD_3F7H2J5L8N1Q4S6U"})";
std::string response = callApi("POST", "/v1/actions/subscription-product/publish-product", body);
std::cout << response << std::endl;
MERCHANT_ID="MER_2aUyqjCzEIiEcYMKj7TZtw"
TIMESTAMP=$(date +%s)
BODY='{"id":"PROD_3F7H2J5L8N1Q4S6U"}'
BODY_HASH=$(echo -n "$BODY" | openssl dgst -sha256 -binary | base64 -w 0)
CANONICAL_REQUEST="POST
/v1/actions/subscription-product/publish-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/publish-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"}'
BODY_HASH=$(echo -n "$BODY" | openssl dgst -sha256 -binary | base64 -w 0)
CANONICAL_REQUEST="POST
/v1/actions/subscription-product/publish-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/publish-product" \
  --header="Content-Type: application/json" \
  --header="X-Merchant-Id: $MERCHANT_ID" \
  --header="X-Timestamp: $TIMESTAMP" \
  --header="X-Signature: $SIGNATURE" \
  --post-data="$BODY"

Success Response (200)

{
  "data": {
    "product": {
      "id": "PROD_3F7H2J5L8N1Q4S6U",
      "storeId": "STO_2D5F8G3H1K4M6N9P",
      "name": "Pro Plan",
      "description": "Full access to all Pro features.",
      "billingPeriod": "monthly",
      "prices": {
        "USD": { "amount": "29.00", "taxCategory": "saas" },
        "EUR": { "amount": "27.00", "taxCategory": "saas" }
      },
      "media": [],
      "successUrl": "https://example.com/welcome",
      "metadata": { "trialDays": 14 },
      "status": "active",
      "createdAt": "2026-03-30T10:30:00.000Z",
      "updatedAt": "2026-03-30T12:00:00.000Z"
    }
  }
}

Response Fields

Same as Create Subscription Product response.
Only the first publish is supported. Once a product has a production version, this endpoint returns an error. To update a published product, use the Update Product endpoint in the production environment.

Errors

Retry policy: Never retry 4xx — fix the request and resubmit. Retry 5xx with exponential backoff (start 5s, max 3 attempts).
Statuserrors[0].messageWhat it meansRecommended handling
400Missing header: x-context-merchant-idThe merchant context header was not forwardedFix your SDK configuration
400Missing required field: idRequest body did not include idAdd id, resubmit
400Expected format: PROD_xxx, got "X"id is not a valid Short IDUse a PROD_ prefixed Short ID
400No test version foundThe product has no version in the test environment to publishCreate and activate a test version first via Update Product / Update Status
400Test version is not activeTest version exists but its status is inactiveActivate the test version via Update Status, then publish
400Already published to productionProduct already has a production version (publish is first-publish-only)Use Update Product in the production environment instead
401UnauthorizedAuthentication failedVerify API key, timestamp, and signature
404Product not found / Source version not foundProduct ID does not exist (or its source version is missing)Verify the product ID
500Internal server errorTransient downstream failureRetry with exponential backoff (start 5s, max 3 attempts)