Tabs
API

If you're capturing data in your application or website, you can send it to our API in an Authorization request to be processed. You can also manage the full transaction lifecycle using the API, from initial payment through to settlement and additional actions like refunds.

Merchants processing captured card data through the API can attest to their PCI compliance by completing the PCI DSS Self-Assessment Questionnaire (SAQ) D.

To test using the API, please register for an account. Once you log in you can request Sandbox credentials from the My Apps section.

info

Step 1: Set up your client

Use the drop-down arrow to select how you want to perform this step. 

Dropdown
HTML/JS
<!DOCTYPE html>
<html>
    <head>
        <title>Basic Validation Example</title>
		<meta name="viewport" content="width=device-width, initial-scale=1">
        <script src="rxp-js.js"></script> <!-- Available at https://github.com/realexpayments -->
        <!-- Basic form styling given as an example -->
        <style type="text/css">
            label{display:block; font-size:12px; font-family:arial;}
            input{width:200px;}
            input.small{width:50px;}
            .twoColumn{float:left;margin:0 30px 20px 0;}
            .clearAll{clear:both;}
        </style>
    </head>
    <body><!-- Basic HTML form given as an example -->
        <form name="myForm" method="POST" autocomplete="off" action="https://serverSdkEndpoint">
        <label for="cardNumber">Card Number</label>
        <input type="tel" id="cardNumber" name="card-number" /><br><br>
        <label for="cardholderName">Cardholder Name</label>
        <input type="text" id="cardholderName" name="cardholder-name" /><br><br>
        <p class="twoColumn">
        <label>Expiry Date</label>
        <input type="tel" id="expiryDateMM" name="expiry-date-mm" placeholder="MM" class="small" />
        <input type="tel" id="expiryDateYY" name="expiry-date-yy" placeholder="YY" class="small"  /></p>
        <p class="twoColumn">
        <label for="cvn">Security Code</label>
        <input type="tel" id="cvn" name="cvn" class="small" /></p>
        <p class="clearAll">
        <input value="Pay Now" type="submit" name="submit" onclick="validate();" /></p>
        </form>
    </body>
</html>

Validation Example

function validate() { // Basic form validation using the JS Library given as an example
  var cardNumberCheck = RealexRemote.validateCardNumber(document.getElementById('cardNumber').value);
  var cardHolderNameCheck = RealexRemote.validateCardHolderName(document.getElementById('cardholderName').value);
  var expiryDate = document.getElementById('expiryDateMM').value.concat(document.getElementById('expiryDateYY').value);
  var expiryDateFormatCheck = RealexRemote.validateExpiryDateFormat(expiryDate);
  var expiryDatePastCheck = RealexRemote.validateExpiryDateNotInPast(expiryDate);
  if (document.getElementById('cardNumber').value.charAt(0) == "3") {
    cvnCheck = RealexRemote.validateAmexCvn(document.getElementById('cvn').value);
  } else {
    cvnCheck = RealexRemote.validateCvn(document.getElementById('cvn').value);
  }
  if (cardNumberCheck == false || cardHolderNameCheck == false || expiryDateFormatCheck == false || expiryDatePastCheck == false || cvnCheck == false) {
    // code here to inform the cardholder of an input error and prevent the form submitting
    return false;
  } else {
    return true;
  }
}
  • validateCardNumber - validates card number format and performs a Luhn check
  • validateCardHolderName - validates cardholder name according to ISO/IEC 8859-1:1998
  • validateCvn - validates non-Amex CVN
  • validateAmexCvn - validates Amex CVN
  • validateExpiryDateFormat - validates expiry date format
  • validateExpiryDateNotInPast - checks that the expiry date is not in the past
info
Unavailable
Off
Android

To integrate from end-to-end with our API SDK, you can capture the card data in your application and send it to the server-side SDK.

We provide a simple Android validation library that you can tailor to fit your solution. You can install it using Gradle or Maven, and it's also available on GitHub. For more information, see the SDKs and Libraries - Overview page.

  • validateCardNumber - validates card number format and performs a Luhn check
  • validateCardHolderName - validates cardholder name according to ISO/IEC 8859-1:1998
  • validateCvn - validates non-Amex CVN
  • validateAmexCvn - validates Amex CVN
  • validateExpiryDateFormat - validates expiry date format
  • validateExpiryDateNotInPast - checks that the expiry date is not in past
info
Unavailable
Off
iOS

Global Payments now offers Apple Pay. For implementation instructions, see our Digital Wallets article.

info

To integrate from end-to-end with our API SDK, you can capture the card data in app and send it to the server-side SDK.

We provide a simple iOS (Swift) validation library that you can tailor to fit your solution. You can install it using Cocoapods, and it's also available on GitHub. For more information, see our SDKs and Libraries page.

The library contains the following methods.

  • validateCardNumber - validates card number format and performs a Luhn check
  • validateCardHolderName - validates cardholder name according to ISO/IEC 8859-1:1998
  • validateCvn - validates non-Amex CVN
  • validateAmexCvn - validates Amex CVN
  • validateExpiryDateFormat - validates expiry date format
  • validateExpiryDateNotInPast - checks that the expiry date is not in past
info
Unavailable
Off

Step 2: Set up your server

An Authorization is a standard payment request or charge processed by Global Payments. First, create a card object with your captured cardholder data and add this to your request. The SDK handles generating the secure hash, transmission of data and creation of the response object. Using the response object methods you can obtain all the data you need from the outcome of the transaction.

