#vaios_code

1 messages ยท Page 1 of 1 (latest)

round crownBOT
#

๐Ÿ‘‹ 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/1319583622029774922

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

copper maple
#

Can you tell me more about "hide the Stripes UI screen for selecting a saved payment method", do you have some UI mock ups that I can see to better understand what you want to achieve?

bright light
#

This is screen is displayed when we open the flowcontroller and therea are saved payment methods. Is there a way to avoid this screen

#

we want to be able to open only this sheet

copper maple
#

So you don't want your customer to reuse a saved payment method?

bright light
#

we want to reuse them

#

but from our custom ui

copper maple
#

Ok, then you need to build the UI by yourself.

bright light
#

We are already building it. But we want to reuse the way of adding a payment method through Stripe UI

copper maple
#

To clarify, so you don't want to use PaymentSheet, instead you want to build your own UI to let your customer to select a saved payment method?

bright light
#

We want to use FlowController/PaymentSheet only for payment method addition

#

for selecting saved payment method we want to use our custom screen

copper maple
#

Ok, then you can use a setup mode payment sheet to collect a payment method, and use your own flow for payment.

bright light
#

can you share link/code? I am not sure that i understood

copper maple
bright light
#

This changes the flow a lot. As we need to get client secret before confirming the payment. With intent configuration we get it when we confirm

round crownBOT
copper maple
bright light
#

we use this flowController.configureWithIntentConfiguration() and the UI with the saved payment methods is displayed

#

With our current implementation we get the client secrete in this callback

