1. Go to this page and download the library: Download bytelab/bytelab-test-sdk 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 CatalystPay\CatalystPaySDK;
try {
$token = 'OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=';
$entityId = '8a8294174b7ecb28014b9699220015ca';
$isProduction = false;
$catalystPaySDK = new CatalystPaySDK(
$token,
$entityId,
$isProduction
);
$errorMsg = '';
// Handle the payment status as needed
if (isset(($_GET['id']))) {
$checkoutId = $_GET['id'];
$responseData = $catalystPaySDK->getPaymentStatus($checkoutId);
print_r($responseData->getApiResponse()); // Get payment status response
var_dump($responseData->isPaymentStatus()); // Check payment status value True or False
// Check IF payment status is success
if ($responseData->isPaymentStatus()) {
// Check IF payment transaction pending is true
if ($responseData->isPaymentTransactionPending()) {
echo 'The transaction should be pending, but is ' . $responseData->getResultCode();
} elseif ($responseData->isPaymentRequestNotFound()) { // Check IF payment request not found is true
echo'No payment session found for the requested id, but is ' . $responseData->getResultCode();
}
}
}
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
use CatalystPay\CatalystPayResponseCode;
use CatalystPay\CatalystPaySDK;
try {
// Configured CatalystPaySDK
$token = 'OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=';
$entityId = '8a8294174b7ecb28014b9699220015ca';
$isProduction = false;
$isCreateRegistration = 'true';
$catalystPaySDK = new CatalystPaySDK(
$token,
$entityId,
$isProduction
);
// Form Values defined variable
$data = [
'testMode' => CatalystPaySDK::TEST_MODE_EXTERNAL,
'createRegistration' => $isCreateRegistration
];
//Prepare Check out form
$responseData = $catalystPaySDK->prepareRegisterCheckout($data);
// print_r($responseData);
// var_dump($responseData->isCheckoutSuccess());
// Check if checkout success is true
if ($responseData->isCheckoutSuccess()) {
//Show checkout success
$infoMessage = 'The checkout returned ' . $responseData->getResultCode() . ' instead of ' . CatalystPayResponseCode::CREATED_CHECKOUT;
$wpwlOptions = "{
iframeStyles: {
'card-number-placeholder': {
'color': '#ff0000',
'font-size': '16px',
'font-family': 'monospace'
},
'cvv-placeholder': {
'color': '#0000ff',
'font-size': '16px',
'font-family': 'Arial'
}
}
}";
// Payment with card
$formData = [
'checkoutId' => $responseData->getId(),
'shopperResultUrl' => 'http://localhost/catalystpay-php-sdk/registration_token_payment.php',
'dataBrands' => [
CatalystPaySDK::PAYMENT_BRAND_VISA ,
CatalystPaySDK::PAYMENT_BRAND_MASTERCARD,
CatalystPaySDK::PAYMENT_BRAND_AMEX
],
'wpwlOptions' => $wpwlOptions
];
echo $catalystPaySDK->getCreateRegistrationPaymentForm($formData);
// Payment with google pay
$formData2 = [
'checkoutId' => $responseData->getId(),
'shopperResultUrl' => 'http://localhost/catalystpay-php-sdk/copy_and_pay_result.php',
'dataBrands' => [CatalystPaySDK::PAYMENT_BRAND_GOOGLE_PAY],
'wpwlOptions' => $wpwlOptions
];
echo $catalystPaySDK->getCreateRegistrationPaymentForm($formData2);
// Payment with rocket fuel
$formData4 = [
'checkoutId' => $responseData->getId(),
'shopperResultUrl' => 'http://localhost/catalystpay-php-sdk/copy_and_pay_result.php',
'dataBrands' => [CatalystPaySDK::PAYMENT_BRAND_ROCKET_FUEL],
'wpwlOptions' => $wpwlOptions
];
echo $catalystPaySDK->getCreateRegistrationPaymentForm($formData4);
} else {
echo "The Prepare Checkout was not successful";
}
} catch (Exception $e) {
echo $e->getMessage();
}
// Example usage
try {
$errorMsg = '';
$isSuccessful = false;
$token = 'OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=';
$entityId = '8a8294174b7ecb28014b9699220015ca';
$isProduction = false;
$catalystPaySDK = new CatalystPaySDK(
$token,
$entityId,
$isProduction
);
// Handle the payment Registration status as needed
if (isset(($_GET['id']))) {
$checkoutId = $_GET['id'];
$responseData = $catalystPaySDK->getRegistrationStatus($checkoutId);
print_r($responseData->getApiResponse()); // Get payment Registration status response
var_dump($responseData->isRegistrationStatus()); // Check payment Registration status value True or False
// Check IF payment registration status is success
if ($responseData->isRegistrationStatus()) {
$paymentId = $responseData->getId(); // get the payment id
// Form Values defined variable
$data = [
'paymentBrand' => CatalystPaySDK::PAYMENT_BRAND_VISA,
'paymentType' => CatalystPaySDK::PAYMENT_TYPE_DEBIT,
'amount' => 92.00,
'currency' => 'EUR',
'standingInstructionType' => CatalystPaySDK::STANDING_INSTRUCTION_TYPE_UNSCHEDULED,
'standingInstructionMode' => CatalystPaySDK::STANDING_INSTRUCTION_MODE_INITIAL,
'standingInstructionSource' => CatalystPaySDK::STANDING_INSTRUCTION_SOURCE_CIT,
'testMode' => CatalystPaySDK::TEST_MODE_EXTERNAL
];
// Send payment using the token
$registerPayment = $catalystPaySDK->sendRegistrationTokenPayment($paymentId, $data);
//check if payment Successful true
$isPaymentSuccessful = $registerPayment->isSuccessful();
print_r($registerPayment->getApiResponse()); // Get send payment Registration response
// Check IF payment transaction pending is true
if ($registerPayment->isPaymentTransactionPending()) {
echo'The transaction should be pending, but is ' . $registerPayment->getResultCode();
} elseif ($registerPayment->isPaymentRequestNotFound()) { // Check IF payment request not found is true
echo 'No payment session found for the requested id, but is ' . $registerPayment->getResultCode();
}
}
}
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
use CatalystPay\CatalystPaySDK;
// Example usage
try {
// Configured CatalystPaySDK
$token = 'OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=';
$entityId = '8a8294174b7ecb28014b9699220015ca';
$isProduction = false;
$catalystPaySDK = new CatalystPaySDK(
$token,
$entityId,
$isProduction
);
// Get Transaction by id
$responseData = $catalystPaySDK->getTransactionById(['id' => '8ac7a4a1845f7e19018461a00b366a74', ' => 'test123', 'paymentTypes' => 'DB,3D', 'paymentMethods' => 'CC,DC', 'limit' => 20]);
print_r($transactionSpecifiedTimeFrame->getApiResponse());
// Get transactions for a specified time frame with pagination
$transactionPagination = $catalystPaySDK->getTransactionByDateWithPagination(['dateFrom' => '2023-01-01 00:00:00', 'dateTo' => '2023-01-01 01:00:00','merchantTransactionId' => 'test123', 'paymentTypes' => 'DB,3D', 'paymentMethods' => 'CC,DC', 'pageNo' => 2]);
print_r($transactionPagination);
} catch (Exception $e) {
echo $e->getMessage();
}
use CatalystPay\CatalystPaySDK;
// Example usage
try {
// Configured CatalystPaySDK
$token = 'OGE4Mjk0MTc0YjdlY2IyODAxNGI5Njk5MjIwMDE1Y2N8c3k2S0pzVDg=';
$entityId = '8a8294174b7ecb28014b9699220015ca';
$isProduction = false;
$catalystPaySDK = new CatalystPaySDK(
$token,
$entityId,
$isProduction
);
// Get summary level information for a certain date and/or settlement currency
$settlementReportBySummary = $catalystPaySDK->getSettlementReportBySummary(['dateFrom' => '2015-08-01', 'dateTo' => '2015-08-02', 'currency' => 'EUR', 'testMode' => CatalystPaySDK::TEST_MODE_INTERNAL]);
print_r($settlementReportBySummary->getApiResponse());
//Get further details for a particular aggregation id.
$responseData = $catalystPaySDK->getDetailLevelById(['id' => '8a82944a4cc25ebf014cc2c782423202','sortValue'=>'SettlementTxDate','sortOrder'=>'ASC', 'testMode' => CatalystPaySDK::TEST_MODE_INTERNAL]);
print_r($responseData->getApiResponse());
// Get detail level with pagination
$settlementReportPagination = $catalystPaySDK->getDetailLevelByIdWithPagination(['id' => '8a82944a4cc25ebf014cc2c782423202','reconciliationType'=>'SETTLED' ,'testMode' => CatalystPaySDK::TEST_MODE_INTERNAL, "pageNo" => 2]);
print_r($settlementReportPagination);
} catch (Exception $e) {
echo $e->getMessage();
}