#arjun.maniyar-payments

1 messages · Page 1 of 1 (latest)

acoustic hemlock
#

Hello! Do you have any example Payment Intent IDs I can take a look at?

celest cape
#

Let me check

#

$request_headers = [
'Content-Type: application/x-www-form-urlencoded',
'Authorization: Bearer '.TEST_STRIPE_SECRET_KEY,
'Idempotent-Replayed: true',
];
$url = "https://api.stripe.com/v1/payment_intents";
$fields = array(
'amount' => $amount,
'currency' => 'usd',
'customer' => $customer_id,
'payment_method' => $paymentMethodId,
'off_session' => 'true',
'confirm' => 'true',
);
$request_payload = http_build_query($fields);
$response_body = curlPost($url , $request_payload , $request_headers);
$output = json_decode($response_body, true);
return $output;

#

This is the code I am using

acoustic hemlock
#

Thanks for sending that, but really I need actual payment method IDs (like pi_xxx) to see what's happening. From a quick glance at the code I don't see anything wrong with it, so the object IDs will give us more context

celest cape
#

You can check this

#

pm_1JXrbpH1pwdGSd41kQ4jUsCx

acoustic hemlock
#

I took a look and have a couple of questions:

  1. How/when is this payment intent creation code being triggered on your end?
  2. What is the purpose of you setting Idempotent-Replayed as a request header? Are you trying to make an idempotent request?
celest cape
#
  1. Right now I am calling it manually only once by passing PaymentMethodID
#
  1. I got that value on Google to avoid the double charge
acoustic hemlock
celest cape
#

I just want to avoid double charge

#

Right now ever transaction is getting charged double

acoustic hemlock
#

Yes, the idempotency key will help with that. But also, these duplicate charges are coming from your own code - you need to dig into your codebase and determine how it's possible you're sending the same request multiplet imes

celest cape
#

I am trying but I don't see any double call, the above code I sent you is the only code I am calling once

acoustic hemlock
#

Have you tried putting logs in your code to see if the code is being called multiple times?

celest cape
#

Yes, I checked. No luck with that. Logs showing only one call

acoustic hemlock
#

Hmmm, that's very strange - for context, we wouldn't just be making duplicate requests like this. Something on your end is making these requests.

If you can't find the root issue, then I would definitely suggest looking into the idempotency link I sent earlier