PHP code example of jpranskaitis / cardinity-sdk-php
1. Go to this page and download the library: Download jpranskaitis/cardinity-sdk-php library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Cardinity\Method\Payment;
$client = Client::create([
'consumerKey' => 'YOUR_CONSUMER_KEY',
'consumerSecret' => 'YOUR_CONSUMER_SECRET',
]);
if($v2){
$method = new Payment\Finalize(
$payment->getId(), // payment object received from API call
$auth->getCreq(), // payment object received from API call
true // BOOL `true` to enable 3D secure V2 parameters
);
}elseif($v1){
$method = new Payment\Finalize(
$payment->getId(), // payment object received from API call
$auth->getData(), // payment object received from API call
false // BOOL `false` to enable 3D secure V1 parameters
);
}
// again use same try ... catch block
try {
$payment = $client->call($method);
}
// same catch blocks ...
// ...