gbksoft / rxp-remote-php
SDK to send requests and parse responses from Realex Payments using Remote
v1.2
2016-12-05 14:49 UTC
Requires
- php: >=5.3.9
- apache/log4php: 2.3.0
- hafriedlander/phockito: 1.0.0
- symfony/property-access: 2.7.3
- symfony/serializer: 2.7.3
This package is not auto-updated.
Last update: 2024-11-23 20:42:30 UTC
README
You can sign up for a free Realex Payments sandbox account at https://www.realexpayments.co.uk/developers
Requirements
- PHP >= 5.3.9
- Composer (https://getcomposer.org/)
Instructions
-
Add the following to your 'composer.json' file
{ "require": { "gbksoft/rxp-remote-php": "1.0.0" } }
-
Inside the application directory run composer:
composer update
OR (depending on your server configuration)
php composer.phar update
-
Add a reference to the autoloader class anywhere you need to use the sdk
require_once ( 'vendor/autoload.php' );
-
Use the sdk
$card = ( new Card() ) ->addType( CardType::VISA ) ->addNumber( "4263971921001307" ) ....
##SDK Example##
require_once ( 'vendor/autoload.php' ); use com\realexpayments\remote\sdk\domain\Card; use com\realexpayments\remote\sdk\domain\CardType; use com\realexpayments\remote\sdk\domain\PresenceIndicator; use com\realexpayments\remote\sdk\domain\payment\AutoSettle; use com\realexpayments\remote\sdk\domain\payment\AutoSettleFlag; use com\realexpayments\remote\sdk\domain\payment\PaymentRequest; use com\realexpayments\remote\sdk\domain\payment\PaymentResponse; use com\realexpayments\remote\sdk\domain\payment\PaymentType; use com\realexpayments\remote\sdk\RealexClient; // test payment $card = ( new Card() ) ->addType( CardType::VISA ) ->addNumber( "4263971921001307" ) ->addExpiryDate( "1220" ) ->addCvn( "123" ) ->addCvnPresenceIndicator( PresenceIndicator::CVN_PRESENT ) ->addCardHolderName( "James Mason" ); $request = ( new PaymentRequest() ) ->addType( PaymentType::AUTH ) ->addCard( $card ) ->addMerchantId( "myMerchantId" ) ->addAccount( "mySubAccount" ) ->addAmount( 1001 ) ->addCurrency( "EUR" ) ->addAutoSettle( ( new AutoSettle() )->addFlag( AutoSettleFlag::TRUE ) ); $client = new RealexClient( "mySecret" ); $response = $client->send( $request ); // do something with the response echo $response->toXML(); $resultCode = $response->getResult(); $message = $response->getMessage();
License
See the LICENSE file.