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

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

Get detailed subscription information for a customer

Request

Retrieves comprehensive subscription contract details for a specific customer, including subscription status, products, billing information, delivery schedules, and more. This endpoint returns full subscription objects with all associated data, making it ideal for displaying subscription management interfaces and detailed analytics.

What This Endpoint Returns: Unlike the contract IDs endpoint which returns only numeric IDs, this endpoint provides complete SubscriptionContractDetailsDTO objects for each of the customer's subscriptions. Each object contains all information needed to display and manage a subscription.

Data Included in Response:

Subscription Identity:

  • Subscription contract ID (Shopify numeric ID)
  • Subscription GraphQL ID (Shopify GID format)
  • Internal Appstle database ID
  • Contract creation date

Subscription Status & Lifecycle:

  • Current status (ACTIVE, PAUSED, CANCELLED, EXPIRED, FAILED)
  • Status reason (why paused/cancelled)
  • Next billing date and time
  • Contract anchor date
  • Cancellation date (if applicable)
  • Current billing cycle number
  • Min/max cycle limits

Billing Configuration:

  • Billing interval (WEEK, MONTH, YEAR)
  • Billing interval count (e.g., every 2 weeks)
  • Billing policy (pricing details)
  • Currency code
  • Recurring total price
  • Applied discounts and pricing policies

Delivery Configuration:

  • Delivery interval (WEEK, MONTH, YEAR)
  • Delivery interval count
  • Delivery method (SHIPPING, PICK_UP, LOCAL_DELIVERY)
  • Delivery policy details
  • Delivery price

Products & Line Items:

  • All subscribed products and variants
  • Product titles, SKUs, and images
  • Quantities per product
  • Individual line item prices
  • Product-specific discounts
  • Line item attributes and custom fields

Customer Information:

  • Customer ID and GraphQL ID
  • Customer name and email
  • Customer acceptance status

Address Details:

  • Billing address (full address object)
  • Shipping address (full address object)
  • Address validation status

Payment Information:

  • Payment instrument type
  • Payment method details (card last 4, etc.)
  • Payment gateway used

Order & Fulfillment:

  • Last order ID and details
  • Last order date
  • Order note
  • Fulfillment status

Additional Metadata:

  • Custom note attributes
  • Tags and labels
  • Internal flags and settings
  • Selling plan ID and group ID
  • Shop domain

Use Cases:

1. Customer Portal:

  • Display all subscriptions on customer dashboard
  • Show subscription details page
  • Enable subscription management actions
  • Display upcoming order information

2. Admin Dashboard:

  • View customer's complete subscription portfolio
  • Analyze subscription health and status
  • Identify at-risk or high-value subscriptions
  • Generate customer subscription reports

3. Customer Support:

  • Quick access to all customer subscription details
  • Troubleshoot billing or delivery issues
  • Verify subscription configurations
  • Assist with subscription modifications

4. Analytics & Reporting:

  • Calculate customer lifetime value
  • Analyze subscription mix per customer
  • Track subscription frequency distribution
  • Identify cross-sell/upsell opportunities

5. Integration & Automation:

  • Sync subscription data to CRM/analytics platforms
  • Trigger workflows based on subscription details
  • Build custom reporting dashboards
  • Export subscription data for analysis

Response Format:

Returns an array of SubscriptionContractDetailsDTO objects:

[
  {
    "id": 789,
    "subscriptionContractId": 5234567890,
    "status": "ACTIVE",
    "nextBillingDate": "2024-03-15T00:00:00Z",
    "billingInterval": "MONTH",
    "billingIntervalCount": 1,
    "deliveryInterval": "MONTH",
    "deliveryIntervalCount": 1,
    "currencyCode": "USD",
    "currentTotalPrice": "49.99",
    "customerId": 12345,
    "customerEmail": "customer@example.com",
    "lineItems": [...],
    "billingAddress": {...},
    "shippingAddress": {...}
  },
  {...}
]

Response Scenarios:

Customer with no subscriptions:

[]

Returns empty array with 200 OK status (not an error).

Customer with multiple subscriptions: Array contains multiple subscription objects, each representing a separate subscription contract.

Performance Considerations:

Response Size:

  • Each subscription object can be 5-50 KB depending on line items
  • Customer with 10 subscriptions: ~100-500 KB response
  • Consider pagination or filtering for customers with 20+ subscriptions

Query Performance:

  • Typical response time: 200-500ms
  • Slower for customers with many subscriptions or complex products
  • Database query is optimized with indexed lookups

