For discussing the development and integration of subscription-enabled shops using Shopify's Subscription APIs.
There's an easily reproducible bug right now with automatic product discount codes and subscription billings. If you create an automatic discount code thats an Amount off Product that applies to all recurring payments, the original checkout works just fine but any renewal (ie billing attempt) of the resulting subscription contract will fail with the generic error code `UNEXPECTED_ERROR`.
Below are steps to reproduce, an example discount code screenshot and Id and an example subscription contract gId and billing attempt gId:
Steps to reproduce:
Example discount code screenshot:
Example Discount Id: 1369508380974
Example Subscription Contract gId with discount ^ above: gid://shopify/SubscriptionContract/12478939438
Example failed Billing Attempt gId from contract ^ above: gid://shopify/SubscriptionBillingAttempt/36484415790
This is causing merchants' subscription contracts to fail to bill without even attempting to bill the payment methods.
Any help would be greatly appreciated! Thank you : )
Hi @Brian_S! I found some logs for this specific failure and what I'm seeing is:
{:"discount_applications.price_rule_id"=>["can't be blank"]}
I dug into your discounts/contracts data and eventually found the discounts for that subscription, which appears like it may have been somehow duplicated? I see the same UUID, one has a price_rule_id, the other is blank.
I'll forward my findings onto the team to see what we can figure out!
EDIT: Spoke with the team and we tried to reproduce this issue, but nothing wrong happened on rebilling. And when I checked the database, we only show 1 entry for our automatic discount. I'm wondering if this is possibly a bug in your subscriptions app you are using, where it is accidentally generating duplicate subscriptions_discounts?
Josh (aka Master Chief) | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks for the response @JoshArnold !
The reason you see that duplicate discount is because we had to create a method to correct our merchant's issue so we found that by removing the original discount and adding a completely identical manual discount that we solved the issue. We tested on the subscription contracts for this store so it would make sense for you to see the duplicate manual discounts. However, this is a very difficult thing to do proactively and seems like it shouldn't have to be done. It is odd that you have identical UUIDs for a manual discount that was added by shopify and one that was added by me via API but I don't know enough about your BE system.
It's easy for me to reproduce this (see steps above) so I've created another subscription contract that's in the state I describe that you should be able to check and only see a single discount for:
Example Discount Id: 1369508380974 (same one)
Example Subscription Contract gId with discount ^ above: gid://shopify/SubscriptionContract/12493193518
Example failed Billing Attempt gId from contract ^ above: gid://shopify/SubscriptionBillingAttempt/36580131118
I'm reviewing your screenshot again. It seems odd that an automatic discount code was able to get added twice, isnt it? Automatic discount codes aren't like normal discount codes as far as I'm aware. They can't be added via any API (only by Shopify at checkout). Seems like something strange is going on.
Agreed. It may have been a one-off scenario with a weird checkout/order issue. If you create a brand new automatic discount does it have the same issues as this one? We have created an issue on our end to see if we can find any other instances of duplication and see if this is a recent trend or just a one-off issue.
Josh (aka Master Chief) | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Thanks @JoshArnold! It doesn't seem one-off because it's 100% replicable across shops/discounts/customers/subscriptions/etc. Let me know if there's anything else we can do to support you and the team.
If you create a brand new automatic discount does it have the same issues as this one?
yes - my team and I are easily able to replicate it on any shop following those ^ steps. Let me know if you'd like more examples
We are still unable to reproduce this on multiple test shops. Please do send over examples from other stores if you have them!
Josh (aka Master Chief) | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
No problem! These values are from a new shop:
and here are some from another:
Any more followup @JoshArnold ? We're having more and more subs that we're not able to bill through Shopify's APIs because of this.
I just found the thing that seems to break the automatic discount, though it doesn't make much sense why it'd break it.
This should help you replicate it though @JoshArnold
Updated teps to reproduce:
The same thing happens even if you just change the sellingPlanName on the line with the discount (it doesn't have to be removed)
Oh wow.. its even worse than that. All I have to do is make ANY change to the line with the discount. If I update the quantity it breaks it too.
I've confirmed this in multiple apps now
Hi Brian, thank you for the update! I've shared the new details with the team and bumped up the issue severity. Can you give me a sense of the volume of subscriptions impacted by this? Are they all using a specific Subscriptions app?
Also, can you clarify why this new step is being done? Apologies if the answer should be obvious to me 😅
"[NEW STEP] Remove the sellingPlanName OR remove the sellingPlanId from the line the discount has been applied to"
EDIT: I see you found out it is related to any change to the line with the discount and is impacting multiple apps. That is very helpful new information, thank you!
Josh (aka Master Chief) | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Hey @JoshArnold ,
We have been facing the same issue across a few of our stores where hundreds of subscriptions have the same billing failures with automatic discounts. Here is the ticket id for reference: 46118288
Please do let us know when we can expect a resolution on this.
Thanks.
Hi @Alex409,
I've bumped this back up to the team and they are going to reprioritize this. I can't give a specific timeframe on the resolution, but it will be worked on again this week.
So sorry for the long delay on this solution!
Josh (aka Master Chief) | Shopify
- Was my reply helpful? Click Like to let me know!
- Was your question answered? Mark it as an Accepted Solution
- To learn more visit Shopify.dev or the Shopify Web Design and Development Blog
Seems like maybe this got fixed. You know if it got worked on @JoshArnold?