#birdy247
1 messages ยท Page 1 of 1 (latest)
Can you share a sample payment intent id?
/v1/payment_intents/pi_3Mmea8Klq6TS8Hna1VyHUpJk/confirm
{
"error": {
"code": "invalid_request_error",
"message": "BAD_VALUE|||Bad value: billing_address.given_name",
"payment_intent": {
"id": "pi_3Mmea8Klq6TS8Hna1VyHUpJk",
"object": "payment_intent",
"amount": 3000,
"amount_details": {
"tip": {
}
},
"automatic_payment_methods": {
"enabled": true
},
"canceled_at": null,
"cancellation_reason": null,
"capture_method": "automatic",
"client_secret": "pi_3Mmea8Klq6TS8Hna1VyHUpJk_secret_mP5HlsVyJY5k5pjbaHa6BnonS",
"confirmation_method": "automatic",
"created": 1679064516,
"currency": "gbp",
"description": "Quick Demo Fundraising Option (JustGiving) - Aaron Bird ## ",
"last_payment_error": null,
"livemode": false,
"next_action": null,
"payment_method": "pm_1MmeaqKlq6TS8Hna9VVDaeGT",
"payment_method_types": [
"card",
"afterpay_clearpay",
"klarna",
"link"
],
"processing": null,
"receipt_email": null,
"setup_future_usage": null,
"shipping": null,
"source": null,
"status": "requires_confirmation"
},
"request_log_url": "https://dashboard.stripe.com/acct_1E0srrKlq6TS8Hna/test/logs/req_GMJ8svbyVKoJor?t=1679064560",
"type": "invalid_request_error"
}
}
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Thanks
Okay so the request is https://dashboard.stripe.com/test/logs/req_Svx6Y78TByT3Z8
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Looks like it isn't liking the billing_address.name
That is a bit of a weird error message we are providing though
Overall I believe this is an error coming back from Klarna though about the name
You can see it is being passed as \"xxx xxx"
So looks like some potential encoding issue in your code with that variable?
I see
I will have a play with it
Thanks for your help
On anoter note
when using afterpay, it asks for a shipping address
If there is no shipping address, how can we use it?
Also, why does the payment intent allow clearpay as an option if it mandates a shipping address?
It anticipates that you are going to collect the shipping address from your client. You can use the Address Element to do this if you aren't collecting Shipping Address through your own form: https://stripe.com/docs/elements/address-element
You can listen for the change event's value (https://stripe.com/docs/js/element/events/on_change?type=paymentElement#element_on_change-handler-value) and then ask for shipping address if they select Afterpay
I do think we can make this easier on you and just have Payment Element handle this for you.... I'm going to file some feedback internally about this
Cool
On another note, I love how simple the paymentElement is to use, but we want to change the buttons
is it possible with the paymentElement
or do we have to work this ourself if we want a radically different design?
The Appearance API is what you would use for customization: https://stripe.com/docs/elements/appearance-api
Yeah that would actually be if you change the layout when you create PE as opposed to using the Appearance API. See: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-layout
So you can use an accordion layout with radios set
Im guessing stripe feel the accordian converts the best?
I actually am not sure if we have run experiments on that
We added the accordion layout pretty recently due to a lot of merchants requesting it
Uncaught IntegrationError: Invalid value for elements.create('payment'): layout should be one of the following strings: accordion, tabs, auto or layout should be an object. You specified layout as radios.
My bad
Yeah if you use radios then you need an object
Happy to help!
Last question ๐
Sure
The address element. If we want to put that in a border (like payment elemet), are we best styling this ourselves
Yep
I believe that is the way to do it
Can double check if there is a better way
But afaik that is correct
Also... last last question ๐
Can we put the other options above card but leave card as the default option?
Yeah your own styling for a border for address element looks to be the way
You can set paymentMethodOrder to alway have card first if you so desire: https://stripe.com/docs/js/elements_object/create_payment_element#payment_element_create-options-paymentMethodOrder
If we change the order, can card still always be the default one that opens?
If it is first then I believe it should always be the one that is shown by default
Unless I am misremembering
Is the default country in the addressElement dynamic
Its coming up as US but I am based in the UK
paymentElement defaults to the UK
Wondering if we need to do this?
Also, any tips to stop this?
The country is in the US
I change the default to GB and works ok
But not sure if stripe "guesses" what to select here?
It should either be a setting in your browser (locale) or the geolocation of your IP address