#MarceloOlandim
1 messages ยท Page 1 of 1 (latest)
Hello ๐ I think that's expected.
https://stripe.com/docs/billing/subscriptions/subscription-schedules#managing
If you want, you can create the subscription with your old approach and add a schedule later on once its been created
https://stripe.com/docs/billing/subscriptions/subscription-schedules/use-cases#existing-subscription
Okay, I can have a goal with this approach
NO
I dont think it will work. That is because I am applying the coupon on the scheduler, not in the subscrition, and I am getting the secret payment from the subscription object, not from the scheduler.
You are applying coupon on a phase, which is what subscription would use. Subscription Schedule object can do nothing with the discount/coupon here.
And is not possible to set phases when u creating a scheduler with a subscription:
```You cannot set phases if from_subscription is set.',
That is what is say on the official documentation.
Using coupons
Sometimes The Pacific runs subscription specials. The schedule below starts the customer on the print publication at 50% off for six months. The schedule removes the coupon from the subscription in the second phase, which entails the remaining six months.
curl
Ruby
Python
PHP
Java
Node
Go
.NET
server.js
// Set your secret key. Remember to switch to your live secret key in production.
// See your keys here: https://dashboard.stripe.com/apikeys
const stripe = require('stripe')('sk_test_51LBf6nC6SiKqhq3NkhNwL45DFBkojwwHqQFMYbaJI9mIxWwRDhDmlxGAM8fH8KyLQakKcQ9R8B0kg3rw4Md6ahwZ00bZJW5v3y');
const schedule = await stripe.subscriptionSchedules.create({
customer: 'cus_G8BQyXLV4wIrlu',
start_date: 'now',
end_behavior: 'release',
phases: [
{
items: [{price: '{{PRICE_PRINT}}', quantity: 1}],
iterations: 6,
coupon: 'co_50_percent_off',
},
{
items: [{price: '{{PRICE_PRINT}}', quantity: 1}],
iterations: 6,
},
],
});
You'd need to create the schedule first and then make an update request for phases
That is not what the documentain says
and there is no example in how to update phases
https://stripe.com/docs/api/subscription_schedules/update
I'm referring to Update a Schedule endpoint here
It clearly has a phases parameter
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I cannot create a subscription scheduler based on a subscription that hasnt been paid yet:
Just got this error:
```'You cannot migrate a subscription that is currently in the incomplete status. It must be in active, past_due, unpaid, trialing status to be released.',
You wanted to take the payment for the subscription first right?
Yes..
User pays for a membership where the billing cicle is annual, but we want to offer the first 3 months for 1 pound
Right, so the flow here would look like following:
1/ You create a subscription for the 1 pound price
2/ Once your customer pays, you'd receive an invoice.paid webhook event
3/ Once you receive that event, you can call the SubscriptionSchedule.create(...) to create a schedule from the subscription that's now active
4/ Then you call SubscriptionSchedule.update(...) and update the phases of the schedule
okay, that makes sense. I will try it out
but, since the memberhsp will already start with 1 pound, I dont need to pass this requirement to the scheduler, what I need to have is a scheduler where after 3 months I should charge the full amount of the subscription.
How to achieve this ?
You change the price ID in the next phase
OR what you can do is create subscription with a coupon & then remove the coupon on the next phase
My doubts is to define the next phase logic.
I knew how to trigger a phase after 3 months, by ssetting the initial phase, the first phase of the phases array to have a end_date of 3 months, but in this case, there is no logic required for the next 3 months
that's correct, if you want to only remove the coupon then It would be something like
{
items: [{ price: annualStripePriceId, quantity: 1 }],
end_date: getUnixTime(addMonths(new Date(), 6)),
coupon: 'couponId',
},
{
items: [{ price: annualStripePriceId, quantity: 1 }],
coupon: ''
}
],```
would recommend testing though (I'll try and run a test too)
I dont think it worked. I can see no reference of the next invoice for the next 6 months
in the stripe console
sub_1MqzGSC6SiKqhq3NlQpzzJLm
I see that the schedule was created
https://dashboard.stripe.com/test/events/evt_1MqzJ3C6SiKqhq3N7KLKLBKE