PUT
/
subscriptions
/
{id}
curl --request PUT \
  --url https://staging.api.commercengine.io/api/v1/{store_id}/storefront/subscriptions/{id} \
  --header 'Content-Type: application/json' \
  --data '{
  "command": "<string>",
  "billing_frequency": "monthly",
  "billing_interval": 1,
  "billing_limit": 123,
  "shipping_frequency": "monthly",
  "shipping_interval": 1,
  "shipping_limit": 123,
  "is_prepaid": false,
  "usage_based_billing": false,
  "usage_based_tiers": [
    {
      "up_to": 123,
      "price_per_unit": 123
    }
  ],
  "grace_period_days": 0,
  "is_cancellation_allowed": true,
  "days_until_cancellation_allowed": 3,
  "invoice_items": [
    {
      "product_id": "<string>",
      "variant_id": "<string>",
      "quantity": 123
    }
  ]
}'
{
  "message": "<string>",
  "success": true,
  "content": {
    "subscription": {
      "id": "<string>",
      "plan_id": "<string>",
      "plan_name": "<string>",
      "price": 123,
      "status": "created",
      "start_date": "2023-12-25",
      "end_date": "2023-12-25",
      "trial_days": 0,
      "trial_start_date": "2023-12-25",
      "trial_end_date": "2023-12-25",
      "next_billing_date": "2023-12-25",
      "last_payment_date": "2023-11-07T05:31:56Z",
      "pause_start_date": "2023-12-25",
      "pause_end_date": "2023-12-25",
      "billing_frequency": "monthly",
      "billing_interval": 1,
      "billing_limit": 123,
      "shipping_frequency": "monthly",
      "shipping_interval": 1,
      "shipping_limit": 123,
      "coupon_id": "<string>",
      "coupon_code": "<string>",
      "coupon_discount_percent": 0,
      "coupon_discount_amount": 0,
      "coupon_redemption_limit": 0,
      "is_prepaid": false,
      "usage_based_billing": true,
      "usage_based_tiers": [
        {
          "up_to": 123,
          "price_per_unit": 123
        }
      ],
      "grace_period_days": 0,
      "is_cancellation_allowed": true,
      "days_until_cancellation_allowed": 3,
      "currency": {
        "name": "Indian Rupee",
        "code": "INR",
        "symbol": "₹"
      },
      "metadata": {},
      "created_at": "2023-11-07T05:31:56Z",
      "modified_at": "2023-11-07T05:31:56Z",
      "invoice_items": [
        {
          "product_id": "<string>",
          "variant_id": "<string>",
          "product_name": "<string>",
          "variant_name": "<string>",
          "product_image_url": "<string>",
          "sku": "<string>",
          "quantity": 123,
          "listing_price": 123,
          "selling_price": 123,
          "tax_type": "<string>",
          "tax_rate": 123,
          "price_including_tax": true,
          "selling_price_excluding_tax": 123
        }
      ],
      "billing_address": {
        "id": "<string>",
        "first_name": "<string>",
        "last_name": "<string>",
        "country_code": "<string>",
        "phone": "<string>",
        "email": "<string>",
        "address_line1": "<string>",
        "address_line2": "<string>",
        "landmark": "<string>",
        "pincode": "<string>",
        "city": "<string>",
        "state": "<string>",
        "country": "<string>",
        "tax_identification_number": "123456789",
        "business_name": "<string>",
        "is_phone_verified": true,
        "is_email_verified": true
      },
      "shipping_address": {
        "id": "<string>",
        "first_name": "<string>",
        "last_name": "<string>",
        "country_code": "<string>",
        "phone": "<string>",
        "email": "<string>",
        "address_line1": "<string>",
        "address_line2": "<string>",
        "landmark": "<string>",
        "pincode": "<string>",
        "city": "<string>",
        "state": "<string>",
        "country": "<string>",
        "tax_identification_number": "123456789",
        "business_name": "<string>",
        "is_phone_verified": true,
        "is_email_verified": true
      }
    }
  }
}

Path Parameters

id
string
required

subscription id

Body

application/json
command
string
required
Allowed value: "update"
billing_frequency
enum<string>
Available options:
monthly
billing_interval
integer
default:1
billing_limit
integer | null

null means there is no limit on number of invoices generated. If specified, then subscription will be revoked automatically after billing limit is reached.

shipping_frequency
enum<string>
Available options:
monthly
shipping_interval
integer
default:1
shipping_limit
integer | null

null means there is no limit on number of deliveries completed. If specified, then subscription will be revoked automatically after shipping limit is reached.

is_prepaid
boolean
default:false

Refers to a pricing model where customers are charged based on their actual usage of a service. Usage based billing works for digital products.

usage_based_billing
boolean
default:false

Refers to a pricing model where customers are charged based on their actual usage of a service. Usage based billing works for digital products.

usage_based_tiers
object[]

Refers to a pricing structure where customers are charged based on their usage, but the cost per unit of usage decreases or changes as they move into higher usage levels.

grace_period_days
integer
default:0

The number of days after a failed payment to retry before canceling.

is_cancellation_allowed
boolean
default:true

Indcates whether the next billing cancellation is allowed or not.

days_until_cancellation_allowed
integer
default:3

Specifies the number of days the customer has to cancel before the next billing.

invoice_items
object[]

Response

200 - application/json
OK
message
string
required
success
boolean
required
content
object
required