Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

We're moving the community! Starting July 7, the current community will be read-only for approx. 2 weeks. You can browse content, but posting will be temporarily unavailable. Learn more

Subscription Proration with Discount Cancellation on Update

Subscription Proration with Discount Cancellation on Update

miladghale
Visitor
1 0 0

I have one app which includes Silver/Gold subscription with monthly and annually

if user is in annual plan, then the discount will applied to customer,

for example:

Planmonthlyannually(with discount)
Silver17$/month12$/monthly(144$/annually)
Gold49$/month39$/monthly(468$/annually)

 

there is one scenario:

If the user is in Silver-annually, and after 6 months using the Silver-annually, he wants to go to Gold-monthly, so the discount which was given to customer must be cancelled, and based on some unused months which he has, he can buy Gold monthly: so based on the following:

he paid 144$  for one year,

his discount must be cancelled( so the price will be 17$/monthly) because of new subscription (Gold-monthly):

for all first 6 months: 17 * 6 = 102, so now user will be credited 144-102 = 42$ based on our custom proration,

now based on 42$, he can register (42/49) * 30 = 25 days for Gold-monthly,

 

I wan to know, how I can handle it in my code? 

because in the https://shopify.dev/api/admin-graphql/2022-04/mutations/appSubscriptionCreate I checked that we dont have update on subscription, so I need to cancel, and then I create the new subscription?

 

or instead of cancelling the subscription, I need to use the shopify contract create/update (https://shopify.dev/api/admin-graphql/2022-07/mutations/subscriptionContractCreate )?

 

if there is one example in code, I will be thankful,

 

thanks,

 

Reply 1 (1)

matart
Shopify Staff (Retired)
31 4 5

Hi @miladghale 

 

Are you referring to an AppSubscription or a SubscriptionContract? The provided links were for 2 different APIs.

To learn more visit the Shopify Help Center or the Community Blog.