#nobody_api
1 messages Ā· Page 1 of 1 (latest)
š Welcome to your new thread!
ā²ļø We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
ā±ļø We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
š This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1272411795931402300
š Have more to share? Add more details, code, screenshots, videos, etc. below.
Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- nobody_card-address, 3 days ago, 14 messages
- nobody_api, 3 days ago, 14 messages
- nobody_best-practices, 5 days ago, 46 messages
- nobody_code, 5 days ago, 68 messages
āFinalize payments on serverā seems like an objectively superior workflow for reasons I will cover below. But @lime frigate said that finalize payments on server is not recommended and is lacking many features. For example, it doesnāt support customer_session which i want to use on the payment element to render the customerās saved payments. >:(
Scenario: my customers can pay X amount of dollars to ācreate a postā (by filling out a form), and creating a post requires uploading 2mb of data. The price of the post is specified within the uploaded data.
If i were to confirm payment on the frontend, that means the flow has to look like:
- customer uses my endpoint to upload 2mb of data, which returns a payment_intent client secret. During the endpoint call, a UUID is generated as the s3 key of the 2mb of data & is put in the metadata of the payment_intent (to perform this linkage, the 2mb upload and payment_intent HAVE to be created in the same call).
- customer confirms payment on frontend, triggering a webhook to complete upload of post on my server.
This workflow sucks because the the 2mb upload is required for the payment intentās client secret, meaning i have to upload 2mb of data to simply RENDER the payment window?! (ridiculous)
If we compare it to finalize payments on server workflow:
- On the frontend: customer fills out 2mb of data in a form & enters payment info to get confirmation token
- customer sends 2mb of data and confirmation token to my endpoint. My server can upload the data and then confirm the payment intent. Easy.
I would like to use the client_secret workflow (payment elements either take client secret or āmodeā) to utilize the customer_session feature. But as you can see, it sucks because I would have to perform data upload & validation before rendering the payment element.
Hi there, just to clarify, are you following this guide https://docs.stripe.com/payments/finalize-payments-on-the-server?platform=web&type=payment for your integration?
Yes!
Ok, so which step are you currently at? And what can I help you with?
I mean I kind of outlined the whole problem above...
It doesn't support customer_session, which would let me render previous customer payments. & koopa says its not a recommended flow.
So i tried to use client_secret instead, but unless i'm mistaken, you have to upload all customer data BEFORE rendering payment.
I want to use client_secret to take advantage of its features.
What made you think this flow doesn't support customer_session? https://docs.stripe.com/payments/finalize-payments-on-the-server?platform=web&type=payment#save-payment-methods this section of the doc shows how you can use customer_session to display saved payment method. Have you tried it out?
Yeah i tried it out and thought it was a mistake because customer_session is only in the client_secret payment element interface. I'll show you
To configure the payment element, you pass in StripeElementOptions
StripeElementOptions can either be "ClientSecret" or "Mode"
ClientSecret extends BaseStripeElementsOptions, which contains customerSessionClientSecret
But you can't pass in customer_session into the mode version.
Just to make sure that we are on the same page. You are following the "Finalize payments on the server" guide, and you want your customer to use their saved payment method to submit the payment, so that you can create and finalize the paymentIntent at your server. Am I correct?
Yeah
Ok, then I don't think you need to pass in the client_secret, just follow the guide that I shared earlier to continue your integration work.
The guide you sent uses "mode" but i just sent pics of how mode doesn't accept customerSessionClientSecret
I have the latest version of stripe js, 4.2.0
Have you tried?
Yeah at least it gets red underlined. I suppose it's possible that typescript is bugging out but it would actually work??
https://www.npmjs.com/package/@types/stripe-v3 are you using the latest types?