Best Practices:

  1. Cache Results: Cache response data to minimize API calls
  2. Filter Client-Side: Filter/sort subscriptions on client after retrieval
  3. Selective Display: Don't display all fields if not needed
  4. Handle Empty Array: Always gracefully handle case with no subscriptions
  5. Optimize Images: Product images can be large - lazy load if displaying

Data Freshness:

  • Data is retrieved from Appstle database (not real-time Shopify query)
  • Updated via webhooks with < 1 second lag typically
  • Use sync endpoint if data appears stale

Security Notes:

  • Customer ID is validated against authenticated shop
  • Returns only subscriptions belonging to specified customer
  • Cannot access customers from other shops
  • Sensitive payment details (full card numbers) are never returned

Comparison with Other Endpoints:

vs. GET /subscription-customers/valid/{customerId}:

  • This endpoint: Returns complete subscription details
  • Valid contracts endpoint: Returns only contract IDs
  • Use this when you need full subscription information

vs. GET /subscription-contract-details:

  • This endpoint: Filtered by single customer
  • Contract details endpoint: Query across all customers with filters
  • Use this for customer-specific views

vs. GET /subscription-contracts/contract-external/{contractId}:

  • This endpoint: All contracts for a customer
  • Contract external endpoint: Single contract with Shopify raw data
  • Use this for customer overview, other for detailed single contract

Authentication: Requires valid X-API-Key header or api_key parameter (deprecated)

Path
customerIdinteger(int64)required

Customer Id

Query
api_keystring

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

Headers
X-API-Keystring
curl -i -X GET \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-customers-detail/valid/{customerId}?api_key=string' \
  -H 'X-API-Key: string'

Responses

Successfully retrieved customer subscription details. Returns array of subscription objects (may be empty).

Bodyapplication/jsonArray [
idinteger(int64)
shopstringrequired
graphSubscriptionContractIdstring
subscriptionContractIdinteger(int64)
billingPolicyIntervalstring
billingPolicyIntervalCountinteger(int32)
currencyCodestring
customerIdinteger(int64)
graphCustomerIdstring
deliveryPolicyIntervalstring
deliveryPolicyIntervalCountinteger(int32)
statusstring
graphOrderIdstring
orderIdinteger(int64)
createdAtstring(date-time)
updatedAtstring(date-time)
nextBillingDatestring(date-time)
orderAmountnumber(double)
orderNamestring
customerNamestring
customerEmailstring
subscriptionCreatedEmailSentboolean
endsAtstring(date-time)
startsAtstring(date-time)
subscriptionCreatedEmailSentStatusstring
Enum"SENT""UNSENT""FAILED""EMAIL_SETTINGS_DISABLED""CUSTOMER_PAYMENT_EMPTY""CONTRACT_PAUSED_STATUS"
minCyclesinteger(int32)
maxCyclesinteger(int32)
customerFirstNamestring
customerLastNamestring
autoChargeboolean
importedIdstring
stopUpComingOrderEmailboolean
pausedFromActiveboolean
subscriptionCreatedSmsSentStatusstring
Enum"SENT""UNSENT""FAILED""SMS_SETTINGS_DISABLED""CUSTOMER_PAYMENT_EMPTY""CONTRACT_PAUSED_STATUS""PHONE_NUMBER_EMPTY"
phonestring
activatedOnstring(date-time)
pausedOnstring(date-time)
cancelledOnstring(date-time)
contractDetailsJSONstring
deletedVariantIdsstring
cancellationFeedbackstring
orderNotestring
orderNoteAttributesstring
allowDeliveryPriceOverrideboolean
disableFixEmptyQueueboolean
orderAmountUSDnumber(double)
originTypestring
Enum"STORE_FRONT""IMPORTED""SPLIT_ATTEMPT_BILLING""SPLIT_CONTRACT"
originalContractIdinteger(int64)
cancellationNotestring
subscriptionTypestring
Enum"REGULAR_SUBSCRIPTION""BUILD_A_BOX_CLASSIC""BUILD_A_BOX_SINGLE_PRODUCT""BUNDLING_CLASSIC""BUNDLING_MIX_AND_MATCH""SECTIONED_BUNDLE""VOLUME_DISCOUNT"
subscriptionTypeIdentifierstring
upcomingEmailBufferDaysinteger(int32)
upcomingEmailTaskUrlstring
contractAmountnumber(double)
contractAmountUSDnumber(double)
lastSuccessfulOrderstring
totalSuccessfulOrdersinteger(int32)
lifetimeValuenumber(double)
lifetimeValueUSDnumber(double)
allowDeliveryAddressOverrideboolean
billingDateAfterTrialstring(date-time)
pauseReasonstring
pauseFeedbackstring
pauseTillDatestring(date-time)
pauseDurationCycleinteger(int32)
emailBouncedOrFailedboolean
updatingQueueboolean
customerTagstring
queueUpdatedAtstring(date-time)
orderAmountShopCurrencynumber(double)
orderAmountContractCurrencynumber(double)
billingCountryCodestring
deliveryCountryCodestring
]
Response
application/json
[ { "id": 789, "subscriptionContractId": 5234567890, "status": "ACTIVE", "nextBillingDate": "2024-03-15T00:00:00Z", "billingInterval": "MONTH", "billingIntervalCount": 1, "deliveryInterval": "MONTH", "deliveryIntervalCount": 1, "currencyCode": "USD", "currentTotalPrice": "49.99", "customerId": 12345, "customerEmail": "customer@example.com", "shop": "example-shop.myshopify.com", "currentCycle": 3, "deliveryMethod": "SHIPPING" }, { "id": 790, "subscriptionContractId": 5234567891, "status": "PAUSED", "billingInterval": "WEEK", "billingIntervalCount": 2, "currencyCode": "USD", "currentTotalPrice": "24.99", "customerId": 12345, "customerEmail": "customer@example.com" } ]

