#Sarvesh

1 messages · Page 1 of 1 (latest)

hollow summitBOT
flat goblet
#

Hi there!

#

What is your question?

cloud topaz
#

Hi

#

I was doing payment from direct charges form is loaded from Stripe on my page. and I refresh / entered some wrong inputs and I can see many entries for same transaction was created in stripe side

#

how to avoid this or what could be the solutions to stick with single entry?

flat goblet
#

How do you accept payments with Stripe? Checkout Session, Payment Element + PaymentIntent, something else?

cloud topaz
flat goblet
#

Got it. Then every time you load the Payment Element, it's expected that you create a new PaymentIntent.

cloud topaz
#

so there is no way, and it will auto generate new payment Intent? Can we pass earlier paymentIntent Id on refresh or on error something like?

flat goblet
#

Technically you could save the PaymentIntent, and reuse it yes. But you don't have to.

cloud topaz
#

ok

#

what is the refund api to refund payment intent from stripe standard account

#

Undefined array key "charges". payment_response does not have "Charges" information

flat goblet
#

Undefined array key "charges". payment_response does not have "Charges" information
What are you trying to do? Can you share your code?

cloud topaz
#

$paymentData = json_decode($regEvent->payment_response, true);
if(!empty($paymentData) && $paymentData['account'] == $host->stripe_id) {
$connectedAccountId = $host->stripe_id; //
$chargeId = $paymentData['data']['object']['charges']['data'][0]['id'];
$totalRefund = $regEvent->event_fee*100;
$metaData = array('paymentIntentId' => $paymentIntentId, 'chargeId' => $chargeId, 'event_reg_id' => $regEvent->id, 'total_refund'=>$totalRefund);
try{
$refund = $stripe->refunds->create([
//'charge' => $chargeId,
'payment_intent' => $paymentIntentId,
"reason"=> "requested_by_customer",
"metadata" => $metaData,
'amount' => $totalRefund,
], ['stripe_account' => $connectedAccountId]);
Log::info("A refund request has been submitted. paymentIntentId: " .$paymentIntentId);
return back()->with('success', 'A refund request has been submitted. It may take 5-10 business days for funds to settle.');
} catch(Exception $e) {
Log::error("A refund failed. paymentIntentId: " .$paymentIntentId. " Error".$e->getMessage());
return back()->with('error', 'A refund request failed.');
}

#

$chargeId = $paymentData['data']['object']['charges']['data'][0]['id'];
here is getting error - Undefined array key "charges".

#

this was working before with Express account

flat goblet
#

What is $regEvent->payment_response?

cloud topaz
#

now in payment response from standard account there is no charges as sub object

flat goblet
#

What is $regEvent->payment_response? If it's a PaymentIntent, can you share the PaymentIntent ID?

cloud topaz
#

[id] => pi_3MJCmeEAjeNK9mUB1gnuqZ1x

flat goblet
#

And where is the payment_response coming from? What API request have you made to Stripe to get it?

cloud topaz
#

POST /paymentintent

flat goblet
#

So you create the PaymentIntent, and in the reponse you get you are trying to retrieve the charge property?

cloud topaz
#

which webhook event to subscribe to get refund reponse?