Stripe API, Trying to intergate in my code using cURL, But face the error. I am getting the following error
{
"error": {
"code": "parameter_invalid_integer",
"doc_url": "https://stripe.com/docs/error-codes/parameter-invalid-integer",
"message": "Invalid integer: <integer>",
"param": "amount",
"request_log_url": "https://dashboard.stripe.com/test/logs/req_r1VgKFZTeHcKu1?t=1686081517",
"type": "invalid_request_error"
}
}
Code:
$token = "XXXXX";
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type: application/x-www-form-urlencoded",
"Accept: application/json","Authorization: Bearer $token"));
$data = array(
"amount"=> (int)$amount,
"payment_method"=>$paymentId,
"confirm"=> "true",
"confirmation_method"=>"automatic",
"currency"=> "dollor",
"customer"=> $paymentMethod->customer
);
$jsonPayload = json_encode($data);
curl_setopt($curl, CURLOPT_URL, "https://api.stripe.com/v1/payment_intents");
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_POSTFIELDS, $jsonPayload);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($curl);
curl_close($curl);
I tried many ways, it shows error like amount is Invalid Integer.
UPDATE
I'm also getting the same error using Postman
Output of var_dump($data)
array(6) {
["amount"]=> int(5000)
["payment_method"]=> string(27) "pm_1NGHfRSHUnJwHMxFxRyvs03T"
["confirm"]=> string(4) "true"
["confirmation_method"]=> string(9) "automatic"
["currency"]=> string(3) "USD"
["customer"]=> string(18) "cus_O22SRWfvFRfVvE"
}