Skip to main content
This guide is for frontend developers who want to use Appstle’s subscription backend but build their own storefront UI instead of using the default widget. It covers the product page (rendering selling plans, adding subscriptions to cart), the customer portal (viewing and managing active subscriptions), and the JavaScript events you can hook into.
This guide covers the Storefront API surface (/cp/api/...), which is designed for customer-facing storefront code. If you are building a server-side integration, see the Integration guide instead — it covers the Admin API (/api/external/v2/..., authenticated with X-API-Key).

When to build your own vs. use the widget

The Appstle subscription widget (appstle-subscription.js) is injected automatically on your storefront and handles selling-plan rendering, cart integration, and the customer portal out of the box. Build your own frontend when you need:
  • A product page UI that doesn’t match what the widget renders (custom layout, framework-specific components, headless storefronts)
  • A customer portal embedded in your own account page design rather than the default portal
  • Programmatic control over subscription flows (e.g. a React/Vue app that manages state itself)
If you only need to react to widget interactions — tracking analytics, showing/hiding elements, applying conditional logic — you can keep the default widget and listen to its JavaScript events instead of replacing it entirely.

Architecture overview

Appstle’s Storefront APIs are served through Shopify’s App Proxy. When a request hits your shop’s domain at the proxy path, Shopify forwards it to Appstle’s backend with authentication parameters attached.
The default proxy path is /apps/subscriptions. Merchants can customize this in their Shopify admin, but apps/subscriptions is the standard default.
Storefront API requests must go through the App Proxy on your shop’s domain. You cannot call Appstle’s backend directly from the browser — requests that bypass the proxy will fail authentication.

Authentication

The Storefront API does not use API keys. Authentication depends on the context: A few portal endpoints work without a logged-in customer (portal settings, custom CSS, magic link emails). Everything else — viewing contracts, skipping orders, updating addresses — requires the customer to be authenticated through a Shopify session.

Product page: rendering selling plans

On product pages, you typically don’t need the Storefront API at all. Shopify’s native Liquid and Product JSON already include the selling plan data that Appstle configures.

Getting selling plan data from Shopify Liquid

Every Shopify product with subscription selling plans exposes them in the selling_plan_groups array:
You can also access this data as JSON for use in JavaScript:

Getting selling plan data from Shopify Product JSON

For headless or JavaScript-driven storefronts, fetch the product JSON directly:

Getting selling plan data from the Appstle Storefront API

For richer subscription data (beyond what Shopify’s native objects provide), use the Appstle endpoint:
There is also a v2 endpoint that accepts optional variantIds for variant-specific data:
To list all selling plans available in the shop:
For product pages visited by unauthenticated customers, prefer Shopify’s native Liquid objects or Product JSON. The /cp/api/data/ endpoints go through the App Proxy and may require a customer session depending on the shop’s configuration.

Adding a subscription to cart

Adding a subscription item to the Shopify cart uses Shopify’s standard Cart API — you include the selling_plan ID alongside the variant ID.

Using the Cart AJAX API

Using a form

If you prefer a traditional form submission:
Omitting the selling_plan field (or setting it to empty) adds the item as a one-time purchase. If a product has requires_selling_plan: true, the cart add will fail without a valid selling plan ID.

Customer portal: managing subscriptions

Once a customer is logged in, you can call the Storefront API through the App Proxy to build a custom subscription management UI. All of these endpoints are under:
The customer must have an active Shopify session. Shopify’s App Proxy handles authentication automatically.

Identifying the logged-in customer

Returns the Shopify customer ID as an integer. Returns 401 if no customer is logged in.

Listing a customer’s subscriptions

Get the full subscription profile (active, paused, and cancelled contracts):
Or get just the valid (active/paused) contract IDs:
For detailed contract data:

Viewing upcoming and past orders

Upcoming orders for a contract:
Past orders (paginated):

Updating subscription status

Pause, resume, or cancel a subscription:
Optional query parameters for pause: pauseReason, pauseFeedback, pauseDurationCycle.
To cancel with feedback:

Skipping and unskipping orders

Managing line items

Add a product:
Remove a product:
Update quantity:

Discounts

Apply a discount code:
Remove a discount:

Updating shipping address

Request body (application/json):

Changing billing date

Changing frequency

Switch to a compatible selling plan frequency:
Or change billing interval directly:

Portal settings and styling

To load the merchant’s portal configuration (labels, features, display settings):
This endpoint does not require customer authentication — it returns the portal’s display configuration. For custom CSS:
For the full list of Storefront API endpoints with request/response schemas, see the Storefront API group in the sidebar.

Using JavaScript widget events

Even when building a custom UI, the Appstle widget script (appstle-subscription.js) is still loaded on your storefront. It dispatches events on both document and window that you can use to coordinate your custom components with Appstle’s cart and portal logic.

Key events for custom frontends

For the full event reference, see JavaScript hooks.

Listening to events in your custom UI

Widget initialization event

The appstle:subscription-widget:loaded event fires when the widget script has fully initialized. Its detail includes a reference to the widget API:

End-to-end example: custom product page subscription UI

This example shows how to render selling plans, let the customer select one, and add a subscription to cart — all without using the default widget UI.
This example uses Shopify’s native product data and Cart API. It works independently of the Appstle widget. If the widget is also loaded on the page, it will fire AddToCartIntent and SellingPlanSelected events that your other components can listen to.

Further reading

Webhooks

Receive real-time events when subscriptions change.

JavaScript hooks

Complete list of widget events you can listen to.

Authentication

Admin API keys, partner keys, and storefront auth details.

Integration guide

Server-side Admin API integration for backend developers.