Skip to content

External APIs (0.0.1)

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.

Languages
Servers
https://subscription-admin.appstle.com

Subscription Management

Core APIs for managing the complete subscription lifecycle including creation, updates, pausing, resuming, and cancellation of subscriptions.

Operations

Subscription Payments

APIs for managing subscription payment methods, processing payments, handling payment retries, and updating billing information.

Operations

Subscription Contracts

APIs for managing subscription contracts including delivery schedules, pricing, order notes, billing cycles, and shipping addresses.

Operations

Subscription Products

APIs for managing products within subscriptions including adding, removing, updating quantities, and swapping products.

Operations

Billing & Payments

APIs for handling billing operations, payment processing, and financial transactions related to subscriptions.

Operations

Subscription Discounts

APIs for managing discounts and promotional codes applied to subscriptions.

Operations

Remove discount from subscription

Request

Removes a specific discount from a subscription contract based on the discount ID. This will affect the pricing of all future orders generated by the subscription.

Key Features:

  • Removes any type of discount: automatic, manual, or code-based
  • Uses Shopify's draft system for safe removal
  • Immediate effect on future order pricing
  • Cannot be undone - discount must be re-applied if needed
  • Activity log tracks removed discounts

Finding Discount IDs: Discount IDs can be found in the subscription contract's discount collection:

  • Query the subscription contract to see discounts.edges[].node.id
  • Format: gid://shopify/SubscriptionManualDiscount/123456
  • Each discount has a unique ID regardless of type

Types of Discounts:

  • Manual Discounts: Applied via API (percentage, fixed, price)
  • Code Discounts: Applied using discount codes
  • Automatic Discounts: Applied by Shopify based on rules
  • Build-a-Box Discounts: Volume-based discounts
  • Selling Plan Discounts: Built into the subscription plan

Impact on Pricing: When a discount is removed:

  • Future orders use full price (no discount)
  • Existing orders are not affected
  • Other discounts remain active
  • Shipping prices may be recalculated
  • Customer sees updated pricing immediately

Common Use Cases:

  • End promotional period discounts
  • Remove expired or invalid discount codes
  • Clear discounts before applying new ones
  • Customer service adjustments
  • Correct pricing errors

Important Notes:

  • Cannot remove selling plan built-in discounts
  • No customer notification sent (consider sending separately)
  • Cannot selectively remove - removes entire discount
  • Build-a-Box discounts may auto-reapply based on quantity
  • Some discounts may be required by business rules

Post-Removal Considerations:

  • Customer may notice price increase on next order
  • May affect customer retention if unexpected
  • Consider grace periods or notifications
  • Document reason for removal in your system

Authentication: Requires valid X-API-Key header

Query
contractIdinteger(int64)required

Subscription contract ID to remove discount from

Example: contractId=123456789
discountIdstringrequired

ID of the discount to be removed. Must be the full GraphQL ID including the gid:// prefix. You can find discount IDs by querying the subscription contract and looking at the discounts collection. Format example: gid://shopify/SubscriptionManualDiscount/123456789

Example: discountId=gid://shopify/SubscriptionManualDiscount/123456789
api_keystringDeprecated

API Key (Deprecated - Use X-API-Key header instead)

Headers
X-API-Keystringrequired

API Key for authentication

curl -i -X PUT \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-remove-discount?contractId=123456789&discountId=gid%3A%2F%2Fshopify%2FSubscriptionManualDiscount%2F123456789&api_key=string' \
  -H 'X-API-Key: string'

Responses

Discount successfully removed

Bodyapplication/json
get__typenamestring
idstring
createdAtobject
updatedAtobject
nextBillingDateobject
statusstring
Enum"ACTIVE""PAUSED""CANCELLED""EXPIRED""FAILED""$UNKNOWN"
deliveryPriceobject(DeliveryPrice)
lastPaymentStatusstring
Enum"SUCCEEDED""FAILED""$UNKNOWN"
billingPolicyobject(BillingPolicy)
deliveryPolicyobject(DeliveryPolicy)
linesobject(Lines)
customerPaymentMethodobject(CustomerPaymentMethod)
deliveryMethodobject(DeliveryMethod)
originOrderobject(OriginOrder)
customerobject(Customer)
discountsobject(Discounts)
notestring
customAttributesArray of objects(CustomAttribute1)
billingAttemptsobject(BillingAttempts)
Response
application/json
{ "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": [] }, "discounts": { "edges": [] }, "deliveryPrice": { "amount": "5.99", "currencyCode": "USD" } }

