PHP icon indicating copy to clipboard operation
PHP copied to clipboard

Exception when using 3DS test card

Open michaelthedev opened this issue 9 months ago • 1 comments

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

  1. using these test card details image
  2. 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);

  1. 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)... [] []

michaelthedev avatar May 15 '24 17:05 michaelthedev

I used the API directly and noticed the error was from the API, not the sdk

michaelthedev avatar May 15 '24 17:05 michaelthedev