#3dsecure #VbV #SecureCode handling with @Cardinity in #PHP
I recently got set up with Cardinity (A PSP), and I was learning their API using their PHP SDK at https://github.com/cardinity/cardinity-sdk-php/
When I moved from test to live, I discovered that the result of my card was not success or failed, but pending – because 3D secure was activated on the card. Otherwise known as Verified by Visa or Mastercard Securecode.
What happens, is that you need to capture the Securecode url by calling
$payment->getAuthorizationInformation()->getUrl()
and the data to be posted in the PaReq parameter by calling
$payment->getAuthorizationInformation()->getData()
You also need to have a TermUrl – i.e. your callback URL, and MD – Which I used for the payment ID parameters set.
Once you get your callback, then you need to pull out the MD and PaRes from the form data, I’ve put them into $MD and $PaRes variables respectively, then you call
require_once __DIR__ . ‘/vendor/autoload.php’;
use Cardinity\Client;
use Cardinity\Method\Payment;$client = Client::create([
‘consumerKey’ => ‘…’,
‘consumerSecret’ => ‘…’,
]);$method = new Payment\Finalize($MD,$PaRes);
$payment = $client->call($method);
$serialized = serialize($payment);
echo($serialized);
… And you should get an object like the following back:
{
“id”: “……”,
“amount”: “10.00”,
“currency”: “EUR”,
“created”: “2018-04-12T14:28:40Z”,
“type”: “authorization”,
“live”: true,
“status”: “approved”,
“order_id”: “1234”,
“description”: “test”,
“country”: “GB”,
“payment_method”: “card”,
“payment_instrument”:
{
“card_brand”: “MasterCard”,
“pan”: “….”,
“exp_year”: 2021,
“exp_month”: 9,
“holder”: “Joe Bloggs”
}
}
Once this code is finished up, we will replace the paypal option on AvatarAPI.com to this Cardinity interface