#miriana

1 messages · Page 1 of 1 (latest)

magic condorBOT
cerulean laurel
#

Hi
For PaymentSheet, you need to pass a customerId when creating the PaymentIntent in order to display the save checkbox. There is no explicit option via the SDK

modest saddle
#

PaymentSheet.Configuration(
merchantDisplayName = "Ticketing",
customer = PaymentSheet.CustomerConfiguration(id=paymentInitResponse.value?.data?.paymentResponse?.customerReference?:"",
ephemeralKeySecret = paymentInitResponse.value?.data?.paymentResponse?.paymentToken?.id ?:""),
)

#

I am already passing it but the option is still not appearing

cerulean laurel
modest saddle
#

you mean from the backend side?

#

one min to get the payment intent id

cerulean laurel
#

yes

modest saddle
#

ah okay if this is a backend issue then I will need to communicate with the backend developer
thank you for your help

#

pi_3MayS9GmCT9nlFnw1rnLQvGu
Is this it?

cerulean laurel
#

Well this PaymentIntent Id has the customer cus_NLAw0ZBByp9PHW attached to it. does the customer param you set in the PaymentSheet is the same ?

modest saddle
#

cus_NLAw0ZBByp9PHW

#

yes it is the same

#

and I still do not see the checkbox option

cerulean laurel
#

Can you log the content of this please?

PaymentSheet.CustomerConfiguration(id=paymentInitResponse.value?.data?.paymentResponse?.customerReference?:"",
                                    ephemeralKeySecret = paymentInitResponse.value?.data?.paymentResponse?.paymentToken?.id ?:"")
modest saddle
#

yes off course
I would need to generate a new payment though
one sec

#

payment Id : pi_3Mayd0GmCT9nlFnw1pMvhVFB

#

this is the whole response from backend

cerulean laurel
#

Thanks for sharing

#

checking...

modest saddle
#

implementation 'com.stripe:stripe-android:20.17.0'

cerulean laurel
#

For ephemeralKeySecret can you check if in the backend they set the same customerId too?
can you check if they are doing something like this:

const ephemeralKey = await stripe.ephemeralKeys.create(
    { customer: "cus_NLAw0ZBByp9PHW" })
  
modest saddle
#

I am getting the customer id from the backend

cerulean laurel
#

and what about the ephemeralKey?

modest saddle
#

also from backend

#

and there are saved cards happening on other platforms

cerulean laurel
#

ok, and my question is, does the backend creating the ephemeralKeys with the same customer of the PayemtIntent?

#

And are they sending back the ephemeralKey.secret, which you need to pass to the PaymentSheet.CustomerConfiguration.ephemeralKeySecret

modest saddle
#

yes

#

ephkey_1Mayd0GmCT9nlFnwRA4t4DU4

#

this the ephemeral key for this payment intent

cerulean laurel
#

Now for PaymentSheet.CustomerConfiguration.ephemeralKeySecret are you passing the secret of that ephemeral key? ti should be starting with ek_test_YW...

modest saddle
#

I wasn't passing maybe the right key
I am testing with the other key

#

now I can see the saved cards on other platforms but can't save cards on my side

cerulean laurel
#

ok cool, we're making some advance here.

modest saddle
#

yeah

cerulean laurel
#

can you please relog the PaymentSheet.CustomerConfiguration?

modest saddle
#

yes one min

#

CustomerConfiguration(id=cus_NLAw0ZBByp9PHW, ephemeralKeySecret=ek_test_YWNjdF8xTVBCT2dHbUNUOW5sRm53LDhGZFJDTnBSODc2YldDdDFjUFhaVEF5RmxsNEVJS1A_00aqm05JXh)

#

pi_3Maz6tGmCT9nlFnw0qtrdACc

cerulean laurel
#

What code are you using in order to display the PaymentSheet? paymentSheet.presentWithPaymentIntent

modest saddle
#

