Is it possible to send a native Invoice Email for a new Subscription (Selling Plan)?

Hi,

I’m currently building a custom subscription app and I’ve hit a roadblock regarding the “Subscription Proposal” workflow.

The Goal: I want to create a contract/checkout for a specific customer + product + selling plan, and trigger a native Shopify email (like the “Complete your purchase” invoice) so the customer can click a link and activate the subscription.

The Problem: I cannot find a way to combine “Selling Plans” with Shopify’s native invoicing system (orderInvoiceSend). Here is what I have tried:

Attempt 1: Draft Orders (The Standard Way) I tried using draftOrderCreate.

  • Result: DraftOrderLineItemInput does not accept a sellingPlanId.

  • Outcome: I can send an invoice, but the resulting checkout is for a one-time purchase, not a subscription. The selling plan is stripped out.

Attempt 2: “Pending” Orders (The Workaround) I tried using orderCreate with financialStatus: "PENDING" and status: "OPEN", hoping to create an unpaid order and then use orderInvoiceSend.

  • Result: API Error: Variable $order of type OrderCreateOrderInput! was provided invalid value for lineItems.0.sellingPlanId (Field is not defined on OrderCreateLineItemInput)

  • Outcome: It seems I cannot attach a selling plan to an order during creation via the Admin API.

Attempt 3: Storefront API (Current Solution) I am currently using cartCreate via the Storefront API.

  • Result: This works perfectly for generating a checkout URL that does include the subscription (Selling Plan).

  • Outcome: However, I now have the URL, but I cannot trigger Shopify to email this URL to the customer. I have to send the email manually using an external service (AWS SES/SendGrid), which introduces domain verification and deliverability issues for my merchants.

My Question: Is there any Admin API mutation that allows us to create an unpaid order/draft with a sellingPlanId so we can use the native orderInvoiceSend mutation?

Or is the “Storefront Cart URL + External Email Service” strictly the only way to handle manual subscription creation?

Thanks!

1 Like

Hi @Liang_Chu,

I can confirm that both Draft Orders, created from the Admin and API, and Orders created from the API, do not support adding subscription products at this time.

You are correct that the best workaround for this is to use the Storefront API to create a cart with the selling plan included, then send the customer to the checkoutUrl provided from the cart object.

I do have a bit of a workaround that you may be able to use in order to send the checkoutUrl to the customers directly through Shopify Email, without needing to implement external email services, using Shopify Flow and Shopify Email Marketing Automations.

Essentially this workaround uses customer tags to store the checkoutUrl value, then Shopify Flow will trigger a marketing email when a customer has the tag added, that will send a customized Shopify Email, which can link to the checkout directly via the value from the customer tag.

I did test this on my own test store and can confirm that the full workflow does work as expected:

  1. Storefront API creates the cart with the selling plan and returns the checkoutUrl
  2. Admin API adds a customer tag with the tagsAdd mutation.
    • adds tag like checkout_url:www.examplecheckouturl.com
  3. Shopify Flow / Marketing Automation:
    • Trigger: Customer Tags Added
    • Condition: Tags start with checkout_url:
    • Action: Send Marketing Email

In the Shopify Email app, you’d have to create a custom email template to automate the subscription invoice emails sent, and you can use the following Liquid code to retreive and link the checkoutUrl from the customer’s tags.

{% for tag in customer.tags %}
  {% if tag contains 'checkout_url:' %}
    {% assign checkout_url = tag | remove: 'checkout_url:' %}
    <a href="{{ checkout_url }}">Complete Your Subscription Purchase</a>
    {% break %}
  {% endif %}
{% endfor %}

Here’s some additional documentation on working with Shopify Flow and Email Automation.