gbksoft/rxp-remote-php

SDK to send requests and parse responses from Realex Payments using Remote

v1.2 2016-12-05 14:49 UTC

This package is not auto-updated.

Last update: 2024-02-17 16:24:23 UTC


README

You can sign up for a free Realex Payments sandbox account at https://www.realexpayments.co.uk/developers

Requirements

Instructions

  1. Add the following to your 'composer.json' file

    {
        "require": {
            "gbksoft/rxp-remote-php": "1.0.0"
        }    
    }
    
  2. Inside the application directory run composer:

    composer update
    

    OR (depending on your server configuration)

    php composer.phar update
    
  3. Add a reference to the autoloader class anywhere you need to use the sdk

    require_once ( 'vendor/autoload.php' );
  4. 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.