#imheretolearnbro_api

1 messages ยท Page 1 of 1 (latest)

languid scaffoldBOT
#

๐Ÿ‘‹ 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/1293327054762414143

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

azure lantern
#

Hello! There isn't really the concept of a "resubscription" in Stripe. Once a Subscription is canceled that's it, it's over, and it can't be reactivated. For the "resubscription" you would just create a new Subscription for them.

devout oasis
#

But the problem with that is that it would charge them immediately. But they already payed for the current month.

And I tried creating a new Stripe Checkout Session and changing the billing date to a month ahead but it threw an error saying that goes against the "natural billing date".

So im just stuck thinking what I should do

azure lantern
#

Wait, maybe I'm misunderstanding. When they cancel the first Subscription you don't refund them?

devout oasis
#

Nope

azure lantern
#

So you want their Subscription to remain active for the current period, then cancel after that?

devout oasis
#

Yes so if they pay on October 8

Their session lasts from October 8 to November 8

But on November 8 they will lose access unless they pay again

azure lantern
#

And then if they "un-cancel" you can set that to false.

devout oasis
#

Ohhh so thats what you do

azure lantern
#

Would that work for your use case?

devout oasis
#

I think I get it

#

And how can I provide a link to the user to view their subscription hosted by Stripe so they can do stuff like cancel, change payment info, etc

#

Because right now I'm going into my Stripe dashboard / Subscriptions / Subscription / Cancel Subscription

#

But I want a link the user can use to go to a site hosted by Stripe to do it themselves you know

azure lantern
devout oasis
#

I don't see how this would work for the customer side

Like say I have a customer_id

customer_id = cus_QzgfLRhjPV1234

How can I input this customer_id into the Stripe API to return a link I provide the use to navigate to update the information from the "Customer Portal"

azure lantern
#

Yep, that's it!

devout oasis
#

Your amazing now I have a new problem

A user has two options when it comes to updating a subscription payment

They can click on "Cancel plan" or "Renew plan". My question is that both are recognized as "customer.subscription.updated". How do I differentiate between the two?

A successful "Cancel plan" and a successful "Renew plan" so I can do some logic for ecah

azure lantern
devout oasis
#

Found it!

azure lantern
#

It's there.

devout oasis
#

Sorry

azure lantern
#
    "previous_attributes": {
      "cancel_at": null,
      "cancel_at_period_end": false,
      "canceled_at": null,
      "cancellation_details": {
        "reason": null
      }
    }
devout oasis
#

I did this twice haha

#

Too much apple juice today