#evan_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1295436273015717978
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
Hello, can you tell me more about the issue that the redirect is causing for your page? I double checked and there isn't a way to avoid the redirect here
Also when you say scheduler are you talking about one of our subscription schedules, or is this a scheduler on your side? It looks like our schedules support changing the default PM as part of the phase change if that helps https://docs.stripe.com/api/subscription_schedules/object#subscription_schedule_object-phases-default_payment_method
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
the flow is as follows:
User is downgrading from a plan to another, for downgrading am using the subscription scheduler of stripe, to change the plan_id and price!
if the default payment method specified in the next phase if Paypal (a saved PM of the user) will this require the user to redirect to the verification page of paypal? or will it just change the it and use in the next phase?
If the payment method of the next phase is paypal, having in mind that the downgrade am doing does not take affect, unless the period of the current exisiting subscription ends. will the user need to verify the payment method of paypal when the next phase is about to get excuted and the user is about to be charged?
this is my downgrade function for reference:
const handleDowngradeSubscription = async (
user,
paymentObj,
providerSubscription,
newProviderPlan
) => {
let scheduleId = providerSubscription.schedule
let schedule = null
if (!scheduleId) {
schedule = await stripeGatewayClient.subscriptionSchedules.create({
from_subscription: providerSubscription.id,
})
scheduleId = schedule.id
}
schedule =
await stripeGatewayClient.subscriptionSchedules.retrieve(scheduleId)
const defaultPhase = schedule.phases[0]
await stripeGatewayClient.subscriptionSchedules.update(scheduleId, {
end_behavior: 'release',
phases: [
{
items: defaultPhase.items,
start_date: defaultPhase.start_date,
end_date: defaultPhase.end_date,
metadata: defaultPhase.metadata,
currency: defaultPhase.currency,
},
{
items: [
{
price: newProviderPlan.id,
},
],
start_date: defaultPhase.end_date,
metadata: {
subscriptionPlanId: paymentObj.newSubscriptionPlan.id,
userId: user.id,
discountId: SYSTEM_UUID,
},
},
],
})
return providerSubscription
}
sub_1Q9sPQD9sYh65PYtECMMpZuz
This is a subscription ID that has a schedule attached to it
the schedule should perform the downgrade next year oct 14
the default payment methood of that customer is paypal
Apologies for the delay, the server got busy and I missed your reply for a bit. To save a PayPal payment method you will need to do a full page redirect at some point. If you want to make it part of the downgrade, you can create a SetupIntent, go through the process of confirming it, and then include the new PM Id in the second phase's default_payment_method parameter in that subscription schedule creation call
when oct 14 2025 comes, will the user need to confirm his already saved paypal PM?
To save a PayPal payment method you will need to do a full page redirect at some point.
This is was done, when the user first subscribed with paypal
or changed his payment lets say to paypal
and it became the default Pm of that customer
but when the downgrade time arrives
will customer need any additional steps
or will that be handled automatically?
By default no, but I am not sure if PayPal sometimes requires additional action from users on recurring payments.
Do you already handle 3DS on recurring payments for your users that pay with a card? Handling requires_action for other payment methods should be similar if not the exact same process code-wise
I do have it for intital subscription creation
and for updating payment details for users
I do handle requires_action and setup intent for changing payment methods
Only thing I wanted to check is, if the user will need to do these extra steps again, when the nextpahse of downgrade excutes
for example the subscription I sent above has a schedule
sub_sched_1Q9sUhD9sYh65PYtsRIv6WQz
I can see these
"collection_method": "charge_automatically",
"default_payment_method": "pm_1Q9sQQD9sYh65PYtm5sP49bX",
the default pm id is the customers default paypal method the intially subscribed with and verified
but I donot see other thing related to the intent of the subscription if it would require further actions when the downgrade time comes
Our docs for PayPal subscriptions do mention the requires_action status thought it is unclear when it is used. https://docs.stripe.com/billing/subscriptions/paypal#test-integration
How do you currently handle requires_action on your recurring payments? Do you have Stripe send your customers an email, or do you have your own way of notifying them and then a custom page to handle the next action?
For initially creating subscriptions, if the payment intent_status is set to requires_actions, i basically handle nextActions where it navigates to the paypal test portal where it allows me to memick authorizing the payment or not, based on the redirect status, I proceed with either showing a success or failure page ,,, and save info to my db..
Good, that should handle that upfront. Handling that for recurring payments is the same process, get your user on your site and call handleNextAction which will redirect them
Yeah but my case is not recurring payments
it is downgrade that is attached by a schedule.
The payment that happens when the new phase happens is considered a recurring payment
Does this mean that, I should not be attaching a schedule for downgrade unless the user has returned from handleNextActions with a succeeded redirect status?
So you are handling setup properly upfront, and the first payment at the downgraded price would work the same as any other payment when the subscription cycles
That is up to you, you can definitely let your users downgrade and keep their old PM. It is easy to imagine a scenario where a user tries to add a new PM, can't for some reason, and is fine to keep using their already saved PM until they get things sorted out with their new PM
Okay sounds good, thanks for your time