digistorm / omnipay-rdp
Red Dot Payment driver for the Omnipay payment processing library
2.0.0
2024-10-31 21:40 UTC
Requires
- php: ^8.1
- moneyphp/money: ^3.0
- omnipay/common: ^3
- symfony/http-client: ^7.1
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.64
- http-interop/http-factory-guzzle: ^1.2
- omnipay/tests: ^4
- phpstan/phpstan: ^1.12
- rector/rector: ^1.2
- spaze/phpstan-disallowed-calls: ^3.5
This package is auto-updated.
Last update: 2025-03-01 00:36:19 UTC
README
RDP (Red Dot Payment) driver for the Omnipay PHP payment processing library
Currently only supports purchases with tokenized card. Available methods:
- createToken()
- purchase()
Usage
<?php use Omnipay\Omnipay; use Omnipay\Common\CreditCard; use Money\Currency; use Money\Money; // Create a gateway for the Rdp Gateway // (routes to GatewayFactory::create) /* @var \Omnipay\Rdp\Gateway $gateway */ $gateway = Omnipay::create('Rdp'); $gateway->setTestMode(true); $gateway->setEndpointBase('https://secure-dev.reddotpayment.com/'); $gateway->setMerchantId('merchantIdValue'); $gateway->setSecretKey('secretKeyValue'); // Tokenize a card /* @var \Omnipay\Rdp\Message\TokenResponse $response */ $response = $gateway->createToken([ 'card' => new CreditCard([ 'firstName' => 'John', 'lastName' => 'Doe', 'expiryMonth' => '09', 'expiryYear' => '2029', 'number' => '4444333322221111', 'cvv' => '123', ]), 'email' => 'john.doe@example.com', 'order_id' => 'cba', ])->send(); // Charge using a card /* @var \Omnipay\Rdp\Message\PurchaseResponse $response */ $response = $gateway->purchase([ 'card' => new CreditCard([ 'firstName' => 'John', 'lastName' => 'Doe', 'expiryMonth' => '09', 'expiryYear' => '2029', 'number' => '4444333322221111', 'cvv' => '123', ]), 'payer_id' => $response->payer_id, 'payer_name' => 'John Doe', 'payer_email' => 'john.doe@example.com', 'orderId' => 'abc', 'money' => new Money(100, new Currency('SGD')), ])->send();