#akashpatil7596_api

1 messages ยท Page 1 of 1 (latest)

hollow ferryBOT
#

๐Ÿ‘‹ 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.

open shadow
#

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

#

Or, if you omit that parameter, it should complete automatically and transition to paid/active assuming the customer has a saved/default PM

granite mural
#

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.

granite mural
open shadow
granite mural
open shadow
#

Remove the payment_behavior parameter from your request

granite mural
granite mural
#
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
      );
    }
  }
open shadow
#

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

open shadow
granite mural
#

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?

open shadow
#

That includes additional steps/API requests. If you remove that param, we'll do both of those automatically

granite mural
#

Okay done

#

Only remove it right? no addition?

open shadow
#

Yes