#negative10xprogrammer

1 messages · Page 1 of 1 (latest)

arctic willowBOT
sudden hornet
#

Hello

#

Idempotency keys are really only meant for performing retries safely when you are unsure of the previous outcome (like a 500 error occurred).

#

Ideally, for retries, you just re-confirm the same PaymentIntent

zinc owl
#

ok, but what if they have insufficient funds and decide to use another card instead?

#

will the client simply use that same paymentintent and automatically attach this new paymentmethod to id?

#

it

#

(via stripe elements)

sudden hornet
#

Yep

#

The PaymentMethod is created upon a successful confirmation here

zinc owl
#

ok, yes well I was thinking that maybe it's a previously used paymentmethod (fetched from stripe), but insufficient funds, and instead of topping up funds they use a different paymentmethod. But the answer is, dont create a newq paymentintent, simply let the client handle that then I take

sudden hornet
#

Yeah if it is a previously used one then you pass the PaymentMethod ID to your confirm

#

If it is a new one, you don't pass a PaymentMethod ID

zinc owl
#

and again to be sure, as long as there's a customer attached to teh paymentintent i created on the server and setupfutureusage, stripe will make sure this customer is associated with any successful paymentmethods?

sudden hornet
#

Yep

#

Should be easy to test this out as well!

zinc owl
#

how does klarna come into play here in the creation of the paymentintent? I assume it's as easy as PaymentMethodTypes = new List<string> {"klarna","card"}...

but will this work if the same paymentintent is set to setupfuturesage = off_session?

or should i create a separate paymentintent for klarna payments?

sudden hornet
#

In terms of setup_future_usage

#

You want to instead use the payment_method_options.card.setup_future_usage in this case

#

Instead of setting it top level

#

So the PaymentIntent is compatible for both cards and Klarna

zinc owl
#

how do I do that with the .net SDK?

zinc owl
#
        var options = new PaymentIntentCreateOptions
        {
            Amount = (long)amount * 100,
            Currency = currency.ToString(), // Listing's currency
            PaymentMethodTypes = new List<string> { StripePaymentMethods.Klarna, StripePaymentMethods.Card},
            TransferGroup = reservationId ,
            Customer = customerId,
            SetupFutureUsage = "off_session", // Without this the paymentmethod would not be reusable,
            ConfirmationMethod = "manual",
            Metadata = new Dictionary<string, string>
            {
                { "reservationId", reservationId }
            },
        };

#

i ahve this

#

i think card is default tho for paymentintents?

#

so i dont have to specify it

sudden hornet
#

Well mostly you are the programmer and know how to handle hashes in .NET. If you need specifics about the classes you could look at our SDK itself: https://github.com/stripe/stripe-dotnet

Mostly you want to use PaymentIntentPaymentMethodOptionsCardOptions I believe

#

But I don't remember the classes off the top of my head (not a .NET dev)

#

If you aren't on the latest version of the API and you want to use the Dashboard for your PaymentMethodTypes then you specify ```AutomaticPaymentMethods = new PaymentIntentAutomaticPaymentMethodsOptions
{
Enabled = true,
},

arctic willowBOT
zinc owl
#

hmm alright trying to figure it out, there are a lot of paymentintentpaymentmethodoptions methods

zinc owl
#

yes, but im not sure how to attach that to the paymentintent, it has paymentmethodoptions but they are not implicitly convertible

#
            PaymentMethodOptions = new PaymentIntentPaymentMethodOptionsOptions
            {
                Card = new PaymentIntentPaymentMethodOptionsCardOptions { SetupFutureUsage = "off_session"}
            }
#

like so?

#

it's not the same as PaymentIntentPaymentMethodOptionsCardOptions thyo

#

the word options is starting to look stupid now haha

sudden hornet
#

lol

#

That looks right to me

#

But like I said I'm not intimately familiar with dotnet

zinc owl
#

I'll try this out then. But this basically means stirpe will accordingly handle teh different paymentintents?

#

if it's klarna, it iwll ignore the card options

sudden hornet
#

Yep

zinc owl
#

thanks, appreciate it!