Image Description Image Description

No Results

  • Support
Logo Logo v1.0
  • Basics
  • Getting started
  • Get authenticating user
  • Products
  • Create a Product
  • Update a Product
  • Coupons
  • Create a Coupon
  • Update a Coupon
  • Delete a Coupon
  • List Coupons
  • License Keys
  • Verify a License Key
  • Redeem a License Key
  • Refund a License Key
  • Subscriptions
  • Verify a Subscription
  • Webhooks
  • Basics
  • Subscribe
  • Unsubscribe
  • Webhook Events
  • New sale
  • New lead
  • New affiliate sign-up
  • New subscription
  • Subscription cancellation

Update a Coupon

Endpoint

PUT /coupons/update

Required parameters

  • id - VARCHAR(25) - The ID of the coupon you want to update

Optional parameters

All parameters from the Create a Coupon endpoint are optional. Only include the fields you want to update.

  • code - VARCHAR(100) - The coupon code (must be unique and at least 2 characters). Case-insensitive.
  • type - VARCHAR(10) - The discount type, values can be:
    1. percentage - Percentage discount (e.g., 20 for 20% off)
    2. fixed - Fixed amount discount (e.g., 10 for $10 off)
  • amount - DECIMAL - The discount amount. For percentage type, must be between 0.1 and 100. For fixed type, must be between 0.1 and 999999.99.
  • is_storewide - BOOLEAN - Whether the coupon applies to all products. If false, you must provide products.
  • products - ARRAY - List of product IDs to apply this coupon to. If provided, this will replace all existing products. Required if is_storewide is false.
  • is_live - BOOLEAN - Whether the coupon is active and can be used.
  • limit - INT - Maximum number of times this coupon can be redeemed. Leave blank for unlimited.
  • duration_in_months - INT - For subscription products only. Number of months the discount applies. After this period, regular pricing resumes.
  • start - DATETIME - When the coupon becomes valid. ISO 8601 format (e.g., 2023-12-31T23:59:59Z).
  • end - DATETIME - When the coupon expires. ISO 8601 format (e.g., 2024-12-31T23:59:59Z). Must be after start if both are provided.
  • affiliate - VARCHAR(25) - ID of the affiliate to associate this coupon with.
  • requires_subscription_product - VARCHAR(25) - ID of a subscription product. If set, this coupon can only be used by active subscribers of that product.

Example request

  
    curl https://api.zylvie.com/coupons/update \
      -X PUT \
      -h "Authorization: Bearer e97f0aafe4884bc380c81fdb2347dc55" \
      -h "Content-Type: application/json" \
      -d '{
        "id": "8x9Pqm3N",
        "is_live": false,
        "limit": 50
      }'
  

Example response

  
    {
      "id": "8x9Pqm3N",
      "created": "2024-01-15T10:30:00Z",
      "code": "SUMMER2024",
      "type": "percentage",
      "amount": 25.0,
      "is_storewide": true,
      "is_live": false,
      "limit": 50,
      "duration_in_months": null,
      "start": "2024-06-01T00:00:00Z",
      "end": "2024-08-31T23:59:59Z",
      "redemption_count": 12,
      "products": [],
      "affiliate": null,
      "requires_subscription_product": null
    }
  

Notes

  • Only include the fields you want to update. Fields not included in the request will remain unchanged.
  • If you provide products, they will completely replace the existing products. To keep existing products, omit this field from your request.
  • The coupon must belong to your authenticated brand. Attempting to update a coupon that doesn't belong to you will result in a 404 error.
  • All validation rules from the Create a Coupon endpoint apply to updates as well.