#brogrammer39
1 messages · Page 1 of 1 (latest)
Hi there
You can't add metadata client-side
Can you summarize what you are trying to do?
yes, so when a user wants to start a virtual visit on our application they get the payment form to enter their credit card information, and with that information i create a payment intent. Then a physician accepts the user from the virtual queue for a visit, and once the visit has successfully completed I am confirming the payment with stripe.confirmPayment.
What im trying to do is attach the id of the physician that accepted the patient in the description or metadata so that when the admins run out billing process they know which physician to give the money to for that virtual visit.
Edit: when the payment intent is created we dont know which physician will be accepting the user from the queue so i cannot add it there.
Gotcha so when you are going to call confirmPayment you need to call your backend and update the metadata there, then go back to your frontend to confirmPayment
But you can't set this metadata directly from the frontend since that isn't secure
okay, so before the client side call to confirm payment, I want to do a call to my backend that will update this payment intent that is still unconfirmed. Then once we return from that call successfully we trigger the client side confirmPayment?
Yep exactly
You would set metadata via calling the Update PaymentIntent endpoint on your backend: https://stripe.com/docs/api/payment_intents/update
This is great, thanks so much!
Sure thing!