Subscriptions with a headless setup - using the Shopify checkout

SpringSummer
Shopify Partner
2 0 3

Currently, I am testing out how to setup subscriptions on a Shopify store with a headless setup. I connect my Nuxt frontend to the store through the Storefront API with GraphQL.

I have been looking at several subscription apps (eg. ReCharge and Native Subscriptions), but I am facing problems when sending the line items to the checkout. I use the checkoutLineItemsAdd mutation (https://shopify.dev/api/storefront/reference/checkouts/checkoutlineitemsadd) but cannot send the selling plan along to pick up the subscription (and subscription discounts) in the checkout.

Can you help me clarify whether it is possible at the current state of Storefront API/headless setups for Shopify stores or not.

Looking forward to hearing from you.

Reply 1 (1)
kaiako
New Member
1 0 0

I've been battling with this question too and found out, that Checkout API does not and will not support subscriptions.

Cart API does support subscriptions, but the cart API redirects users to cart checkout url. Programmatically completing cart like completing Checkout is not supported as of now.

It is as of now not possible to build a headless subscription setup.

 

What i've come up with to provide headless subscription setup (but not put in action yet), is to:

1) Create customer with shippingAddress and paymentMethod

2) Create subscription contract

3) Associate customer with subscription contract

4) Create subscription billing attempt

5) Create order

 

Something similar what Shopify does backend when a subscription product is bought.

 

Not sure if this will work, but kind of sounds legit

Hope someone from Shopify could comment.