Apply discount code to subscription

Request

Applies a Shopify discount code to an existing subscription contract. The discount will be applied to future orders generated by this subscription.

Key Features:

  • Validates discount code through Shopify's discount system
  • Prevents duplicate discount code applications
  • Uses database locking to prevent race conditions
  • Automatically recalculates shipping prices if needed
  • Creates audit trail through activity logs
  • Returns updated subscription with discount details

Discount Code Validation:

  • Must be an active Shopify discount code in the store
  • Must be applicable to subscription orders
  • Cannot be applied if already active on the subscription
  • Subject to Shopify's discount rules and restrictions

Customer Portal Restrictions: When called from customer portal context:

  • If 'enableAllowOnlyOneDiscountCode' is enabled, customers cannot apply additional codes
  • This restriction ensures single discount policy enforcement
  • External API calls bypass this restriction

Concurrency Protection:

  • Uses database-level locking on the subscription contract
  • Prevents simultaneous discount applications
  • Ensures data consistency in high-traffic scenarios

Post-Application Effects:

  • Discount applies to all future orders from the subscription
  • May trigger shipping price recalculation
  • Creates 'DISCOUNT_APPLIED' activity log entry
  • Updates subscription's discount collection

Important Notes:

  • Discount codes are case-sensitive
  • Invalid or expired codes will return appropriate errors
  • Discounts stack according to Shopify's combination rules
  • Some discounts may not be compatible with subscriptions

Authentication: Requires valid X-API-Key header

Query
contractIdinteger(int64)>= 1required

Subscription contract ID to apply discount to. Provide the numeric ID without the gid:// prefix

Example: contractId=123456789
discountCodestring[ 1 .. 255 ] characters^[A-Za-z0-9_-]+$required

Valid Shopify discount code to apply. Case-sensitive. Must be an active discount code in your Shopify store.

Example: discountCode=SAVE10
api_keystringDeprecated

API Key (Deprecated - Use X-API-Key header instead)

Headers
X-API-Keystringrequired

API Key for authentication

Example: sk_live_1234567890abcdef
curl -i -X PUT \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-apply-discount?contractId=123456789&discountCode=SAVE10&api_key=string' \
  -H 'X-API-Key: sk_live_1234567890abcdef'

Responses

Discount code successfully applied

Bodyapplication/json
get__typenamestring
idstring
createdAtobject
updatedAtobject
nextBillingDateobject
statusstring
Enum"ACTIVE""PAUSED""CANCELLED""EXPIRED""FAILED""$UNKNOWN"
deliveryPriceobject(DeliveryPrice)
lastPaymentStatusstring
Enum"SUCCEEDED""FAILED""$UNKNOWN"
billingPolicyobject(BillingPolicy)
deliveryPolicyobject(DeliveryPolicy)
linesobject(Lines)
customerPaymentMethodobject(CustomerPaymentMethod)
deliveryMethodobject(DeliveryMethod)
originOrderobject(OriginOrder)
customerobject(Customer)
discountsobject(Discounts)
notestring
customAttributesArray of objects(CustomAttribute1)
billingAttemptsobject(BillingAttempts)
Response
application/json
{ "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": [] }, "discounts": { "edges": [] } }

Add custom discount to subscription

Request

Creates and applies a custom manual discount to an existing subscription contract. This powerful endpoint supports multiple discount types and configurations for flexible pricing strategies.

Discount Types:

  • PERCENTAGE: Percentage off the order (e.g., 10% off)
  • FIXED: Fixed amount off the order (e.g., $10 off)
  • PRICE: Override price (sets total to specific amount)

Key Features:

  • Custom discount titles for easy identification
  • Cycle limits for time-bound promotions
  • Per-item or subtotal application options
  • Stacks with other discounts per Shopify rules
  • Automatic shipping price recalculation
  • Activity logging for audit trails