Get customer payment methods from Shopify

Request

Retrieves all payment methods associated with a customer directly from Shopify's payment API. This endpoint returns detailed information about stored payment instruments including credit/debit cards, digital wallets, and other payment methods that the customer can use for subscription billing.

What This Endpoint Does: Queries Shopify's GraphQL API to fetch the customer's payment methods, including active instruments and optionally revoked (expired, removed, or failed) payment methods. This provides real-time payment method data directly from Shopify's payment vault.

Payment Method Types Supported:

Credit/Debit Cards:

  • Visa, Mastercard, American Express, Discover
  • Card last 4 digits
  • Expiry month and year
  • Card brand and type
  • Billing address associated with card

Digital Wallets:

  • Shop Pay
  • Apple Pay
  • Google Pay
  • PayPal (when stored)

Alternative Payment Methods:

  • Bank accounts (ACH, SEPA)
  • Buy Now Pay Later instruments
  • Store credit

Payment Method Information Returned:

For Each Payment Method:

  • Payment Instrument ID: Unique identifier (used for updates)
  • Display Name: Human-readable name (e.g., "Visa ending in 4242")
  • Payment Type: Card, wallet, bank account, etc.
  • Status: ACTIVE, REVOKED, EXPIRED, FAILED
  • Is Default: Whether this is the customer's default payment method
  • Last 4 Digits: For cards and bank accounts
  • Expiry Date: For cards (month/year)
  • Brand: Visa, Mastercard, Amex, etc.
  • Billing Address: Address associated with payment method
  • Created Date: When payment method was added

Query Parameters:

allowRevokedMethod (optional, default: false):

  • false: Returns only active, usable payment methods
  • true: Returns both active AND revoked payment methods

Revoked Payment Methods: Include expired cards, deleted payment methods, failed instruments, and customer-removed methods. Useful for historical records and troubleshooting, but cannot be used for new billing attempts.

Use Cases:

1. Customer Portal:

  • Display saved payment methods
  • Allow customer to select default payment method
  • Show payment method update/delete options
  • Validate payment methods before subscription modification

2. Subscription Management:

  • Verify customer has valid payment method before creating subscription
  • Check payment method expiry before next billing
  • Identify subscriptions at risk due to expiring cards
  • Prompt customer to update payment if needed

3. Payment Method Updates:

  • List available payment methods for customer selection
  • Identify payment instrument ID for update operations
  • Validate payment method before switching subscription

4. Troubleshooting & Support:

  • Debug payment failures
  • Verify which payment method is being used
  • Check if payment method is expired or revoked
  • Assist customer with payment issues

5. Analytics & Alerts:

  • Track payment methods approaching expiry
  • Send proactive notifications to update cards
  • Analyze payment method distribution
  • Identify customers with no valid payment methods

Response Structure:

Returns CustomerPaymentMethodsQuery.PaymentMethods object from Shopify GraphQL:

{
  "nodes": [
    {
      "id": "gid://shopify/CustomerPaymentMethod/abc123",
      "instrument": {
        "__typename": "CustomerCreditCard",
        "brand": "VISA",
        "lastDigits": "4242",
        "expiryMonth": 12,
        "expiryYear": 2025,
        "name": "John Doe"
      },
      "revokedAt": null,
      "revokedReason": null,
      "subscriptionContracts": [...]
    }
  ]
}

Common Scenarios:

Scenario 1: Customer with multiple cards Returns array with multiple payment method objects, each representing a stored card.

