#ghost_dev

1 messages · Page 1 of 1 (latest)

prime ingotBOT
#

Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.

fair willow
#

👋 happy to help

normal sun
#

hello

fair willow
#

would you mind elaborating?

normal sun
#

so i show the docs

fair willow
#

unsubscribe for what?

normal sun
#

yeah i want user to use like a form of yours to unsibscribe example

const subscription = await stripe.subscriptions.cancel(
  'sub_1MlPf9LkdIwHu7ixB6VIYRyX'
);
#

is there a form like the one we use to pay but to cancel?

fair willow
normal sun
#

so

#

i saw this

const session = await stripe.billingPortal.sessions.create({
  customer: '{{CUSTOMER_ID}}',
  return_url: 'https://example.com/account/overview',
  flow_data: {
    type: 'subscription_cancel',
    subscription_cancel: {
      subscription: '{{SUBSCRIPTION_ID}}',
    },
    after_completion: {
      type: 'redirect',
      redirect: {
        return_url: 'https://example.com/account/subscription_canceled',
      },
    },
  },
});

so basically the same customer id can have multiple subscriptions i can use {{SUBSCRIPTION_ID}} to show the one i want right?

fair willow
#

yes

normal sun
#

but how can i embed it on client code ?

fair willow
#

you just redirect to the session.url

normal sun
#

trying to figure it out i will need help soon

fair willow
#

basically when you create the session the session object has a URL that you can use to redirect your customer to it

#

once they're done they will be redirected to the return_url you passed in the creation method