#akashpatil7596_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/1380457288279527424
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
It's because you passed payment_behaviour: 'default_incomplete' when you created the Subscription. There's an additional step required to confirm the invoice's payment
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Or, if you omit that parameter, it should complete automatically and transition to paid/active assuming the customer has a saved/default PM
I didn't pass the payment_behaviour
return await this.stripe.paymentIntents.create({
amount: price * 100, // Price amount in cents
currency: 'USD',
customer: customerId,
metadata,
payment_method: payment_method_id,
});
This is all I created.
Ok you mean complete payment automatically when invoice created?
You did โ you can clearly see it included in the log of the request: https://dashboard.stripe.com/test/logs/req_rFG8uKes7ARFYb
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Ok How to do that from API side?
Remove the payment_behavior parameter from your request
But I did not do from my code side, is there possibility it's default behaviour of stripe if I don't pass parameter
Ok and write what instead?
async createSubscription({ customerId, priceId, coupon }: CreateSubscriptionPrams) {
try {
return await this.stripe.subscriptions.create({
customer: customerId,
items: [{ price: priceId }],
payment_behavior: 'default_incomplete',
expand: ['latest_invoice.payment_intent'],
collection_method: 'charge_automatically',
...(coupon ? { discounts: [{ coupon }] } : {}),
});
} catch (error) {
logger.error('error', error);
throw new HttpException(
500,
error?.raw?.message ? error?.raw?.message : error?.code ? (error?.code as any) : 'SOMETHING_WRONG',
error
);
}
}
Sorry but something in your integration is setting/including that parameter. We don't include parameters by default, and default_incomplete is not the default value
Just remove it
It's right there in the code:
Yes you are right
But I'm thinking whenever the invoice created I finalized and pay it manually from API
Is it more sufficient than the solution you gave or same?
That includes additional steps/API requests. If you remove that param, we'll do both of those automatically
Yes