#gekko

1 messages · Page 1 of 1 (latest)

tame hemlockBOT
prisma jewel
#

Hi there!

west flume
#

Hello

prisma jewel
#

However I do not see a way to pass metadata with the stripe.confirmPayment method
Yes that's correct. The only way to set metadata would be from the backend with a secret key.

west flume
#

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?

prisma jewel
west flume
#

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?

prisma jewel
#

What do you mean by "manipulate"? Like I said earlier, you can only edit the metadata from the backend with a secret key.

west flume
#

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.

tame hemlockBOT
proper gust
#

👋 stepping in

#

Is there an outstanding question here that i can help with?

west flume
#

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.

strange mist
#

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

west flume
#

ok thank you for your help!