SimPay direct billing

Base:

$simpay = $payment->online(
    new SimPayDirectBillingPayment(
        'apiKey (not used anymore, you can pass anything)', 
        'apiPassword', 
        'serviceId', 
        'serviceHash'
    )
);

Generate payment:

$simpay->setAmount(15.00); //required
//optional
$simpay->setDescription('description');
$simpay->setControl('control');
$simpay->setReturnFail('https://return.url/fail');
$simpay->setReturnSuccess('https://return.url/success');
$simpay->setPhoneNumber('phoneNumber');

$simpayPayment = $simpay->generatePayment();
$simpayPayment->getTransactionUrl();
$simpayPayment->getTransactionId();

Get IPN signature:

// Your code in IPN handler.

// example payload getter
$payload = json_decode(file_get_contents('php://input'), true);

$signature = $simpay->generateIpnSignature($payload);

if(!hash_equals($signature, $payload['signature'])) {
    throw new \Exception('invalid signature');
}

Last updated