#yogeshp-refunds
1 messages · Page 1 of 1 (latest)
Hey, I am stepping in. To create Refund you would need the Charge Id instead of the Payment Intent Id: https://stripe.com/docs/api/refunds/create
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
You would need to find the Charge Id inside the PaymentIntent object
I don't have charge id
when I did the payment In that response I got only Payment intent
do you want to check that response?
to check
Yes the Charge Id is inside the PaymentIntent object
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I can take a look at the response
Also, the PaymentIntent only has Charges after it is confirmed
so if you just created a PaymentIntent and haven't confirmed it, it won't have a Charge object inside
{"paymentIntent":{"id":"pi_1ImsYD2eZvKYlo2CsH7hwSY0",
"object":"payment_intent",
"amount":5000,"canceled_at":null,
"cancellation_reason":null,
"capture_method":"automatic",
"client_secret":"pi_************************g",
"confirmation_method":"automatic",
"created":1620012869,
"currency":"usd",
"description":null,"last_payment_error":null,"livemode":false,"next_action":null,"payment_method":"pm_1ImsYG2eZvKYlo2CKjFwdxnB","payment_method_types":["card"],"receipt_email":null,"setup_future_usage":null,"shipping":null,"source":null,"status":"succeeded"}}
this is the response for one test payment i have created
okie, now let's Retrieve that PaymentIntent first, using its Id: https://stripe.com/docs/api/payment_intents/retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
(do it after confirmation on client, and before you want to refund)
ok
then you would have an array of Charge objects inside: https://stripe.com/docs/api/payment_intents/object#payment_intent_object-charges-data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
to retrieve the payment intent what other parameters we required other than pi id?
com.stripe.exception.InvalidRequestException: No such payment_intent: 'pi_3JNKa22cB6Xp2wRX09HtTaEQ'; code: resource_missing; request-id: req_1yZvtPlOuJRVNX
getting this exception
I got this exception while retriveing the payment intent