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 product with custom price to subscription
External APIs (0.0.1)
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": [ … ] } }
Request
Adds a new product line item with a custom price override to an existing subscription contract. This endpoint bypasses standard pricing and selling plans to set an exact price.
Key Features:
- Direct price control - set any price regardless of product pricing
- Optional automatic discount application based on shop settings
- No selling plan assignment - pure custom pricing
- Supports both recurring and one-time products
- Email notifications sent to customers
- Activity logging for audit trails
Custom Pricing Behavior:
- Price is set exactly as provided (no calculations)
- Overrides any product-level pricing
- Not affected by currency or country
- No automatic discounts from selling plans
- Price remains fixed unless manually updated
Shop-Level Discount Application: Despite the method name, this endpoint MAY apply discounts:
- Checks shop setting: 'applySubscriptionDiscount'
- If enabled, applies shop's default subscription discount
- Discount type: PERCENTAGE or FIXED (per shop config)
- Creates manual discount: 'PRODUCT_DISCOUNT_[lineId]'
- Discount is additional to the custom price
Common Use Cases:
- Negotiated Pricing: Custom rates for specific customers
- Price Matching: Match competitor pricing
- Promotional Pricing: Special one-off prices
- Bundle Pricing: Custom prices for package deals
- Legacy Pricing: Honor old pricing agreements
- Test Orders: Zero or nominal pricing for testing
Differences from Standard Add:
- No selling plan association
- No pricing policy rules
- No automatic tier discounts
- Price doesn't adjust with frequency changes
- Manual price management required
One-Time Products: When isOneTimeProduct=true:
- Product appears only in next order
- Automatically removed after fulfillment
- Custom price applies to that single order
- Shop discount still applies if configured
Price Validation:
- Must be a positive number
- No maximum limit enforced
- Can be less than product cost (loss leader)
- Currency matches shop's base currency
- Decimal precision per currency rules
Important Considerations:
- No automatic price updates with product changes
- Frequency changes don't affect pricing
- May bypass minimum order values
- Consider margin implications
- Document reason for custom pricing
Post-Addition Effects:
- Customer receives product addition email
- Activity log records custom price
- Shipping may need recalculation
- Order total updates immediately
- No impact on other line items
Authentication: Requires valid X-API-Key header
Subscription contract ID to add product to
Custom price for the product (in store currency). This exact price will be charged regardless of the product's normal price, selling plans, or frequency. If the shop has 'applySubscriptionDiscount' enabled, an additional discount may be applied on top of this price.
When true, product will only be included in the next order; when false, in all future orders
- https://subscription-admin.appstle.com/api/external/v2/subscription-contract-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-contract-add-line-item?contractId=123456789&quantity=1&variantId=42549172011164&price=19.99&isOneTimeProduct=false&api_key=string' \
-H 'X-API-Key: string'{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-04-01T00:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com" }, "lines": { "edges": [ … ] } }