#Isantaniello - element layout
1 messages · Page 1 of 1 (latest)
Sounds like you are using the card element. You'd have to use the payment element for that
I'm new, sorry
stripe.elements()
elements.create('card', {
hidePostalCode: true
});
I want to show it
but in my page it appears like...
is it correct?
No, that's the card element. You want the payment element: https://stripe.com/docs/payments/payment-element
The PaymentElement expands into multiple lines like you described. It also can accept multiple payment methods, whereas the card element can only accept card payments
I recommend reading the links I shared
sorry for my question. I read
No worries!
We're here to help
If you have any questions after reading more about the PaymentElement, then feel free to come back and ask
can I ask other question?
I'm developing a mobile app, not web app.
In the docs I read:
const {error} = await stripe.confirmPayment({
//Elements instance that was used to create the Payment Element
elements,
confirmParams: {
return_url: 'https://example.com/order/123/complete',
},
});
if (error) {
// This point will only be reached if there is an immediate error when
// confirming the payment. Show error to your customer (for example, payment
// details incomplete)
const messageContainer = document.querySelector('#error-message');
messageContainer.textContent = error.message;
} else {
// Your customer will be redirected to your return_url. For some payment
// methods like iDEAL, your customer will be redirected to an intermediate
// site first to authorize the payment, then redirected to the return_url.
}
return_url is required?
because with card element I can catch response in mobile app
You can set redirect to if_required to avoid the redirect for non-redirect payment methods: https://stripe.com/docs/js/payment_intents/confirm_payment#confirm_payment_intent-options-redirect
But some payment methods require a redirect, that's why you must always pass a return_url
non understood very well
this.stripe.confirmPayment({
elements,
confirmParams: {
return_url: 'if_required',
}
})
is it correct?
No it needs to be:
elements,
confirmParams: {
return_url: '',
},
redirect: 'if_required'
})```
You still need a valid url for return_url
That will always be required
ah ok