Alignet (PayMe) PHP classes
- getWalletCode($id, $email, $firstNames, $lastNames)
- formatPrice($price)
- createPurchaseVerification($orderNumber, $price)
- verifyFromCallback($postData)
composer require kaoz70/alignet-payme-gateway
// Set the configuration class
$payMeConfig = new PayMeConfig('dev'); // or 'prod'
$payMeConfig->setWalletKey('key...');
$payMeConfig->setVpos2Key('key...');
$payMeConfig->setCommerceId('12345');
$payMeConfig->setAcquirerId('123');
$payMeConfig->setWalletId('123');
// Init the PayMe class
$payme = new PayMe($payMeConfig);
try {
$walletCode = $payme->getWalletCode(2458, '[email protected]', 'Juan Jose', 'Perez Romero')
// Store the wallet code in DB...
} catch (\SoapFault $e) {
// Handle SOAP error
} catch () {
// Handle generic error
}
$price = $payme->formatPrice($total); // All prices sent to PayMe should be formatted with this method
$orderNumber = 12364 // Generate a unique order number every time
$purchaseVerification = $payme->createPurchaseVerification($orderNumber, $price)
try {
// Set the configuration with the same data as before
$payMeConfig = new PayMeConfig('dev'); // or 'prod'
$payMeConfig->setWalletKey('key...');
$payMeConfig->setVpos2Key('key...');
$payMeConfig->setCommerceId('12345');
$payMeConfig->setAcquirerId('123');
$payMeConfig->setWalletId('123');
// Init the PayMe class
$payme = new PayMe($payMeConfig);
$data = $_POST;
$payme->verifyFromCallback($data);
// Success
} catch (PaymentStatusException $exception) {
// Handle verification exception
} catch (\Exception $exception) {
// Handle generic error
}