#nobody_api

1 messages Ā· Page 1 of 1 (latest)

noble bobcatBOT
#

šŸ‘‹ 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.

quartz parrotBOT
#

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.

balmy juniper
#

ā€œ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.

verbal cloak
balmy juniper
#

Yes!

verbal cloak
#

Ok, so which step are you currently at? And what can I help you with?

balmy juniper
#

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.

verbal cloak
balmy juniper
#

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.

verbal cloak
#

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?

balmy juniper
#

Yeah

verbal cloak
#

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.

balmy juniper
#

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

verbal cloak
#

Have you tried?

balmy juniper
#

Yeah at least it gets red underlined. I suppose it's possible that typescript is bugging out but it would actually work??

verbal cloak
#

https://www.npmjs.com/package/@types/stripe-v3 are you using the latest types?

balmy juniper
#

Oh dang. No i'm not

#

That was it 😭 thanks man