#afenster

1 messages · Page 1 of 1 (latest)

silk burrowBOT
flint harbor
#

Trying again. Here is the code:

        // Create
        var options = new PaymentIntentCreateOptions
        {
            Amount = 500,   // = $5
            Currency = "usd",
            PaymentMethod = "pm_card_visa",
            CaptureMethod = "manual",
        };
        var service = new PaymentIntentService();
        var paymentIntent = service.Create(options);

        // Get approval from Stripe
        var confirmOptions = new PaymentIntentConfirmOptions
        {
            PaymentMethodTypes = new List<string>() { "pm_card_visa" },
            PaymentMethod = paymentIntent.Id,
        };

            var paymentIntentService = new PaymentIntentService();
            var confirmPI = paymentIntentService.Confirm(paymentIntent.Id, confirmOptions);
#

And the exception I get on confirm:

rotund magnet
#

Hi there! Sorry for the delay, just catching up on some threads

flint harbor
#

No problem.

#

I've been making progress with Stripe. Now I'm almost done and I'm writing unit tests. I need a PaymentIntent that has been confirmed.

rotund magnet
#

can you share the request ID for that attempt to confirm? it should look like req_...

flint harbor
#

Here's one

#

req_8cRN5Veza6PsmM

rotund magnet
#

Okay, let's take a step back. you're creating a PaymentIntent and passing along pm_card_visa to create a PaymentMethod. This creation request is successful. When you confirm the PaymentIntent, you don't have to pass along a PaymentMethod ID in your confirm call since you already did this when creating the PaymentIntent

#

Request req_8cRN5Veza6PsmM is failing because you're passing along an ID that Stripe does not recognize as a PaymentMethod ID. Your code is passing along payment_method: pi_... in the confirmation call instead of a PaymentMethod ID

flint harbor
#

So, the create method is
var paymentIntent = service.Create(options)

Then when I confirm, I'm calling
Confirm(paymentIntent.Id, options)

So as far as I can tell, I'm passing back a PaymentIntent ID on the Confirm call.

#

I can try getting rid of the options part. I'll try that now.

rotund magnet
#

Yep, you're passing along the options which includes PaymentMethod = paymentIntent.Id, which is incorrect

flint harbor
rotund magnet
#

If you're just trying to confirm the PaymentIntent you created above, then yes

flint harbor
#

OK, I'm happy now. That was my only question. Thank you for your assistance.