#adelvalle

1 messages ยท Page 1 of 1 (latest)

past etherBOT
harsh chasm
#

hi, having a look

#

it's because the Price you're using has 'exclusive' tax behaviour defined, but the TaxRate object you pass specified 'inclusive' tax. You'd have to change one of those so they match.

oblique wasp
#

ahh ok! I will change it. Thank you!! ๐Ÿ™‚

#

OK!! thank you!! I works!!

#

it works

harsh chasm
#

great!

oblique wasp
#

Can i ask you another problem?

harsh chasm
#

of course!

oblique wasp
#

I am including two types of payment, klarna and sepa_debit to make payments in javascript. And I'm using:

var paymentElement = elements.create("payment");
paymentElement.mount("#payment-element");

But when I want to call :
stripe
.createPaymentMethod({
type: 'card',
card: paymentElement,
billing_details: {
name: billingName,
},
})...

I does not work because it is an element, not a card. Any idea how to implement with elements?
Thank you!!!!

harsh chasm
#

generally I'd recommend not calling createPaymentMethod. You shouldn't be creating PaymentMethods and sending them to a backend server, the usual integration is that you create a PaymentIntent on the backend and send it to the frontend, where you call confirmPayment to process the payment.

#

was there a specific reason you wanted to use createPaymentMethod?

oblique wasp
#

no

#

but with card it works fine

#

the p`rocess is all on the same page

#

i send u an example

harsh chasm
#

yep, but it's not really the default or documented integration, as I say. Creating a PaymentMethod on the frontend and sending to the backend to process a payment is the old way of doing things, and is not compatible with a lot of payment method types.

oblique wasp
#

okok

harsh chasm
#

for example, you mention Klarna. Klarna is explicitly a payment method where there's a redirect to a page on klarna.com and the customer pays there. So it's driven from the frontend. I.e. you you create a PaymentIntent on the backend and send it to the frontend, where you call confirmPayment to process the payment, and the frontend here would redirect the browser to Klarna.

#

that's what's in all our docs.

oblique wasp
#

okok

#

Ok, so,...

#

I have to create the paymentMethod on the back

#

okok!!

harsh chasm
#

if you want to use PaymentElement, it's going to involve redesigning your overall flow to match the current Stripe paradigm where the payment happens on the frontend.

oblique wasp
#

1 : you create the PaymentIntent on the backend--> I cant do it because I don't have the prices yet, so I create SetupIntent

harsh chasm
#

that's what I mean about redesigning your flow. You might want to ask the customer what they're buying on a page before you have the payment page, so you can create the PaymentIntent.

#

definitely don't use a SetupIntent here just to then try to charge the payment method a moment later, that's not really going to work.

oblique wasp
#

Ok

#

Yes, I think that it is better to have the payment page after you selected the product. Not all together

sweet ferry
#

๐Ÿ‘‹ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!

oblique wasp
#

Thank you!!!