stripeLauncher.launch(
PaymentSheetContract.Args.createPaymentIntentArgs(
paymentInitResponse.value?.data?.paymentResponse?.paymentSecret ?:"",
PaymentSheet.Configuration(
merchantDisplayName = "Ticketing",
customer = PaymentSheet.CustomerConfiguration(id=paymentInitResponse.value?.data?.paymentResponse?.customerReference?:"",
ephemeralKeySecret = paymentInitResponse.value?.data?.paymentResponse?.paymentToken?.secret ?:""),
)
)
)

#

I found this code on your sample with jetpack compose

modest saddle
#

trying

#

I don't think this works well with composable functions

#

the example is inside an activity

#

stripeLauncher.launch(
PaymentSheetContract.Args.createPaymentIntentArgs(
clientSecret,
PaymentSheet.Configuration(
merchantDisplayName = merchantName,
customer = customerConfig,
googlePay = googlePayConfig,
)
)
)

cerulean laurel
#

What is the issue you are facing exactly ?

modest saddle
#

I am not able to create PaymentSheet()

#

it is crashing
LifecycleOwner com.ticketing.MainActivity@fbe827f is attempting to register while current state is RESUMED.

#

val paymentSheet = PaymentSheet((context as ComponentActivity)) {

                    }
cerulean laurel
#

Not sure I'm understanding you here. In both example, the two function are called from BasePaymentSheetActivity which are AppCompatActivity what is the different from your integration?

modest saddle
#

I am calling it from a composable function

#

@Composable
fun EventDetailsPage(eventDetails: TicketEvent?) {

#

the second example I sent does not rely on an activity reference

cerulean laurel
modest saddle
#

but this would mean I am creating the payment even if I don't want to use it and I would be always observing its state as long as the application is running

#

just wondering
why is this not working?
stripeLauncher.launch(
PaymentSheetContract.Args.createPaymentIntentArgs(

cerulean laurel
#

I'm sure that paymentSheet.presentWithPaymentIntent is supporting the checkbox for saving paymentmethod. but I'm not for stripeLauncher.launch. Doing some tests...

modest saddle
#

please can we try to get this working because the other option although would work but will be a bit heavy on the application

cerulean laurel
#

Agree.

#

I just tested using the stripeLauncher.launch and I'm having the checkbox for saving the Payment.

modest saddle
#

can you send me the code you are using exactly please?

cerulean laurel
modest saddle
#

I tested again and still can't see it

#

I see the saved cards but not the checkbox

cerulean laurel
#

There is a difference in your integration that is blocking that from displaying. Try to run the sample project and pass your values within it and see if you manage to display the checkbox. Something like:

stripeLauncher.launch(
                                PaymentSheetContract.Args.createPaymentIntentArgs(
                                    "pi_3Maz6tGmCT9nlFnw0qtrdACc....",
                                    PaymentSheet.Configuration(
                                        merchantDisplayName = merchantName,
                                        customer = PaymentSheet.CustomerConfiguration(
                                            id = "cus_NLAw0ZBByp9PHW",
                                            ephemeralKeySecret = "ek_test_YW...."
                                        ),
                                        googlePay = googlePayConfig,
                                    )
                                )
                            )
#

Use your public key too when building the example.

modest saddle
#

there isn't really much of a difference but I will try

cerulean laurel
#

There must be, if you don't see the Checkbox.

modest saddle
#

I put the code inside the activity and did not work
I am downloading the whole sample and checking if it would make a different

cerulean laurel
#

Yes please

modest saddle
#

sorry for the delay

cerulean laurel
#

No worries, take your time

stiff nest
#

you don't get the checkbox because you pass setup_future_usage: "off_session" on the backend https://dashboard.stripe.com/test/logs/req_4Zq7TwT6XAVLOw

you only get the checkbox if you don't pass setup_future_usage yourself; then the customer has a checkbox to choose to use it or not. There's no checkbox if you have explicitly chosen to set setup_future_usage on the PaymentIntent, because you don't want the customer to be able to turn it off

modest saddle
#

so what should be done to fix this issue exactly?

#

I need to pass the message to the other developers since I do not have access to the backend nor the dashboard

stiff nest
#

depends what you want. If you really want the customer to have that checkbox, remove that line in your backend Node.js code setting setup_future_usage: "off_session"

modest saddle
#

okay

#

thank youuuuuuu