#harsha
1 messages · Page 1 of 1 (latest)
Hi there, can you be more specific? what kind of payment method are you talking about?
In general, once I make payments on client checkout on success/failure we will get paymentIntent, error. Instead of directly relying on a response coming from the client i.e. paymentIntent. How do I verify that payment Intent is valid on the server to mark payment successful on the server end?
You should never rely on the response from client. Instead you should listen to payment_intent.succeeded and payment_intent.payment_failed webhook events instead.
@left leaf thanks
https://stripe.com/docs/webhooks/quickstart you can use the example code here to quickly get started with webhooks
@left leaf I'm aware of webhooks. But I have seen some different implementations on Razorpay gateway. Where they verify payments without webhooks.
So I thought stripe may also implementing that
generated_signature = hmac_sha256(order_id + "|" + razorpay_payment_id, secret);
if (generated_signature == razorpay_signature) {
payment is successful
}
I'm not familiar with Razorpay's implementation. You can also manually fetch the PaymentIntent from frontend (https://stripe.com/docs/js/payment_intents/retrieve_payment_intent) or backend (https://stripe.com/docs/api/payment_intents/retrieve?lang=php#retrieve_payment_intent) and check its status