PHP code example of gbksoft / rxp-remote-php
1. Go to this page and download the library: Download gbksoft/rxp-remote-php library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
gbksoft / rxp-remote-php example snippets
$card = ( new Card() )
->addType( CardType::VISA )
->addNumber( "4263971921001307" )
....
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();
php composer.phar update