Scenario 2: Customer with no payment methods Returns empty nodes array - customer needs to add payment method.

Scenario 3: Expired card included (allowRevokedMethod=true) Returns both active cards and expired/revoked cards with revokedAt timestamp.

Important Considerations:

Data Source:

  • Queries Shopify API in real-time (not Appstle database)
  • Always returns current Shopify payment method state
  • Subject to Shopify API rate limits

Performance:

  • Response time: 300-800ms (depends on Shopify API)
  • Slower than database queries
  • Consider caching for non-critical displays

Security:

  • Never returns full card numbers (PCI compliance)
  • Returns only last 4 digits
  • CVV is never stored or returned
  • Payment instrument IDs are tokenized references

Privacy:

  • Customer ID validated against shop
  • Cannot query payment methods from other shops
  • Requires appropriate API permissions

Best Practices:

  1. Default to Active Only: Use allowRevokedMethod=false for payment selection UIs
  2. Check Expiry Dates: Validate card expiry before using for subscriptions
  3. Cache Responsibly: Cache for short periods (5-10 min) to reduce API calls
  4. Handle Empty Response: Always handle case where customer has no payment methods
  5. Show User-Friendly Names: Display brand and last 4 (e.g., "Visa •••• 4242")
  6. Indicate Default: Highlight the default payment method clearly

Integration Examples:

Example 1: Display payment methods in customer portal

const paymentMethods = await fetch(
  `/api/external/v2/subscription-contract-details/shopify/customer/${customerId}/payment-methods`,
  { headers: { 'X-API-Key': 'your-key' } }
).then(r => r.json());

paymentMethods.nodes.forEach(pm => {
  if (pm.instrument.__typename === 'CustomerCreditCard') {
    console.log(`${pm.instrument.brand} ending in ${pm.instrument.lastDigits}`);
    if (pm.instrument.expiryYear < currentYear) {
      console.warn('Card expired!');
    }
  }
});

Example 2: Check for valid payment before creating subscription

const paymentMethods = await fetch(...);
const hasValidPayment = paymentMethods.nodes.some(pm => 
  !pm.revokedAt && pm.instrument.expiryYear >= currentYear
);

if (!hasValidPayment) {
  alert('Please add a valid payment method before subscribing');
}

Related Endpoints:

  • PUT /api/external/v2/subscription-contracts-update-payment-method - Update subscription payment method
  • POST /api/external/v2/associate-shopify-customer-to-external-payment-gateways - Add external payment method

Authentication: Requires valid X-API-Key header

Path
customerIdinteger(int64)required

Customer Id

Query
allowRevokedMethodboolean

Get revoked payment methods?

Default false
Headers
X-API-Keystring
curl -i -X GET \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contract-details/shopify/customer/{customerId}/payment-methods?allowRevokedMethod=false' \
  -H 'X-API-Key: string'

Responses

Successfully retrieved customer payment methods from Shopify

Bodyapplication/json
get__typenamestring
nodesArray of objects(Node)
pageInfoobject(PageInfo)
Response
application/json
{ "nodes": [ {}, {} ] }

Retrieve customers with subscriptions

Request

Returns a paginated list of customers who have subscription contracts. Supports filtering by customer name, email, and subscription count.

Query
namestring

Filter customers by name (partial match supported)

emailstring

Filter customers by exact email address

activeMoreThanOneSubscriptionboolean

When true, returns only customers who have more than one active subscription

Default false
pageableobject(Pageable)required

Pagination parameters (page number and size)

Example: page=0&size=10&sort=id,desc
pageable.​pageinteger(int32)>= 0
pageable.​sizeinteger(int32)>= 1
pageable.​sortArray of strings
api_keystringDeprecated

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

Headers
X-API-Keystringrequired

API Key for authentication

curl -i -X GET \
  'https://subscription-admin.appstle.com/api/external/v2/subscription-contract-details/customers?name=string&email=string&activeMoreThanOneSubscription=false&page=0&size=10&sort=id%2Cdesc&api_key=string' \
  -H 'X-API-Key: string'

Responses

Successfully retrieved customer list

Bodyapplication/jsonArray [
customerIdinteger(int64)
namestring
emailstring
activeSubscriptionsinteger(int64)
nextOrderDatestring(date-time)
inActiveSubscriptionsinteger(int64)
lifetimeValuenumber(double)
]
Response
application/json
[ { "customerId": 0, "name": "string", "email": "string", "activeSubscriptions": 0, "nextOrderDate": "2019-08-24T14:15:22Z", "inActiveSubscriptions": 0, "lifetimeValue": 0.1 } ]