Applies a Shopify discount code to an existing subscription contract. The discount will be applied to future orders generated by this subscription.
Key Features:
Discount Code Validation:
Customer Portal Restrictions: When called from customer portal context:
Concurrency Protection:
Post-Application Effects:
Important Notes:
Authentication: Requires valid X-API-Key header
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-apply-discount \
--header 'X-API-Key: <x-api-key>'{
"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"
},
"lines": {
"edges": [
{
"node": {
"id": "gid://shopify/SubscriptionLine/111111",
"quantity": 2,
"variantId": "gid://shopify/ProductVariant/42549172011164",
"currentPrice": {
"amount": "29.99",
"currencyCode": "USD"
}
}
}
]
},
"discounts": {
"edges": [
{
"node": {
"id": "gid://shopify/SubscriptionManualDiscount/888888",
"title": "SAVE10",
"targetType": "ALL_LINES",
"value": {
"percentage": 10
}
}
}
]
}
}Documentation Index
Fetch the complete documentation index at: https://appstleinc-aeca3e0a.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
API Key for authentication
Subscription contract ID to apply discount to. Provide the numeric ID without the gid:// prefix
x >= 1API Key (Deprecated - Use X-API-Key header instead)
Valid Shopify discount code to apply. Case-sensitive. Must be an active discount code in your Shopify store.
1 - 255^[A-Za-z0-9_-]+$Discount code successfully applied
ACTIVE, PAUSED, CANCELLED, EXPIRED, FAILED, $UNKNOWN Show child attributes
SUCCEEDED, FAILED, $UNKNOWN Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
curl --request PUT \
--url https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-apply-discount \
--header 'X-API-Key: <x-api-key>'{
"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"
},
"lines": {
"edges": [
{
"node": {
"id": "gid://shopify/SubscriptionLine/111111",
"quantity": 2,
"variantId": "gid://shopify/ProductVariant/42549172011164",
"currentPrice": {
"amount": "29.99",
"currencyCode": "USD"
}
}
}
]
},
"discounts": {
"edges": [
{
"node": {
"id": "gid://shopify/SubscriptionManualDiscount/888888",
"title": "SAVE10",
"targetType": "ALL_LINES",
"value": {
"percentage": 10
}
}
}
]
}
}