#farhanah_77012
1 messages · Page 1 of 1 (latest)
Hello farhanah_77012, 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.
• farhanah_77012, 14 minutes ago, 35 messages
• farhanah_77012, 2 hours ago, 14 messages
• farhanah_77012, 5 hours ago, 29 messages
• farhanah_77012, 6 hours ago, 2 messages
• farhanah_77012, 7 hours ago, 10 messages
• farhanah-portal-cancel, 1 day ago, 9 messages
here is the code for reference: await stripe.api.billingPortal.configurations.create({
features: {
subscription_cancel: {
enabled: true,
mode: "immediately",
cancellation_reason: {
enabled: true,
options: [
"customer_service",
"low_quality",
"missing_features",
"switched_service",
"too_complex",
"too_expensive",
"unused",
"other",
],
},
},
invoice_history: {
enabled: true,
},
payment_method_update: {
enabled: true,
},
},
business_profile: {
privacy_policy_url: “x”,
terms_of_service_url:
“Y”,
},
metadata: {
customer: input.customerId,
},
default_return_url: input.default_return_url,
});
Hello! That code looks like it should be enabling the cancel option. Can you share the code where you're using this configuration?
uh so im using nextjs with trpc . i create the portal configuration first and then use the id and pass it to the portal session
and its all linked to a button
Right, that's the code I want to see. Alternatively, can you share the request ID where you create the session? Here's how you can find a request ID: https://support.stripe.com/questions/finding-the-id-for-an-api-request
here is the code :
export const StripeButton = (props: { customerId: string }) => {
const { customerId } = props;
const { data: configurationPortal } =
api.stripe.configureBillingPortal.useQuery({
customerId: customerId,
default_return_url: “x”,
});
const { data: billingSession } = api.stripe.getBillingPortalSession.useQuery(
{
customerId,
return_url:
(typeof window !== "undefined" && window.location.href) ||
“X”,
configurationId: configurationPortal ? configurationPortal.id : "",
},
);
return (
<Button
disabled={!Boolean(billingSession) || !Boolean(configurationPortal)}
href={billingSession?.url || ""}
target="_blank"
rel="noreferrer"
>
</Button>
);
};
req id: req_KCxTuP0zFRt8NA
Looking, hang on...
it shows enabled is false for subscription_cancellation in my log, but i'm explicitly setting it to true in my api call
You mean the cancelation_reason?
this right here in my log: "subscription_cancel": {
"cancellation_reason": {
"enabled": false,
"options": [
"too_expensive",
"missing_features",
"switched_service",
"unused",
"other"
]
},
oh wait nvm im readin gthe wrong field for the wrong property
Yeah, that's the enabled property under cancellation_reason.
its been a day apologies. do u see any other reason for the cancel button to not show?
Oh, the Subscription is being managed by a Subscription Schedule.
That's probably it.
in this case, my user downgrades so i applied a sub schedule so the downgrade takes effect end of their billing cycle
is there a workaround for when a user downgrades and then wants to cancel their subscription? meaning for that button to show up
Ah, yep, that's it. It's mentioned as a limitation in the docs here: https://stripe.com/docs/customer-management#customer-portal-limitations
Customers can’t update or cancel subscriptions that currently have an update scheduled with a subscription schedule.
There is no workaround other than not using a Subscription Schedule.
would my only option be to create my own cancel subscription button for when a user downgrades their paln?
Yes, if you want to continue using Subscription Schedules.