#thomas-payment-fulfillment

1 messages · Page 1 of 1 (latest)

delicate gladeBOT
brisk wing
#

Hi 👋

confirmPayment wille return a Promise that redirects to your return_url if the payment completes successfully. The return_url will include query parameters such as the client secret for the payment intent you just confirmed. You can then use Stripe.js to retrieve the payment intent and look up the status
https://stripe.com/docs/js/payment_intents/retrieve_payment_intent

lime spear
#

ok

#

Can I retrieve the Paymentintent from my api side(backend)?

brisk wing
lime spear
#

Retrieving PaymentIntent is understood

#

I have confusion implementing webhooks

#

var json = await new StreamReader(HttpContext.Request.Body).ReadToEndAsync();

#

I'm getting error for the above line.

brisk wing
#

That isn't code I have any familiarity with, where did you geti it?

brisk wing
#
  1. Which language are you using?
  2. What does the error say?
lime spear
#

.Net

#

An object reference is required for the non-static field, method, or property 'HttpContext.Request'

delicate gladeBOT
lime spear
brisk wing
lime spear
#

The example shows service.Get("pi_3Nx2NzJnRs6ZWiPy14eiBRi8");

#

pi_3Nx2NzJnRs6ZWiPy14eiBRi8 is a paymentIntent id right and not a clientSecret?

brisk wing
#

Correct but the list of available parameters includes the client_secret

lime spear
#

I agree

brisk wing
#

Okay and so when you attempt to retrieve the Payment Intent using the client secret, what do you see?

gusty grove
#

thomas-payment-fulfillment

lime spear
#

Could you show me as an example using clientsecret as parameter?

gusty grove
#

Also you really shouldn't need to do any of this. Your server should have a clear cookie/session tracking the current paying customer, you should know exactly who they are, what they are buying and be able to retrieve that PaymentIntent server-side instead

lime spear
#

I'm just handling the api side code.

lime spear
gusty grove
#

There's no guide for something like this, it's more basic web development practice

#

But really, if you're the server-side dev, when the customer hits your "return url" your server-side code runs and should know who the customer is and what they are buying

lime spear
#

That I know

lime spear
gusty grove
lime spear
#

@chilly sphinx Had asked me to use webhooks

gusty grove
#

@lime spear I'm a customer, I pay, I get redirected to the return_url. You, the developer, know who I am, have cached the pi_123 somewhere in your database or a cookie or something and immediately call the Retrieve PaymentIntent API https://stripe.com/docs/api/payment_intents/retrieve
There is nothing more to it than this. There's no reason to look for a "client secret", that advice was incorrect and you can ignore it

lime spear
#

@gusty grove Thanks, makes a lot of sense