Error creating contracts using shopify post-purchase extension

Topic summary

Issue: A Shopify post-purchase extension successfully adds a subscription product to the order but fails to create the subscription contract, returning “subscription_contract_creation_error” for selling_plan_id 848658599.

Key details:

  • Post-purchase extension: offers a subscription after checkout; expected to create a subscription contract (the ongoing billing agreement) tied to a selling plan (defines subscription terms).
  • Changeset provided by the merchant shows sellingPlanId 848691367, not 848658599 noted in logs, indicating a possible ID mismatch.
  • Example order context includes a one-time product (“Batman”) and a subscription product (“Supplement”).

Support investigation:

  • Shopify support requested and reviewed the changeset payload.
  • They observed some subscription contracts were recently created, but the merchant clarified those were from the product page flow, not the post-purchase extension.

Current status:

  • The post-purchase flow consistently fails (not intermittent) for the provided changeset.
  • Cause remains unclear; investigation is ongoing.

Open items:

  • Confirm the correct sellingPlanId being sent by the post-purchase extension.
  • Determine why contract creation fails specifically in the post-purchase flow.
Summarized with AI on February 25. AI used: gpt-5.

I’ve a shopify post-purchase extension that offer clients a subscription, but when the custumer accepts the agreement term in the extension and finalize it, the extension insert the subscription product in the order but have an error creating contract:
subscription_contract_creation_error

A subscription contract could not be created for the add_subscription change with selling_plan_id 848658599

But I don’t see any error in my selling plans:

What could be the reason of this error?

Hey ThiagoMine,

Thanks for providing the error message and selling plan ID, that made it easier for me to find your HTTP requests in our logs. I’ll give you an update as soon as I make sense of what’s happening.

Cheers,
Jerome

Hey ThiagoMine,

In order to progress with the investigation, I would need to know the changeset payload that you’re applying for the order above (Batman as the one-time product, and Supplement as the subscription). Could you share this information with me please?

Cheers,
Jerome

Hi J-ROM,

Follow the changeset:

Hi @J-ROM

I notice that I post the changeset as a image, to facility yor job I’m posting it in text:

{
“referenceId”: “0845b0b2c124809f67dec9688ebe30b3”,
“changes”: [
{
“type”: “add_subscription”,
“variantId”: “41620706557119”,
“quantity”: 1,
“sellingPlanId”: “848691367”,
“initialShippingPrice”: 2,
“recurringShippingPrice”: 5,
“discount”: {
“value”: 15,
“valueType”: “percentage”,
“title”: “15% off”
},
“shippingOption”: {
“title”: “Subscription shipping line”,
“presentmentTitle”: “Subscription shipping line”
}
}
]
}

Thank you ThiagoMine. The only surprising thing in this changeset is the selling plan ID. I was expecting 848658599 rather than 848691367 from what I saw in our logs.

I see some subscription contracts created recently. Does the post-purchase extension create the contracts successfully now? If not, is the problem intermittent or always happening for a given changeset?

Cheers,
Jerome

Hi @J-ROM

The subscriptions generated was made using other ways (product page), the problem persist and is not intermitent it happens always