Application Methods:

  • Subtotal Discount (appliesOnEachItem=false): Applied to order total after line item calculations
  • Per-Item Discount (appliesOnEachItem=true): Applied to each line item individually

Cycle Limits:

  • Set recurringCycleLimit to apply discount for specific number of orders
  • Leave null for unlimited duration
  • Useful for '3 months at 20% off' promotions

Retention Campaigns: This endpoint integrates with cancellation retention workflows:

  • Can trigger merchant notifications
  • Tracks discount usage for retention analytics
  • Helps prevent churn with targeted offers

Important Notes:

  • Discounts apply to future orders only
  • Cannot modify discounts once applied (must remove and re-add)
  • Some discount combinations may not be allowed by Shopify
  • Price overrides should be used carefully

Authentication: Requires valid X-API-Key header

Query
contractIdinteger(int64)>= 1required

Subscription contract ID to apply discount to. Provide the numeric ID without the gid:// prefix

Example: contractId=123456789
percentageinteger[ 1 .. 100 ]

Discount percentage (1-100). Required when discountType is PERCENTAGE

Example: percentage=10
discountTitlestring<= 255 characters

Custom title for the discount. If not provided, a default title will be generated

Example: discountTitle=Loyalty Discount
recurringCycleLimitinteger[ 1 .. 9999 ]

Number of billing cycles the discount applies to. Leave null for unlimited duration

Example: recurringCycleLimit=3
appliesOnEachItemboolean

Application method: true = apply to each line item individually, false = apply to order subtotal

Default false
amountnumber(double)[ 0.01 .. 999999.99 ]

Fixed discount amount in store currency. Required when discountType is FIXED or PRICE

Example: amount=10.99
discountTypestring

Type of discount to apply

Enum"PERCENTAGE""FIXED""PRICE"
Example: discountType=PERCENTAGE
api_keystringDeprecated

API Key (Deprecated - Use X-API-Key header instead)

Headers
X-API-Keystringrequired

API Key for authentication

Example: sk_live_1234567890abcdef
curl -i -X PUT \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contracts-add-discount?contractId=123456789&percentage=10&discountTitle=Loyalty+Discount&recurringCycleLimit=3&appliesOnEachItem=false&amount=10.99&discountType=PERCENTAGE&api_key=string' \
  -H 'X-API-Key: sk_live_1234567890abcdef'

Responses

Discount successfully added

Bodyapplication/json
get__typenamestring
idstring
createdAtobject
updatedAtobject
nextBillingDateobject
statusstring
Enum"ACTIVE""PAUSED""CANCELLED""EXPIRED""FAILED""$UNKNOWN"
deliveryPriceobject(DeliveryPrice)
lastPaymentStatusstring
Enum"SUCCEEDED""FAILED""$UNKNOWN"
billingPolicyobject(BillingPolicy)
deliveryPolicyobject(DeliveryPolicy)
linesobject(Lines)
customerPaymentMethodobject(CustomerPaymentMethod)
deliveryMethodobject(DeliveryMethod)
originOrderobject(OriginOrder)
customerobject(Customer)
discountsobject(Discounts)
notestring
customAttributesArray of objects(CustomAttribute1)
billingAttemptsobject(BillingAttempts)
Response
application/json
{ "id": "gid://shopify/SubscriptionContract/123456789", "status": "ACTIVE", "nextBillingDate": "2024-04-01T12:00:00Z", "customer": { "id": "gid://shopify/Customer/987654321", "email": "customer@example.com" }, "lines": { "edges": [] }, "discounts": { "edges": [] } }

Subscription One-Time Products

APIs for managing one-time add-on products that can be purchased alongside recurring subscription items.

Operations

Subscription Plans

APIs for managing subscription plans, pricing tiers, and plan configurations.

Operations

Build-a-Box & Bundles

APIs for managing customizable product boxes and bundles where customers can select multiple items.

Operations

Product Catalog

APIs for managing the product catalog including product information, variants, and inventory.

Operations

Operations & Settings

APIs for managing operational settings, configurations, and administrative functions.

Operations

Customer Portal

APIs powering the customer-facing portal where subscribers can manage their own subscriptions.

Operations

Customers

APIs for managing customer information, profiles, and account details.

Operations