#razvi073

1 messages · Page 1 of 1 (latest)

wheat pecanBOT
eager plank
#

hi! you would use confirmSetup (not confirmCardSetup) but yes, it works.

jolly parrot
#

on the backend currently I am using stripe.subscriptions.create for this subscription that also has a trial, what method should I change it with in order to get a setupIntent instead of the payment_intent?

eager plank
#

there would be pending_setup_intent on the Subscription object and you can use that

jolly parrot
#

weeklySubscription.pending_setup_intent['client_secret'], this is the intent that i sent to the confirmSetup method

#

but after trying that I received an error

#

give me 1 sec

jolly parrot
#

"Payment details were collected through Stripe Elements using automatic payment methods and cannot be confirmed with a Setup Intent configured with payment_method_types." this is the error I am receiving and from what I searched payment_method_types is something I need to setup in the front-end, but I don't know where exactly

eager plank
#

can you share the exact code used to

  • create the Subscription
  • confirm the SetupIntent on the frontend
  • share the SetupIntent ID seti_xxx
jolly parrot
#

let weeklySubscription: any = await stripe.subscriptions.create({ customer: customer.id, items: [ { price: weeklyPrice, }, ], payment_behavior: 'default_incomplete', payment_settings: { save_default_payment_method: 'on_subscription', }, expand: ['latest_invoice.payment_intent', 'pending_setup_intent'], trial_end: weeklyTrialEndDate, });

eager plank
#

but yeah it's an annoying pit of edge cases you fall into here due to differences in how Subscriptions work versus creating SIs directly, sorry

jolly parrot
#

then after that i send pendingIntent: weeklySubscription.pending_setup_intent['client_secret'], to the front-end

#

error = await this.stripe.confirmSetup({ elements: elements, clientSecret: pendingIntent, confirmParams: { return_url: 'https://chat.thebiblechat.app/download', }, }); and this is how i try to confirm it in the front-end

#

this.elements = this.stripe.elements({ mode: 'setup', currency: this.allData.currency.toLowerCase(), amount: this.allData.weeklyProductPrice, });

#

and this is the elements object I use

eager plank
#

thanks, that's helpful. And what's the SetupIntent ID seti_xxx where you're getting an error?

jolly parrot
#

I get a new one everytime but let's say for "seti_1NrfrYHPmb4c2WP93SeVO0TP_secret_OezrNoYvcigUlrb2Mae4PlsxIbouu0W"

#

so "seti_1NrfrYHPmb4c2WP93SeVO0TP"

eager plank
#

ok I think I was wrong then and you'd need to use confirmCardSetup instead of confirmSetup

#

confirmSetup would only work if you created the SetupIntent yourself and used automatic_payment_methods, but here the Subscription creates the SetupIntent and explicitly sets the payment method types instead, so confirmSetup doesn't work with it. Sorry, it's a mess.

jolly parrot
#

bro trust me, our codebase is also a mess

#

so how should I go about doing this?

eager plank
#

honestly I don't know, since confirmCardSetup can't take an ExpressCheckoutElement. I'm not sure this is even possible unfortunately

jolly parrot
#

So would there be another way to get a subscription with a 3 day trial and confirm it with the expressCheckoutElement?

glossy pivot
#

👋 taking over for my colleague. Let me catch up.

jolly parrot
#

ow hi again @glossy pivot

eager plank
jolly parrot
#

does it support paypall?

eager plank
#

no

#

so yeah, might be impossible unfortunately until we add more functionality to ExpressCheckoutElement and make it work better with Subscritions, but Tarzan will investigate the options

jolly parrot
#

I was using the PaymentRequestButton , but for some reason inside the tiktok browser I was not receiving anything from the canMakePayment() method. So I thought that maybe the expressCheckout would solve this issue by also adding the other options....

eager plank
#

I doubt that would change anything, things not working inside embedded browsers would be the same and is caused by the app(TikTok)'s implementation rather than anything you'd control(you would just need to fall back to a regular card form)

jolly parrot
#

are there any elements like the classic checkout page that includes all the payment methods including card, and also comes up from the bottom of the screen on mobile without needing a redirect?

#

or let me rephrase that, what would you use in the case that you'd want to guarantee that the customer has a a way to pay in any app browser, while also trying to keep the flow as frictionless as possible?

glacial mauve
#

Hi! I'm taking over from my colleague. Please, give me a moment to catch up.

#

By "classic checkout page" you mean Stripe Checkout?

jolly parrot
#

yes, but I wanted a way to reduce friction by not redirecting to another page

#

and also by providing some sort of one click payment by auto detecting the paymentMethod, but the tiktok browser doesn't like that very much

glacial mauve
jolly parrot
#

it shows all the payment method available?

#

including paypall I mean?

glacial mauve
#

Yes, depending on the customer location.

jolly parrot
#

and it also supports subscriptions with trials?

glacial mauve
#

Yes

jolly parrot
#

could I try to use the PaymentRequestButton first and in the case that the canMakePayment() returns null, launch the Payment Element instead with the same setup_intent?

glacial mauve
#

Sure, you can try this.

jolly parrot
#

I'll try it like this then, thanks a bunch

glacial mauve
#

Happy to help!