PHP code example of larium / pay

1. Go to this page and download the library: Download larium/pay 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/ */

    

larium / pay example snippets



use Larium\CreditCard\CreditCard;
use Larium\Pay\Gateway\MyGateway; //Use a gateway
use Larium\Pay\Transaction\PurchaseTransaction;

# Set up a Card object
$card = new CreditCard([
    "holderName" => "John Doe",
    "number" => "41111111111111",
    "month" => "12",
    "year" => "2020",
    "cvv" => "123"
]);

# Set up a transaction
$amount = 1000; # Amount in cents.
$txn = new PurchaseTransaction($amount, $card);

# Set up the gateway
$options = [
    'login'=>'user-login',
    'password'=>'SeCRetPasSwoRd',
];
$gateway = new MyGateway($options);

$response = $gateway->execute($txn);

$response->isSuccess(); # true or false

echo $response->getTransactionId(); # Get unique id reference.