#adelvalle
1 messages ยท Page 1 of 1 (latest)
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.
great!
Can i ask you another problem?
of course!
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!!!!
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?
no
but with card it works fine
the p`rocess is all on the same page
i send u an example
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.
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.
not really, you create the PaymentIntent on the backend. Then you send it to the frontend. The PaymentElement component from our stripe.js library handles creating any PaymentMethod needed and processing the payment.
https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements
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.
1 : you create the PaymentIntent on the backend--> I cant do it because I don't have the prices yet, so I create SetupIntent
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.
Ok
Yes, I think that it is better to have the payment page after you selected the product. Not all together
๐ taking over for my colleague. Let me know if there's any follow-up Qs I can answer!
Thank you!!!