#gekko
1 messages · Page 1 of 1 (latest)
Hi there!
Hello
However I do not see a way to pass metadata with the stripe.confirmPayment method
Yes that's correct. The only way to setmetadatawould be from the backend with a secret key.
Normally with a non-subscription service payment intent i would simply pass the custom field to the backend and append it to the metadata there. However since I create the customer with an email before initiating the checkout i do not have this as an option. Is there a way to update the metadata on payment intent after i have already created the customer and invoice?
Absolutely, you can update the metadata of any object at any point. So you could update the metadata of the PaymentIntent later. https://stripe.com/docs/api/payment_intents/update#update_payment_intent-metadata
so currently I pass back subscription.latest_invoice.payment_intent.client_secret from my back end to my checkout element. If i were to pass just subscription.latest_invoice.payment_intent i would then have access to manipulate the payment_intent on the front end?
What do you mean by "manipulate"? Like I said earlier, you can only edit the metadata from the backend with a secret key.
Ok, so to assoicate the username to the unpaid invoice i would have to pass to the backend the payment intent ref: pi_***, and the username . Then since i have access to the clientsecret on the frontend i would pass this to the backend along with the username and update the invoice.
yes sorry
I currenly am taking a users email then with that creating a customer and a subscription.
I then take that and use the confirmpayment method to collect the customers payment information.
In the checkout form used I have a custom field username which i wish to add to the meta data. since i can not do so through confirmpayment, I need to though another means.
My question is how can I do so so that I have the username in the invoice.paid hook as metadata.
For it to be on the invoice.paid event, you will need to set the username as metadata on the related subscription or invoice before you fully confirm the invoice's payment intent
Otherwise it may be best to just consistently store it one place and look up the username from there when you get that event
ok thank you for your help!