Automate Subscription Contract CSV Import?

Hello all,
We are using Shopify in a headless fashion. We have a few front end sites that are essentially the same with the exception of client branding options and custom pricing above the wholesale cost that we set. To facilitate this we set up our own order choreographin app (using a private/offline Shopify APP Token) that exposes an API to these sites, which they can then use to create draft orders. These draft orders provide an invoice URL that takes the user to Shopify checkout where they can complete the process and then webhooks get sent off to our middleware API app, which then updates it’s database to reflect the shopify webhook response (success, failure, etc.) so that the selling site can verify they have access to the products they purchased.

This is working as expected. The problem is that we need to be able to offer subscriptions in this headless format. The problem we encountered is that Shopify doesn’t let us place a subscription contract in a Draft Order and we don’t want to create our own subscription app because that’s just more time in dev recreating the wheel when the shopify subscriptions app does everything we need behind the scenes (once it has the customer/contract data).

A work around I thought of, is we could have our middleware app generate “subscription contract drafts” with an “exported_at” column that has a timestamp of when the contract was last exported and a boolean “needs_export” field so the middleware app can pull up a list of all contracts that need to be imported into shopify and enable one of our employees to export them (which will then mark them as being exported so they don’t get picked up again) from our app and import them into Shopify Subscriptions. This will work as an immediate solution for now, but sometimes people forget to do stuff or make mistakes, so I’d like to make this as automated as possible to cut out the human element.

Is there a way to automate these imports? It would be great if we could send the CSV via an http POST request or email it to an inbox for our store etc. An even better solution would be if the shopify subscriptions app had its own API we could use to do this, or if we could attach these subscription contracts to draft orders and avoid the need for CSV imports completely.

Thanks in advance for any assistance in this matter.

1 Like

I don’t believe that would be possible to automate the csv import. If this were anything other than subscription contract imports, you could use an app like mechanic to automate this without all the overhead of building your own app, but the subscription contract permissions are locked down to the app that created them, so that’s probably a no-go.

Perhaps you could set up a flow to look at subscription contracts and if it’s not seeing any in there for the current day (or previous day as the case may be), send frequent email/slack follow ups to the team to decrease the likelihood of them forgetting to do the manual import.