larium/pay

A unified API to access different payment gateways.

0.5.0 2023-06-24 12:35 UTC

README

Scrutinizer Code Quality Code Coverage Build Status

A unified API to access different payment gateways.

Basic usage

<?php
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.