#afenster
1 messages · Page 1 of 1 (latest)
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:
Here is one of the logs:
https://dashboard.stripe.com/test/logs?method[0]=post&method[1]=delete&direction[0]=connect_in&direction[1]=self
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
Hi there! Sorry for the delay, just catching up on some threads
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.
can you share the request ID for that attempt to confirm? it should look like req_...
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
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.
Yep, you're passing along the options which includes PaymentMethod = paymentIntent.Id, which is incorrect
So should it just be
Confirm(paymentIntent.Id) without the options part?
If you're just trying to confirm the PaymentIntent you created above, then yes
Beautiful! It worked!
https://dashboard.stripe.com/test/logs?method[0]=post&method[1]=delete&direction[0]=connect_in&direction[1]=self
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
OK, I'm happy now. That was my only question. Thank you for your assistance.