PHP
PHP copied to clipboard
Exception when using 3DS test card
Description
Fatal error: Uncaught GuzzleHttp\Exception\ClientException: Client error: `POST https://api.flutterwave.com/v3/charges?type=card` resulted in a `400 Bad Request` response: {"status":"error","message":"params.cvv.trim is not a function","data":null}
Guzzle error when trying to charge a card using the MasterCard 3DS authentication
test card (5438898014560229)
The process works for the MasterCard PIN authentication
test card (5531886652142950)
Steps to Reproduce
- using these test card details
- Setup card payment
$config = PackageConfig::setUp(...);
\Flutterwave\Flutterwave::bootstrap($config);
$paymentData = [
"amount" => 2000,
"currency" => Currency::NGN,
"tx_ref" => $reference,
"additionalData" => [
// "preauthorize" => false,
// "payment_plan" => null,
"card_details" => [
"card_number" => "5438898014560229",
"cvv" => "564",
"expiry_month" => "10",
"expiry_year" => "31",
],
],
];
$payment = \Flutterwave\Flutterwave::create("card");
$customerObj = $payment->customer->create([
"full_name" => $customer['name'],
"email" => $customer['email'],
"phone" => '',
]);
$paymentData['customer'] = $customerObj;
$payload = $payment->payload->create($paymentData);
$result = $payment->initiate($payload);
print_r($result);
- Run and see the result
Expected behaviour
Return instructions on what to collect from the user next
Actual behaviour
Guzzle exception shown above
Reproduces how often
Every time
Configuration
- API Version: v3
- Environment: test mode
- Browser: not applicable
- Language: PHP 8.3
Additional Information
Log file:
[2024-05-15T17:32:05.340169+01:00] Flutterwave/PHP.NOTICE: Card Service::Initiating Card Payment... [] []
[2024-05-15T17:32:05.341491+01:00] Flutterwave/PHP.NOTICE: Charge Group::Verifying Payload ... [] []
[2024-05-15T17:32:05.341533+01:00] Flutterwave/PHP.NOTICE: Card Service::Payload Confirmed... [] []
[2024-05-15T17:32:05.341562+01:00] Flutterwave/PHP.NOTICE: Card Service::Started Charging Card tx_ref:(deposit_charge_6644e3854b168)... [] []
I used the API directly and noticed the error was from the API, not the sdk