Always keep your shared secret on the server-side to avoid exposing it to the public.

info
// configure client & request settings
GatewayConfig config = new GatewayConfig();
config.setMerchantId("MerchantId");
config.setAccountId("internet");
config.setSharedSecret("secret");
config.setServiceUrl("https://api.sandbox.realexpayments.com/epage-remote.cgi");
ServicesContainer.configureService(config);

// create the card object
CreditCardData card = new CreditCardData();
card.setNumber("4263970000005262");
card.setExpMonth(12);
card.setExpYear(2025);
card.setCvn("131");
card.setCardHolderName("James Mason");

try {
   // process an auto-settle authorization
   Transaction response = card.charge(new BigDecimal("19.99"))
                           .withCurrency("EUR")
                           .execute();

   String result = response.getResponseCode(); // 00 == Success
   String message = response.getResponseMessage(); // [ test system ] AUTHORISED

   // get the details to save to the DB for future requests
   String orderId = response.getOrderId(); // ezJDQjhENTZBLTdCNzNDQw
   String authCode = response.getAuthorizationCode(); // 12345
   String paymentsReference = response.getTransactionId(); // pasref 14622680939731425
   String schemeReferenceData = response.getSchemeId(); // MMC0F00YE4000000715
} 

catch (ApiException exce) {
   // TODO: add your error handling here
}
<?php
require_once('vendor/autoload.php');

use GlobalPayments\Api\ServiceConfigs\Gateways\GpEcomConfig;
use GlobalPayments\Api\ServicesContainer;
use GlobalPayments\Api\Entities\Exceptions\ApiException;
use GlobalPayments\Api\PaymentMethods\CreditCardData;

$config = new GpEcomConfig();
$config->merchantId = "MerchantId";
$config->accountId = "internet";
$config->sharedSecret = "secret";
$config->serviceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi";
ServicesContainer::configureService($config);

// create the card object
$card = new CreditCardData();
$card->number = "4263970000005262";
$card->expMonth = 12;
$card->expYear = 2025;
$card->cvn = "131";
$card->cardHolderName = "James Mason";

try {
   // process an auto-capture authorization
   $response = $card->charge(19.99)
      ->withCurrency("EUR")
      ->execute();
} catch (ApiException $e) {
   // TODO: Add your error handling here
}

if (isset($response)) {
   $result = $response->responseCode; // 00 == Success
   $message = $response->responseMessage; // [ test system ] AUTHORISED

   // get the details to save to the DB for future requests
   $orderId = $response->orderId; // N6qsk4kYRZihmPrTXWYS6g
   $authCode = $response->authorizationCode; // 12345
   $paymentsReference = $response->transactionId; // pasref: 14610544313177922
   $schemeReferenceData = $response->schemeId; // MMC0F00YE4000000715
}
// configure client & request settings
ServicesContainer.ConfigureService(new GpEcomConfig
{
   MerchantId = "MerchantId",
   AccountId = "internet",
   SharedSecret = "secret",
   ServiceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi"
});

// create the card object
var card = new CreditCardData
{
   Number = "4263970000005262",
   ExpMonth = 12,
   ExpYear = 2025,
   Cvn = "131",
   CardHolderName = "James Mason"
};

try
{
   // process an auto-capture authorization
   Transaction response = card.Charge(129.99m)
      .WithCurrency("EUR")
      .Execute();

   var result = response.ResponseCode; // 00 == Success
   var message = response.ResponseMessage; // [ test system ] AUTHORISED

   // get the response details to save to the DB for future requests
   var orderId = response.OrderId; // ezJDQjhENTZBLTdCNzNDQw
   var authCode = response.AuthorizationCode; // 12345
   var paymentsReference = response.TransactionId; // pasref 14622680939731425
   var schemeReferenceData = response.SchemeId; // MMC0F00YE4000000715
}

catch (ApiException exce)
{
   // TODO: add your error handling here
}
<?xml version="1.0" encoding="UTF-8"?>
<request type="auth" timestamp="20180613141207">
  <merchantid>MerchantId</merchantid>
  <account>internet</account>
  <channel>ECOM</channel>
  <orderid>N6qsk4kYRZihmPrTXWYS6g</orderid>
  <amount currency="EUR">1001</amount>
  <card>
    <number>4263970000005262</number>
    <expdate>0425</expdate>
    <chname>James Mason</chname>
    <type>VISA</type>
    <cvn>
      <number>123</number>
      <presind>1</presind>
    </cvn>
  </card>
  <autosettle flag="1"/>
  <sha1hash>87707637a34ba651b6185718c863abc64b673f20</sha1hash>
</request>

Step 3: Test

Use our test cards to try out different scenarios for your application to handle. For the full list of cards, see our Test Cards article.

Visa
Successful
4263 9700 0000 5262
Visa
Declined
4000 1200 0000 1154
Mastercard
Successful
5425 2300 0000 4415
Mastercard
Declined
5114 6100 0000 4778
Enhance your solution

Explore more functionality to enrich your application.

Buttons
Card Payments - API Reference

Card Payments

Disabled
Icon Name
credit-card
Digital Wallets

Digital Wallets

Disabled
Icon Name
money-bill-wave
Non-Card Payment Methods

Payment Methods

Disabled
Icon Name
piggy-bank
SCA & 3D Secure

3D Secure

Disabled
Icon Name
lock-alt
Unavailable
Off
Internal Title
XML (Ecommerce Only)
Show Content Nav
On
Tags
Subtitle
Process captured data through our API.