PaymentSheet.FlowController.create(
            fragment = fragment,
            createIntentCallback = { paymentMethod, shouldSavePaymentMethod ->
                val clientSecret = ...
                CreateIntentResult.Success(clientSecret = clientSecret)
            },
#

To use setUp intent we need to implement something like that

        flowController.configureWithSetupIntent(clientSecret)

Which implies that we should retrieve clientsecret beforehand

last iris
#

Hey! Taking over for my colleague.

bright light
#

This is what we have implemented

#

and we call this flowController.configureWithIntentConfiguration

#

I suppose that you want me to call this flowController.configureWithSetupIntent

#

which breaks the flow and needs a lot of refactor

last iris
#

You want to collect a PaymentMethod using a SetupIntent without having to create the intent first right ?

bright light
#

we do what the guide said

#

but the UI with the saved payment methods pops up

last iris
#

Are you passing a Customer Id and an ephemeral Id to the PaymentSheet ?

bright light
#

yeah! we pass both of them

last iris
#

You shouldn't then.

#

In the guide, there is no mention to send Customer and Ephemeral Key.

#

Just create the SetupIntent with the Customer Id later.

bright light
#

If i do not pass Customer and Ephemeral Key how the user will be able to save the payment method? ๐Ÿ˜‚

#

Is there any example on github?

last iris
#

Passing the Customer and the Ephemeral Key to the PaymentSheet is optional, it's just for showing preivously saved payment method on the PaymentSheet.

bright light
#

It is optional. If you do not pass it though you do not have the option to save. This was something mentioned on another thread here and this behavior is confirmed on our current poc

#

We want to display the checkbox but not the saved payment methods

last iris
#

We want to display the checkbox but not the saved payment methods
No you can't achieve that.

#

Why explcitily you want to have the Checkbox ?

#

In your case, you'll need simply to collect/save the PaymentMethod via SetupIntent right ? you'll be able to use it in the future by then.

#

What is the missing feature that you need and requires having that Checkbox ?

bright light
#

We want to have the checkbox in order to not have to implement all the logic on one deliverable

#

we want to use Stripe's UI for adding the payment method (so the checkbox is needed)
but we want to display saved payment methods on our UI (and not on stripe UI)

last iris
#

We want to have the checkbox in order to not have to implement all the logic on one deliverable
Could you please share more details about this ?

#

we want to use Stripe's UI for adding the payment method (so the checkbox is needed)
No, you can add/save a payment method without the Checkbox

bright light
#

How the user can select to save a payment method without the Checkbox? ๐Ÿค”

last iris
#

That's the usage of SetupIntent.

#

You'll be setting the Customer at the SetupIntent level.

#

Have you had the chance to test the flow I'm describing above ? It seems like your current flow by just removing passing the Customer and ephemeral key to the PaymentSheet and pass the Customer to the SetupIntent.

bright light
#

We did it a no card was saved. We asked in discord and the guide us like that

#

the problem is that setup intent needs the client secret before hand
With our current implementation we get the client secret on confirm. Not on configuring the FlowController

last iris
#

No, you can collect the payment method without creating the SetupIntent at the first place.

bright light
#

This is server side. I shared snippets here on what we need to do on sdk that are not aligned with that.
With our current implementation we do this

val flowController = PaymentSheet.FlowController.create(
            fragment = fragment,
            createIntentCallback = { paymentMethod, shouldSavePaymentMethod ->
                // THIS IS WHERE SERVER IS CALLED. this happened on confirm
                val clientSecret = ...
                CreateIntentResult.Success(clientSecret = clientSecret)
            },
)
flowController.configureWithIntentConfiguration() <- NO CLIENT SECRET HERE

After some interactions and maybe some minutes later user presses to pay so we invoke

flowController.confirm()

Which actually triggers the createIntentCallback

With setup intent we need to do this

flowController.configureWithSetupIntent() <- CLIENT SECRET IS NEEDED

This is called way before user presses confirm.

round crownBOT
last iris
#

Yes in the createIntentCallback you need to provide a SetupIntent and provide the client secret

#

At that point you'll need to provide a client secet... but you have collected the PaymentMethod already without the Intent

last iris
#

createIntentCallback = { paymentMethod, shouldSavePaymentMethod ->

bright light
#

We know that... Without customer id and ephemeral key how will the customer change the value of shouldSavePaymentMethod

#

The checkbox wont be visible

last iris
#

Why you are displaying the PaymentSheet with SetupIntent in this case ?

bright light
#

Common... You are the third guy in this thread and you say the same. We do everything that is described here https://docs.stripe.com/payments/accept-a-payment-deferred
But we do not want to display saved payment methods on Stripe's UI. In order to select the value of shouldSavePaymentMethod the checkbox should be visible.

#

Is there any way to achieve this behavior

#

We want to have deferred payments

#

to collect the payment methods and pay a screen later

last iris
#

No you can't have the Checkbox and not have the saved payment method.

#

Either have both or nothing.

bright light
#

๐Ÿ˜ฆ

#

Are there any plans to include it?

#

The options that we have here are to have a fully custom UI?

last iris
#

You can implement the Checkbox in your mobile UI, and let the customer check it before displaying the PaymentSheet.

bright light
#

On that case what value are we going to pass to set up intent for future usage?

last iris
#

setup_future_usage: 'off_session',

#

Pass this when creating the PaymentIntent.

bright light
#

The setup_future_usage has three values. off/on/null on the sdk. Why do we have three options? ๐Ÿค”

last iris
#

For your use case you'll need off_session

bright light
#

Can you explain more? Because it is a bit unclear what the usage

last iris
bright light
#

I have read that multiple times and i can not say they are clear

#

at some point i felt that it has to do with save or not

#

then i thought that it has to do with subscriptions

#

i can search/find the documentation ๐Ÿ˜›

last iris
#

The question is, are you going to charge the Customer using the Save Payment method on session or off session.
Off session means that the customer isn't live in your webite/app, while on session means they are on your app/website.

bright light
#

Is live on app. So we need on_session and not off_session

#

and if the user does not want to save, we just pass null right?

trim ember
#

hi! I'm taking over this thread.

#

can you summarize your question?

bright light
#

I think i have a solution. A last step is missing.
If i want to save a credit card to pay only when the user is online i use on_session for futureUsage
If i do not want to save a credit card i use null for futureUsage
Right?

trim ember
#

correct