#RockstarsNFT - Customer Update
1 messages · Page 1 of 1 (latest)
Hello! Generally speaking it's not possible to update a Customer from the frontend. Can you tell me what exactly you're trying to do?
Also, it might help to know what frontend Stripe libraries/SDKs you're using?
we're trying to save/update billing details like address, state, and country when charging a card
however we don't want those fields passing through our backend for compliance reasons
Do you need those details on the Customer itself? They should be present on the Payment Method, which is created client-side.
not sure I fully follow. the issue is that we render our own form as a combination of the CreditCardElement, the CvcElement, and the CardExpiryElement. we then are going to use custom fields to collect address, state, and country, because we always need to collect that info, even if it's not strictly needed to charge the card
but when we submit it all, we'd like to update the customer object
Payment Methods contain a billing_details property with the information you're talking about: https://stripe.com/docs/api/payment_methods/object#payment_method_object-billing_details
Stripe Elements creates a Payment Method from the information entered, and you can add the billing details from your custom fields client-side when that happens. Are you using stripe.confirmCardPayment or stripe.createPaymentMethod?
we actually haven't implemented it yet. currently we createToken(cardElement,.. and then send it to our backend to charge the card
but we now want to charge the card from the frontend
createToken is legacy and not recommended, but Tokens also have the ability to specify details like these: https://stripe.com/docs/api/tokens/create_card#create_card_token-card-name
So are you switching to Payment Intents?
yes that seems to be the case (i say seems because I'm the one figuring this out and that's what I see happening from your docs but I'm not sure lol)
Let's back up a bit. So you have a legacy Charges/Tokens integration and now you want to update it to use Payment Intents and Payment Methods, correct?
yes, so that we can charge the customer without passing anything through our servers
Have you read through this guide? https://stripe.com/docs/payments/payment-intents/migration
and as a part of that process, we want to store customer billing info not strictly needed to charge the card, so we can't assume it will show up in the PaymentElement
nope, did not change upon it. but i will now
After you read that you'll probably end up using stripe.confirmCardPayment if you're using the standalone Card Elements, which means you can specify the billing details as shown in the code snippet here: https://stripe.com/docs/js/payment_intents/confirm_card_payment#stripe_confirm_card_payment-data-payment_method
That example sets only the name, but you can set the other properties the same way.