#oftysterista_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/1331187048782106727
📝 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.
- oftysterista_best-practices, 9 minutes ago, 25 messages
- oftysterista_api, 3 hours ago, 15 messages
default_payment_method
string
ID of the default payment method for the subscription. It must belong to the customer associated with the subscription. This takes precedence over default_source. If neither are set, invoices will use the customer’s invoice_settings.default_payment_method or default_source.
i have read this in the api explorer
in the subscription object. what key that define this subsciption paid using what method
basicly my question is how do user change their payment method let say the credit card for the next billing period
Yes you should set default_payment_method on the Subscription object. Right now there's no PM to future invoice payments will fail
when i create the subscription and paid for the first time, why the default_payment_method is null?
Because you didn't pass this param: https://docs.stripe.com/api/subscriptions/create#create_subscription-payment_settings-save_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.
what happend if it is null?
If you set that to on_subscription then we save the PM used to pay the initial invoice as the default for future invoices
The behaviour I explained above – future invoices will be unpaid and require manual payment
PM stands for payment method?
Yes
wait
let me try to summarize
so when i create a subscription,
const subscription = await this.stripeClient.subscriptions.create({
customer: stripeCustomer.customerId,
items: [
{
price: prices.data[0].id,
},
],
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent'],
})
this will create a suscription and will make the default_payment_method to null?
if the default_payment_method is null, the next period user will not be charge automatically but have to do it manually?
Yes and we won't save the payment method you use when confirming the intent (to start ther subscription)
so how can i make it automatically paid the next month?
I just explained how
await this.stripeClient.subscriptions.create({
customer: stripeCustomer.customerId,
items: [
{
price: prices.data[0].id,
},
],
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent'],
payment_settings: {
save_default_payment_method: 'on_subscription',
},
}))
okay i have set it like this
so if i use on_subscription it means it will save the PM that the user use when paid for the first time?
Yes exactly
So the payment details used to pay the first invoice, when you confirm the intent, will be saved and set as default_payment_method to be used to automatically pay future invoices
okayy then if the user want to change the PM for that subscription, i just need to update the default_payment_method in the subscription?
Yes
is that possible is 1 customer has multiple subs in 1 product?
Sure
to create a payment method is there something like embeded component for the user to input the card number or something?
okayy will read and try it first