# Update subscription by merchant product id

Update an existing subscription identified by merchant_product_id.

Use this endpoint to change the recurring billing details of a subscription: toggle automatic rebilling (is_rebill_enabled), set a new rebill amount, change the rebill cycle (charge_interval and charge_interval_value), and reschedule the next charge (next_rebill_at). Optional fields are applied only when included in the request.

After a successful update you receive a SUBSCRIPTION type postback notification reflecting the new subscription state.

Endpoint: PATCH /subscription
Version: 1.2
Security: X-Api-Key

## Header parameters:

  - `X-Idempotency-Key` (string)
    The system supports the query deduplication mechanism. 
Any system-wide merchant's request after the first one with 
the same X-Idempotency-Key will return an error.
For example, if you have retrying mechanism for payouts and you want 
to avoid double sending, you can put header with value payout_{your_payout_id}

## Query parameters:

  - `merchant_product_id` (string, required)
    Example: "2JZGULPNK27K2"

## Request fields (application/json):

  - `is_rebill_enabled` (boolean)
    Enables or disables automatic rebilling for the subscription.

  - `amount` (string)
    New rebill amount applied to upcoming rebill charges.

  - `charge_interval` (string)
    Unit of the rebill cycle.
    Enum: "DAY"

  - `charge_interval_value` (number)
    Number of charge_interval units between rebills (e.g. DAY + 30 = every 30 days).

  - `next_rebill_at` (string)
    UTC date time of the next scheduled rebill.

## Response 200 fields (application/json):

  - `type` (string)
    Enum: "SUBSCRIPTION"

  - `data` (object)

  - `data.version` (number)

  - `data.initial_transaction_id` (string)

  - `data.subscription_id` (string)

  - `data.created_at` (string)
    UTC date time format

  - `data.subscription_status` (string)

  - `data.expires_at` (string)
    UTC date time format

  - `data.merchant_id` (string)

  - `data.merchant_product_id` (string)

  - `data.merchant_payment_id` (string)

  - `data.merchant_customer_id` (string)

  - `data.payment_method` (string)
    Enum: "CARD"

  - `data.currency_code` (string)

  - `data.amount` (string)

  - `data.transaction_currency_code` (string)

  - `data.transaction_amount` (string)

  - `data.transaction_fee_currency_code` (string)

  - `data.transaction_fee_amount` (string)

  - `data.transaction_tax_currency_code` (string)

  - `data.transaction_tax_amount` (string)

  - `data.transaction_tax_type` (string)

  - `data.transaction_tax_label` (string)

  - `data.transaction_tax_percentage` (string)

  - `data.transaction_tax_exempt_amount` (string)

  - `data.is_trial` (boolean)

  - `data.charge_interval` (string)
    Enum: same as `charge_interval` (1 values)

  - `data.charge_interval_value` (number)

  - `data.is_rebill_enabled` (boolean)

  - `data.trial_interval` (string)
    Enum: same as `charge_interval` (1 values)

  - `data.trial_interval_value` (number)

  - `data.payment_id` (string)
    Example: "2JWZGTNKS67K2"

  - `data.product_id` (string)
    Example: "2JWZGTNKSG7K2"

  - `data.retry_at` (string)
    UTC date time format

  - `data.retry_count` (number)

  - `data.retry_total_count` (number)
    Total count of attempts to rebill

  - `data.shop_name` (string)
    Shop name from original payment

  - `data.shop_url` (string)
    Shop URL from original payment

  - `data.custom_field` (string)
    Custom field value passed through from the original payment

## Response 400 fields (application/json):

  - `errors` (array)

  - `errors.error_code` (string, required)
    Enum: "INVALID_REQUEST_PARAMETER", "INVALID_REQUEST", "INTERNAL_ERROR", "TOO_MANY_REQUESTS", "NOT_FOUND"

  - `errors.error_message` (string, required)


