#dan1106_best-practices

1 messages ยท Page 1 of 1 (latest)

sturdy badgerBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.

๐Ÿ”— This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1374811909987242047

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

minor pendant
#

Can you clarify what you mean by "30 day non-recurring" subscriptions?

quiet thicket
#

the subscription should notrepeat after a 30 day period

#

but for the 30 days of the subscription it should be active

#

so that I can check if a user has an active membership to my service by checking if they have a subscription

minor pendant
#

I guess I'm not clear. You can get the status of a subscription, easiest way is to listen for our subscription related webhooks. What I'm trying to understand is the difference between Recurring monthly (at price x) and 30 day non-recurring (at price y).

#

And the reason why I'm not clear is because subscriptions are inherently recurring.

quiet thicket
#

sorry, I'm not explaining clearly. I want to sell memberships to a service. I want there to be an option to buy on a recurring basis or a one off basis.

#

the one off membership has a date on which it expires, and it can be active/cancelled/expired

#

the reason I want to use subscriptions for both is because I'm hoping to be able to check that a customer has an active membership by checking if they have an active subscription

#

otherwise I would have to check if they have a subscription, if not do they have a recent purchase, and then do some date math on whether the recent purchase qualifies them as having an active membership

#

I was thinking this is wha tthe Subscription cancel_at field is for -- preventing a subscription from recurring?

pure talon
#

Hi there ๐Ÿ‘‹ jumping in as my teammate needs to step away soon.

Our Subscriptions are designed to facilitate recurring payments. Using a Subscription, but only processing a single payment during it's lifecycle, will require you to implement quite a bit of logic to force those Subscriptions to end.

#

I think the single-time payment would be easier to manage on your end. Once the payment succeeds, you grant the customer access to you service, and then you schedule that access to expire after 30 days.

But if you want to use Subscriptions instead, and have questions about behavior that you're seeing as you're testing those, or stumbling over what parameters to use when, I'm happy to help provide clarity there if you can help me understand what's blocking you right now.

pure talon
quiet thicket
#

Could I create a subscription schedule with a single phase that ends automatically when that first phase ends? If so, can I create a checkout session with that subscription schedule attached?

pure talon
#

Yes you can create a Subscription Schedule that does that, but no you can't use it with Checkout.

#

If you want to use Checkout, you'd:

  1. Create the Checkout Session and let it create the customer's Subscription when they go through the flow
  2. Create a Subscription Schedule from the Subscription
  3. Update the Subscription Schedule to adapt it to do what you're hoping.

I do still think you'll need to worry about prorations getting created, or edge cases when you try to offer a 30-day Subscription using a monthly price during a month with only 28 days (the Sub may try to cycle before you're expecting here and charge your customer again)

quiet thicket
#

I guess with the Checkout component there would be no way to prevent it from displaying the price as "per month", either, because I would in fact be creating a monthly subscription?

sturdy badgerBOT
pure talon
#

Ah, I think you can avoid that, and this approach may sidestep the 28-day month concern I raised above.

When creating the Price object, you can set recurring.interval to day, and recurring.interval_count to 30. That will create a recurring Price that bills every 30 days rather than being tied to any sort of monthly cycle.

quiet thicket
#

gotcha, so in this approach for the non-recurring membership I would:

  1. Create a Checkout Session with a Subscription to a Price that recurs every 30 days
  2. After the Subscription is created, update it to cancel_at_period_end?
pure talon
#

Yup! and letting us cancel the Subscription right at the end of the current billing period should avoid any prorations being created.

quiet thicket
#

in the Checkout flow, would the price would be shown as "$x per 30 days", or is that customizable?

pure talon
#

This is what I see when I test that:

#

Is that what you're hoping for, or what customizations would you want to try to make to that?

#

There is some customizability for Checkout, but not a ton

quiet thicket
#

To remove the "billed every 30 days" language, but I understand why that wouldn't be possible

pure talon
#

Yeah, that isn't possible to remove, because at this point the customer is agreeing to a recurring billing scheme that processes a payment every 30 days.

#

(I'm skimming params again to make sure I'm not forgetting about an option though)

quiet thicket
#

gotcha, ok... I might rig something together like using Checkout to create a one time purchase that on my backend I then create a subscription that ends after 30 days

#

Thanks, I appreciate the help!

pure talon
#

Any time! I hope we were able to point you in the right direction.

quiet thicket
#

Yeah, it seems like I'm trying to use Subscriptions for something they're not really intended for, so there are going to be some trade offs!

pure talon
#

Yup, exactly, sounds like you have a good understanding at this point. You know where to find us if you feel like that changes while you're building out your solution!