#shubhamjha-subschedules
1 messages · Page 1 of 1 (latest)
Can you clarify? I'm not understanding the question
i want to know that if i release any suubscrtion shedule id then ANY webhook event call?
what do you meany by "ANY webhook event call"?
Are you asking whether a webhook event will be emitted if you manually release the Subscriptoin Schedule?
yes
I HAVE used checkout.session.completed
customer.subscription.created
customer.subscription.updated
invoice.upcoming
subscription_schedule.canceled
subscription_schedule.created
event in my webhook
so any webhook event where called in this case
?
You should be getting a subscription_schedule.released event for sub schedule releases
ohk
shubhamjha-subschedules
Can I add the option of make crad default in create chekout PAGE IN STRIPE USING NODE JS
What do you mean by "crad"?
PAYMENT METHOD THEY USED DURING CHEKOUT
Ah you mean card, not crad
YES SORYY
can you stop with the all caps?
ONE more thing if a subscrition have upcoming event they dont need to make default payment method but if a shedule subscription where become subscription they dont pay without mking payment method default why?
For Checkout there isn't a way to automatically have the PaymentMEthod be automatically set as the default - but for Subscription mode checkout sessions the payment method will be set as the default for that specific subscription (just not for all of the customer's payments)
ok but what abut shudle subscription?
is their any option by which when creating shedule then we automatically set previous payment method?
Are you just asking how to use an existing payment method with a Subscription Schedule and have it be used automatically in the future?
yes
Gotcha, then you can use the default_settings.default_payment_method parameter when you create the Subscription Schedule (https://stripe.com/docs/api/subscription_schedules/create#create_subscription_schedule-default_settings-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.
await stripe.subscriptionSchedules
.create({
customer: coustomerId,
start_date: moment.tz(expirydate, 'America/New_York').unix(),
end_behavior: 'release',
//end_behavior: 'cancel',
metadata: { payLink: payLink },
phases: [
{
items: items,
},
],
})
.then((response) => {
console.log('done.................')
return response
})
.catch((error) => {
console.log(error)
throw error
})
this is my code
Yeah so you need to use the parameter I just sent you to set the PaymentMEthod
You'd pass it in as a parameter - just like all the other parameters you've been setting
under the pashase/
No, not under the phases
await stripe.subscriptionSchedules
.create({
customer: coustomerId,
start_date: moment.tz(expirydate, 'America/New_York').unix(),
end_behavior: 'release',
metadata: { payLink: payLink },
default_settings: {
default_payment_method: paymentMethodId
},
phases: [
{
items: items,
},
],
})
.then((response) => {
console.log('done.................')
return response
})
.catch((error) => {
look ?
Yup, that looks right to me - but the best thing to do is just test out your code to see if it works.
Yes, but as I said - just test it out and see if it works
That's really the best way to make sure things are correct
If you're not even seeing default_settings.default_payment_method in the request body that means you're not actually running the code you think you are - are you running an old version?
no
Are you 100% certain you're running the code with the changes you made? Try changing something else (like add additional metadata) and see if that also gets reflected in the request
errorMsg: 'paymentMethodId is not defined',
stack: 'ReferenceError: paymentMethodId is not defined\n' +
' at creteSheduleSubscription (C:\Users\User\Downloads\LIVE_MODE_STRIPE\STRIPE ISSUE TEST\rest-api\routes\auth-enable-routes\stripe-details.js:91:33)\n' +
' at ganerateSubId (C:\Users\User\Downloads\LIVE_MODE_STRIPE\STRIPE ISSUE TEST\rest-api\routes\auth-enable-routes\stripe-details.js:19:29)\n' +
' at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n' +
' at async executer (C:\Users\User\Downloads\LIVE_MODE_STRIPE\STRIPE ISSUE TEST\shared\route-builder\helper\route-executer.js:15:24)'
}
}
this error
code is this
await stripe.subscriptionSchedules
.create({
customer: coustomerId,
start_date: moment.tz(expirydate, 'America/New_York').unix(),
end_behavior: 'release',
default_settings: {
default_payment_method: paymentMethodId,
},
metadata: { payLink: payLink },
phases: [
{
items: items,
},
],
})
Did you define a paymentMethodId variable and set it to the payment Method ID?
not whre i get that id?
It depends on how youre integration works - typically the PaymentMEthod would be created client-side or you'd retrieve a PaymentMethod from the list of ones already attached to the customer