#tjon_confirmationtoken-setup
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/1263194434896396340
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
there is no SetupFutureUsage property on SetupIntentPaymentMethodOptionsCardOptions
it's calledUsage
sorry it's caleld Usage but it's top-level so it's on SetupIntentCreateOptions
that doesnt exist either on the .net sdk
yes however it doesnt work if you set it there
there isn't a "card specific" version of this. If you use SetupIntent it's to use that PaymentMethod in the future so you set Usage globally
did you set setupFutureUsage on the Elements client-side?
i did but fyi the confirmation token api appears to have a conflict with that as it expressly states not to do that
Possibly. Sorry this is super high level/vague so I'm struggling to follow what you are describing.
https://docs.stripe.com/payments/payment-element/migration-ct#conditional-options
bottom of the page after optional
Sorry lacked room to type everything up initially. I'll go into a bit more detail
We are using confirmation tokens because we are doing a deffered payment setup. Confirmation tokens setupfutureusage must match the intents setupfutureusage. For a payment intent it looks like this
var options = new PaymentIntentCreateOptions
{
Amount = longValue,
Customer = donor.Id,
Currency = "usd",
ConfirmationToken = saleData.CreditCardCryptogram,
Confirm = true,
AutomaticPaymentMethods = new PaymentIntentAutomaticPaymentMethodsOptions
{
Enabled = true,
AllowRedirects = "never"
},
PaymentMethodOptions = new PaymentIntentPaymentMethodOptionsOptions
{
Card = new PaymentIntentPaymentMethodOptionsCardOptions
{
SetupFutureUsage = "off_session"
}
},
OnBehalfOf = "acct_123",
Metadata = new Dictionary<string, string>
{
{ "Form_Name", "test_form" },
}
};
var service = new PaymentIntentService();
var x = service.Create(options);
However when trying to do the same with setupintents as I sent above. the SetupIntentPaymentMethodOptionsCardOptions lacks any kind of designation for future usage.
when attempting to designate futureusage by using the "usage" property or anywhere else I could try and set it it fails with the error message "The provided setup_future_usage (off_session) does not match the setup_future_usage from the provided confirmation_token (null). Try confirming with a Setup Intent that is configured to use the same parameters as the ConfirmationToken."
I had the same issue with payment intents until i designated it directly in PaymentIntentPaymentMethodOptionsCardOptions
Can you share how you initialize Elements exactly please? Can you also share an exact request id for the failure?
sure
tjon_confirmationtoken-setup
stripe = Stripe("pk_test....");
const options = {
mode: 'setup',
//amount: 1099,
currency: 'usd',
//setupFutureUsage: 'off_session',
//payment_method_options: {
// card: {
// setup_future_usage: 'off_session'
// }
//},
//automatic_payment_methods: {
// enabled: true,
// allow_redirects: 'never'
//},
confirm = true
};
// Set up Stripe.js and Elements to use in checkout form
elements = stripe.elements(options);
// Create and mount the Payment Element
const paymentElement = elements.create('payment', {
layout: {
type: 'tabs',
defaultCollapsed: false,
},
});
paymentElement.mount('#payment-element');
I left in the comments of some of the different options I've tried
req_0q7LHuRjPCA39x
req_jyqL5YjvGOz2fD
req_gZ4GaToYcDuidp
a couple of recent failures for setup intent
And here are some reqid's for confirmation tokens they were successful but they didnt return the correct setupfuture usage
req_5VGSMfncDZorU3
req_wHPmyAd2v1fbSw
sorry that's way too much information let's pause I'm looking
and here is a succesful series for a payment intent
confirmation token : req_Z5BvU8G4xBTeIN
Payment intent : req_uqiQS3M2xpzkgh
On my end if I do const options = { mode: 'setup', currency: 'usd', paymentMethodCreation: 'manual', }; and I then create the SetupIntent with usage: 'off_session' it does just work
Are you saying this part doesn't work?
correct I will try again to be sure and get you the requests
I ran it with those options on the element
confirmation token : req_YtDGtWPkc6Yn1D
setupintent : req_YLiykgv4gNrXZ7
same error message
ah got it
you're in mode: 'payment'
The error is not great here, I'll flag internally but you seem to have the wrong mode when you initialize Elements
I have the mode set to setup in the options
yes I just reran same error and the mode is definitely setup
I see what you're seeing now on the logs is the element cached?
no the page was destroyed and rewritten between calls so I guess I assumed I was recreating the element not pulling it from a cache
let me try something
nothing would be cached if it's a new page but I don't entirely follow what you describe. But right now it seems the mode is set to payment and that's the bug
It was the same url but I had killed the process and reloaded it in a new browser but... I only changed the mode in the initialization. I had assumed the element was reinitialized everytime the page loaded but it appears it did not
so now that I do that I have a new error
req_xKPZvEYqwXSMnr
๐ stepping in here as koopajah needs to step away
Taking a look
Are you setting paymentMethodCreation: 'manual', client-side?
yes
Hmm I just looked at the log and it doesn't look like you are... I see:
mode: "setup",
setup_future_usage: "off_session",```
Being set
Can you test again with removing setup_future_usage: "off_session", (you don't use that in mode: setup and making sure paymentMethodCreation: 'manual', is present?
YES
failed again
req_Vi5iHenbSr9amZ
here is the element session req req_ty68C4UiGVqFih
That Elements Session request still has: currency: "usd", mode: "setup", setup_future_usage: "off_session",
You can look at the request body to see that
Err the payload if you are using dev tools
yes I saw that I think there is something going on with the element being cached maybe so I am trying it in a different browser
req_ha3xpTAhYczdw0
same thing but this time I ran from a different account I am going to try and change currency to see if it is cached or if it is something else
req_YN1rqKurkLn9iL
const options = {
mode: 'setup',
paymentMethodCreation: 'manual',
currency: 'aed'
};
Testing on my end to see what my Elements Session looks like and to see if I hit same error, one sec.
Okay apologies, I'm seeing the same thing you are. Looks like we transform the payload in the method.
Anyways, it does work for me when I specify:
enabled: true
},
return_url: 'https://www.example.com'```
in my SetupIntent request
Which since you are on a newer API version that shouldn't be required, it should be the default.
But can you try that?
And I'll submit a bug report internally about that assuming that works