Comprehensive API documentation for managing subscriptions, payments, and related operations. These APIs allow you to programmatically manage subscription lifecycles, handle payments, configure products, and integrate subscription functionality into your applications.
- Add multiple products to subscription
External APIs (0.0.1)
Request
Removes a specific product line item from an existing subscription contract. Can optionally retain prorated discounts associated with the removed product.
Key Features:
- Validates minimum subscription requirements before removal
- Handles discount cleanup for line-specific discounts
- Enforces minimum cycle commitments on products
- Supports Build-a-Box quantity validation
- Automatic retry on concurrent modification conflicts
- Email notifications for subscription changes
Validation Rules:
- At least one recurring subscription product must remain after removal
- One-time products and free products don't count toward the minimum
- Products with minimum cycle commitments cannot be removed until fulfilled
- Build-a-Box subscriptions validate against minimum/maximum quantity rules
Discount Handling: When removeDiscount=true (default):
- Discounts applied only to the removed line item are deleted
- Discounts applied to multiple line items are retained
- System automatically identifies which discounts to remove
Retry Mechanism: The endpoint automatically retries in these scenarios:
- Concurrent modification detected (another process updated the subscription)
- Invalid discount code errors (removes problematic discount and retries)
- This ensures reliable operation in high-traffic environments
Post-Removal Actions:
- Activity log created for audit trail
- Email notification sent to customer (except for one-time products)
- Shipping price recalculated asynchronously
- Build-a-Box discounts resynced if applicable
- Product-specific discounts resynced
Authentication: Requires valid X-API-Key header
Subscription contract ID to remove product from. Provide the numeric ID without the gid:// prefix
Line item ID of the product to remove. Must be the full GraphQL ID including the gid:// prefix
Controls whether to remove discounts that apply only to this line item. When true (default), line-specific discounts are removed. When false, attempts to retain discounts where possible. Note: Discounts that apply to multiple lines are always retained regardless of this setting
- https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-remove-line-item
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PUT \
'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-remove-line-item?contractId=123456789&lineId=gid%3A%2F%2Fshopify%2FSubscriptionLine%2F123456789&removeDiscount=true&api_key=string' \
-H 'X-API-Key: sk_live_1234567890abcdef'{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-03-01T00:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com", "firstName": "John", "lastName": "Doe" }, "billingPolicy": { "interval": "MONTH", "intervalCount": 1 }, "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 }, "lines": { "edges": [ … ] }, "discounts": { "edges": [ … ] } }
Request
Adds multiple product line items to an existing subscription contract in a single request. This batch operation is more efficient than making multiple individual requests and ensures all products are added with consistent processing.
Key Features:
- Batch addition of multiple products in one API call
- All products are added as recurring items (not one-time)
- Automatic quantity defaulting (0 or null becomes 1)
- Sequential processing with full validation for each item
- Returns final subscription state after all additions
- Same pricing and discount logic as single-item endpoint
Processing Behavior:
- Products are added sequentially, not in parallel
- If any product fails, previous additions remain
- Each product goes through full validation
- Existing product handling follows store settings
- Activity logs created for each product added
Duplicate Product Handling: If a product already exists in the subscription:
- With 'updateExistingQuantityOnAddProduct' enabled: Updates quantity
- Without setting: Adds as new line item
- Setting applies to all products in the batch
Pricing and Discounts: Each product receives:
- Appropriate selling plan assignment
- Discount carry-forward based on store settings
- Currency and country-specific pricing
- Fulfillment frequency multiplier application
Build-a-Box Validation:
- Applied if any product has _bb_id attribute
- Validates total quantity after all additions
- May fail entire batch if limits exceeded
Post-Processing: After all products are added:
- Build-a-Box discounts recalculated once
- Product discounts synchronized
- Single email notification sent
- Shipping price updated once
Important Notes:
- Maximum recommended batch size: 10-20 products
- Larger batches may timeout
- All products become recurring items
- Use single-item endpoint for one-time products
Authentication: Requires valid X-API-Key header
Subscription contract ID to add products to. Provide the numeric ID without the gid:// prefix
Map of variant IDs to quantities. Keys are variant IDs (numeric only, no gid:// prefix), values are quantities to add. Null or 0 quantities default to 1.
- https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-line-items
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PUT \
'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-line-items?contractId=123456789&api_key=string' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: sk_live_1234567890abcdef' \
-d '{
"42549172011164": 1,
"42549172043932": 2,
"42549172076700": 1
}'{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-04-01T12:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com" }, "billingPolicy": { "interval": "MONTH", "intervalCount": 1 }, "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 }, "lines": { "edges": [ … ] }, "discounts": { "edges": [ … ] } }
Request
Adds a new product line item to an existing subscription contract. Can add either recurring products that will appear in each order or one-time products that appear only in the next order.
Key Features:
- Supports both recurring and one-time product additions
- Automatically applies appropriate pricing policies based on discount carry-forward settings
- Handles duplicate products by updating quantity (if enabled) or adding as new line
- Calculates prices based on billing/delivery frequency multipliers
- Sends email notifications to customers (unless suppressed)
- Creates activity logs for audit trail
Pricing Policy Application: The system applies discounts based on the store's discount carry-forward setting:
- PRODUCT_PLAN: Uses the discount from the product's selling plan
- EXISTING_PLAN: Applies the discount structure from existing subscription items
- PRODUCT_THEN_EXISTING: First attempts product plan, falls back to existing if not found
One-Time Products: Products added with isOneTimeProduct=true will:
- Only appear in the next scheduled order
- Be automatically removed after fulfillment
- Still attempt to match with appropriate selling plans
- Can have subscription discounts applied if store setting allows
Duplicate Product Handling: When adding a product that already exists in the subscription:
- If store has 'updateExistingQuantityOnAddProduct' enabled and product is not one-time: Updates existing quantity
- Otherwise: Adds as a new line item
Price Calculation:
- Base price is fetched considering contract currency and delivery country
- Price is multiplied by fulfillment frequency ratio (billing interval / delivery interval)
- Example: Monthly billing with weekly delivery = price × 4
Authentication: Requires valid X-API-Key header
Subscription contract ID to add product to. Provide the numeric ID without the gid:// prefix
Quantity of product to add. Must be a positive integer
Shopify variant ID of the product to add. Can be provided as numeric ID or with gid:// prefix
When true, product will only be included in the next order and automatically removed after fulfillment. When false, product will be included in all future orders until manually removed or subscription ends. One-time products are useful for samples, gifts, or limited-time additions
- https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-line-item
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X PUT \
'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-line-item?contractId=123456789&quantity=2&variantId=42549172011164&isOneTimeProduct=false&api_key=string' \
-H 'X-API-Key: sk_live_1234567890abcdef'{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-03-01T00:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com", "firstName": "John", "lastName": "Doe" }, "billingPolicy": { "interval": "MONTH", "intervalCount": 1 }, "deliveryPolicy": { "interval": "MONTH", "intervalCount": 1 }, "lines": { "edges": [ … ] } }