NAV Navigation Menu
eWAY
cURL (JSON) SOAP PHP Java .NET Node.js Ruby

Introduction

Combining all the most popular payment solutions in a single package, Eway’s Rapid API includes multiple ways to interface with the gateway, fraud prevention, digital wallets and hosted payment solutions to help developers create secure, perfectly rendered payment pages on all devices.

This API reference outlines the expected requests and responses to use Eway's Rapid API.

Getting started

# Below in this column are example requests and responses of connecting to the
# Eway Rapid REST API using JSON.
#
# The requests are written as cURL commands that can be copied into a terminal.
<!--
The examples in this column demonstrate requests and responses when connecting to the Eway Rapid API SOAP gateway.
-->
// Below in this column are examples of making requests and handling responses to
// Eway's Rapid API using the Eway Rapid PHP SDK.
//
// See the Languages and SDKs section for instructions on installing the Eway Rapid PHP SDK
// Below in this column are examples of making requests and handling responses to
// Eway's Rapid API using the Eway Rapid Java SDK.
//
// See the Languages and SDKs section for instructions on installing the Eway Rapid Java SDK
// Below in this column are examples of making requests and handling responses to
// Eway's Rapid API using the Eway Rapid .NET SDK.
//
// See the Languages and SDKs section for instructions on installing the Eway Rapid .NET SDK
// Below in this column are examples of making requests and handling responses to
// Eway's Rapid API using the Eway Rapid Node.js SDK.
//
// See the Languages and SDKs section for instructions on installing the Eway Rapid Node.js SDK
# Below in this column are examples of making requests and handling responses to
# Eway's Rapid API using the Eway Rapid Ruby Gem.
#
# See the Languages and SDKs section for instructions on installing the Eway Rapid Ruby Gem

Eway's Rapid API provides a number of ways of connecting and formatting requests, so you can choose what works best for your platform.

This reference focusses on REST using JSON in examples. The other interfaces follow the same structure and the endpoints are provided for each.

The Rapid API provides a choice of five connection methods for processing payments (as well as the pre-coded Pay Now button). Choosing which one will depend on the system and features required.

Once you've worked out what is best for you, be sure to read through the rest of this Getting Started section before diving in!

Authentication

All requests to Eway's Rapid API need to be authenticated using basic authentication. This uses the Eway API Key and Password in the username and password fields respectively.

This authentication is sent in the HTTP header, most frameworks and libraries provide a way to set these. The Eway SDKs accept the API key and Password along with the Endpoint (sandbox or production) when they are initialised.

# Sample Basic Authentication with cURL
curl --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    https://api.sandbox.ewaypayments.com/Transaction/
<?php

$apiKey = '60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR';
$apiPassword = 'API-P4ss';
$apiEndpoint = \Eway\Rapid\Client::MODE_SANDBOX; // Use \Eway\Rapid\Client::MODE_PRODUCTION when you go live
$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);
String apiKey = "60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR";
String password = "API-P4ss";
String rapidEndpoint = "Sandbox"; // Use "Production" when you go live

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);
HttpClient httpClient = new HttpClient();
RapidOptions rapidOptions = new RapidOptions
{
    ApiKey = "Rapid API KEY",
    Password = "Rapid API Password",
    RapidEndPoint = RapidEndpoints.SANDBOX
};
rapidOptions.ConfigureHttpClient(httpClient);
IRapidClient rapidClient = new RapidClient(httpClient);
var rapid = require('eway-rapid');

var apiKey   = '60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR',
    password = 'API-P4ss',
    rapidEndpoint = 'Sandbox'; // Use 'Production' when you go live

var client = rapid.createClient(apiKey, password, rapidEndpoint);
require 'eway_rapid'

api_key = '60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR'
password = 'API-P4ss'
endpoint = 'Sandbox' # Use 'Production' when you go live

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

Creating an Eway Sandbox API key

  1. You will need an Eway Partner Account - if you don't have an account, sign up for free!

  2. Navigate to the Sandbox using the link below for your country

  3. Go to My Account > API Key

  4. Your Rapid API Key will be displayed in the API Key field

  5. Click Generate Password to create a password for the key. A password can only be viewed once after it has been generated - if you forget it a new one can be generated by clicking Generate Password again (the old one will no longer work).

More detailed instructions for managing your Eway Rapid API credentials are available in the Eway Knowledgebase

API Versioning

Sample of setting the version

curl --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --request GET \
    --header "X-EWAY-APIVERSION: 47" \
    https://api.sandbox.ewaypayments.com/Transaction/11259580
SOAP does not support versioning at this time and will use the default Rapid v31 branch
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);
$client->setVersion(40);
<!-- IRapidClient rapidClient = new RapidClient(httpClient);
rapidClient.SetVersion(47); -->

The .NET Standard SDK will invoke Rapid v47 and does not support specifying previous versions of the Rapid API.

Major changes to the Rapid API (such as adding or removing fields) are made to new versions of Rapid API in order to prevent these changes from breaking existing integrations. Specifying specific versions of the API is supported on all endpoints except for SOAP at this time.

This documentation is designed around version 47, which is the most current version the Rapid API.

To access an specific version of Rapid API, an additional header must be sent with the request to Eway: X-EWAY-APIVERSION: <number>. See the "cURL(JSON)" tab for an example. Some Eway SDKs support setting the version in the client, check the appropriate tab for an example.

Current Version

Version 47

Changes from previous version:

Previous versions

Version 40

Changes from previous version:

Version 31

The original Rapid API version. This is used by default if no version is specified

Languages and SDKs

The Rapid API is built on two common data formats: JSON (through REST) and XML (through SOAP).

To make development even faster and easier, Eway provides Software Development Kits for popular languages - including PHP, Java, .NET Standard and Node.js. These provide native structures and functions to do the heavy lifting for you.

All Eway SDKs are free, MIT licensed and open source. Sample code for supported Eway Rapid methods can be found by using the tabs on the top right of this page. Bug reports, suggestions and improvements are welcome via the relevant SDK's GitHub page or via contacting the Eway Support Team!

PHP

  $ composer require eway/eway-rapid-php

The Eway Rapid PHP library requires PHP 5.4.0 or greater, with the curl, json and openssl extensions.

  <?php
  require('vendor/autoload.php');

It can be quickly installed using Composer, a PHP package manager. Once installed, simply include the Composer autoloader to access the library's functions.

Examples for most functions can be found by clicking the "PHP" tab at the top right of this page.

GitHub Logo The source code can be viewed, forked, pushed and pulled on GitHub: https://github.com/eWAYPayment/eway-rapid-php

Java

  <dependency>
    <groupId>com.ewaypayments</groupId>
    <artifactId>eway-rapid-java</artifactId>
    <version>LATEST</version>
  </dependency>

To use the Eway Rapid Java library add the dependency to your Maven project's pom.xml - this will add the library to your project, along with the required dependencies.

Examples for most functions can be found by clicking the "Java" tab at the top right of this page.

GitHub Logo The source code can be viewed, forked, pushed and pulled on GitHub: https://github.com/eWAYPayment/eway-rapid-java

.NET Standard

  PM> Install-Package Eway.Rapid.Standard

The Eway Rapid C# .NET Standard implementation is broken down into three packages available from NuGet: - Eway.Rapid.Standard - Eway.Rapid.Standard.Extensions.DependencyInjection - Eway.Rapid.Standard.Abstractions

Refer to the README on the NuGet package listings to confirm which package is most suitable for your use case.

Examples for most functions can be found by clicking the ".NET" tab at the top right of this page.

GitHub Logo The source code can be viewed, forked, pushed and pulled on GitHub: https://github.com/eWAYPayment/eway-rapid-netstandard

Node.js

  npm install eway-rapid

The Eway Rapid Node.js module can be easily installed using npm, the Node.js Package Manager. It can be installed in your project either via the command line (as shown on the right) or by adding "eway-rapid" directly to your project's package.json.

Examples for most functions can be found by clicking the "Node.js" tab at the top right of this page.

GitHub Logo The source code can be viewed, forked, pushed and pulled on GitHub: https://github.com/eWAYPayment/eway-rapid-node

Ruby

  gem install eway_rapid

The Eway Rapid Ruby Gem can be easily installed using RubyGems, the Ruby Package Manager. It can be installed in your project either via the command line (as shown on the right) or by adding gem 'eway_rapid' directly to your project's Gemfile.

Examples for most functions can be found by clicking the "Ruby" tab at the top right of this page.

GitHub Logo The source code can be viewed, forked, pushed and pulled on GitHub: https://github.com/eWAYPayment/eway-rapid-ruby

iOS

The Eway Rapid iOS Mobile SDK can be easily installed using CocoaPods, a dependency manager for Swift and Objective-C Cocoa projects. It can be installed in your project by adding the following line to your iOS project's Podfile:

pod 'eWAYPaymentsSDK'

Then run the following in a terminal window

pod install

This API reference focusses on the server side API functions, for details of using the iOS SDK, please see our eWAY iOS SDK Getting Started guide.

Android

The Eway Rapid Android Mobile SDK can be easily installed using Gradle, a dependency manager for Java projects. It can be installed in two steps:

  1. Add the repository to the project's build gradle file under all projects:

repositories {
jcenter()
maven { url "http://dl.bintray.com/webactive/maven" }
}

  1. Then add the dependency to the dependencies section of app’s build gradle:

dependencies {
...
compile "com.eway.payment:android-sdk:1.+"
}

This API reference focusses on the server side API functions, for details of using the Android SDK, please see our eWAY Android SDK Getting Started guide.

Transaction Types

Each transaction request to Eway Rapid API needs to include the Transaction Type in the TransactionType field. This should be one of:

Purchase: This is the default transaction type and refers to a standard eCommerce transaction where the customer initiates the payment.

MOTO: Allows a merchant to process transactions through their system on behalf of the customer. Used in situations such as manual orders through a shopping cart admin area when taking a payment over the phone.

Recurring: When using an automated billing system you must flag transactions as recurring. This means that the CVN is not required to process the transaction. Note that usually the bank requires you to have already processed a fully authorised transaction with CVN for that credit card.

Methods

A transaction request should also contain a Method which determines the action being taken with the request.

When using one of the Eway Rapid SDKs, setting this field isn't required as it is determined by the method called.

This field should be one of:

ProcessPayment: This method allows merchants to process a standard payment.

Authorise: This transaction type will authorise and hold an amount on the customer's card without charging it, allowing you to capture it at a later time. More details are available in the Pre-Auth documentation. When using an Eway Rapid SDK this is automatically set when the Capture field is set to false.

TokenPayment: This method allows merchants to process payments using Token customers they have stored with Eway. Merchants can either load an existing token customer by passing in their TokenCustomerID in the initial request, or create a new Token customer by leaving the TokenCustomerID field blank (Transparent Redirect and Responsive Shared Page only).

Any values passed in the Customer part of the initial request will be used to either create or update the Token customer, depending on the TokenCustomerID value.

When loading an existing Token customer, the customer’s details will be returned by Eway, including the masked credit card details. The masked card can be sent back to Eway when the payment is processed if the customer wants to process the payment using the card on file.

When using an Eway Rapid SDK, this method is used if a TokenCustomerID is used for the transaction, or if SaveCustomer is set to true.

CreateTokenCustomer: This method allows merchants to create token customers without processing a payment.

When using an Eway Rapid SDK this is automatically set when creating a customer.

UpdateTokenCustomer: This method allows merchants to update existing token customers without processing a payment.

When using an Eway Rapid SDK this is automatically set when updating a customer.

Payment Types

Eway's Rapid API supports credit cards, as well as multiple digital wallet solutions.

Credit Card: A standard transaction through the various card networks (Visa, MasterCard, American Express, Diners, JCB)

Apple Pay: Apple Pay is a digital wallet solution offered by Apple that allows consumers to securely store their card and billing details in their iDevice or Mac and make one-click payments to online retailers through the Safari browser and iOS applications, as well as in person payments at physical terminals.

Click to Pay: Click to Pay is a digital wallet offered directly by the card schemes that allows consumers to securely store their card and billing details in their Click to Pay wallet and make one-click payments at participating online retailers.

Errors

foreach ($response->getErrors() as $error) {
    echo "Error message: ".\Eway\Rapid::getMessage($error)."<br>";
}
for (String errorcode: response.getErrors()) {
    System.out.println("Error Message: " + RapidSDK.userDisplayMessage(errorcode, "en"));
}
List<string> errorList = new List<string>();
errorList = response.Errors.Split(',').ToList();
var request = new CodeLookupRequest
{
    Language = "en",
    ErrorCodes = errorList
};
var errorResponse = await rapidClient.APICodeLookup(request);
foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
{
    Console.WriteLine("Response code: " + codeDetails.ErrorCode);
    Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
}
reason.getErrors().forEach(function(error) {
    console.log("Error Messages: " + rapid.getMessage(error, "en"));
});
response.errors.each { |e| puts "Response message: " + EwayRapid::RapidClient.user_display_message(e) }

If there is a problem with a request to Eway, there are two possible responses that should be handled by the connecting system

If you are using an eWAY Rapid SDK, the errors will usually be returned in an Errors field or property. A function is provided to assist with translating the error code to human friendly text.

Connection Methods

Direct Connection

The Direct Connection API allows for purchases to be submitted directly to Eway from your server. This allows processing of transactions in one, simple server side call.

Since card data is passed via the server, one of the following must be used to ensure compliance with card data regulations:

Transactions not involving credit card data (such as a token payment or digital wallet payment) may be processed without proof of PCI DSS compliance. In the Eway Sandbox, PCI DSS compliance can be enabled via the Sandbox Settings.

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/Transaction
HTTP POST (XML) https://api.ewaypayments.com/DirectPayment.xml
HTTP POST (JSON) https://api.ewaypayments.com/DirectPayment.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/Transaction
HTTP POST (XML) https://api.sandbox.ewaypayments.com/DirectPayment.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/DirectPayment.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Request Field Descriptions

Basic Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "CardDetails": {
             "Name": "John Smith",
             "Number": "4444333322221111",
             "ExpiryMonth": "12",
             "ExpiryYear": "25",
             "CVN": "123"
           }
        },
        "Payment": {
           "TotalAmount": 1000
        },
        "Method": "ProcessPayment",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <CardDetails>
                        <Number>4444333322221111</Number>
                        <Name>John Smith</Name>
                        <ExpiryMonth>12</ExpiryMonth>
                        <ExpiryYear>25</ExpiryYear>
                        <CVN>123</CVN>
                    </CardDetails>
                </Customer>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <Method>ProcessPayment</Method>
                <TransactionType>Purchase</TransactionType>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Customer' => [
        'CardDetails' => [
            'Name' => 'John Smith',
            'Number' => '4444333322221111',
            'ExpiryMonth' => '12',
            'ExpiryYear' => '25',
            'CVN' => '123',
        ]
    ],
    'Payment' => [
        'TotalAmount' => 1000,
    ],
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();
Customer customer = new Customer();

CardDetails cardDetails = new CardDetails();
cardDetails.setName("John Smith");
cardDetails.setNumber("4444333322221111");
cardDetails.setExpiryMonth("12");
cardDetails.setExpiryYear("25");
cardDetails.setCVN("123");
customer.setCardDetails(cardDetails);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

transaction.setCustomer(customer);
transaction.setPaymentDetails(paymentDetails);
transaction.setTransactionType(TransactionType.Purchase);

CreateTransactionResponse response = client.create(PaymentMethod.Direct, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

DirectPaymentRequest transaction = new DirectPaymentRequest()
{
    Customer = new DirectTokenCustomer()
    {
        CardDetails  = new CardDetails()
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "11",
            ExpiryYear = "25",
            CVN = "123"
        }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    TransactionType = TransactionTypes.Purchase
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.DIRECT, {
    "Customer": {
       "CardDetails": {
         "Name": "John Smith",
         "Number": "4444333322221111",
         "ExpiryMonth": "12",
         "ExpiryYear": "25",
         "CVN": "123"
       }
    },
    "Payment": {
       "TotalAmount": 1000
    },
    "TransactionType": "Purchase"
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

transaction.customer = EwayRapid::Models::Customer.new
card_details = EwayRapid::Models::CardDetails.new
card_details.name = 'John Smith'
card_details.number = '4444333322221111'
card_details.expiry_month = '05'
card_details.expiry_year = '25'
card_details.cvn = '123'
transaction.customer.card_details = card_details

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details

transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)

Complete Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "Reference": "A12345",
           "Title": "Mr.",
           "FirstName": "John",
           "LastName": "Smith",
           "CompanyName": "Demo Shop 123",
           "JobDescription": "Developer",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "PostalCode": "2000",
           "Country": "au",
           "Phone": "09 889 0986",
           "Mobile": "09 889 6542",
           "Email": "demo@example.org",
           "Url": "http://www.ewaypayments.com",
            "CardDetails": {
             "Name": "John Smith",
             "Number": "4444333322221111",
             "ExpiryMonth": "12",
             "ExpiryYear": "25",
             "StartMonth" : "01",
             "StartYear" : "13",
             "IssueNumber": "01",
             "CVN": "123"
           }
        },
        "ShippingAddress": {
           "ShippingMethod": "NextDay",
           "FirstName": "John",
           "LastName": "Smith",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "Country": "au",
           "PostalCode": "2000",
           "Phone": "09 889 0986"
        },
        "Items": [
         {
           "SKU": "12345678901234567890",
           "Description": "Item Description 1",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         },
         {
           "SKU": "123456789012",
           "Description": "Item Description 2",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         }
        ],
        "PaymentInstrument": {
           "ThreeDSecureAuth": {
            "Cryptogram": "AgAAAAAA4n1uzQPRaATeQAAAAAA=",
            "ECI": "05",
            "XID": "AAAAAAAA4n1uzQPRaATeQAAAAAA=",
            "AuthStatus": "Y",
            "dsTransactionId": "AAAAAAAA4n1uzQPRaATeQAAAAAA=",
            "Version": "2.1.0"
           }
        },  
        "Options": [
         {
           "Value": "Option1"
         },
         {
           "Value": "Option2"
         }
        ],
        "Payment": {
           "TotalAmount": 1000,
           "InvoiceNumber": "Inv 21540",
           "InvoiceDescription": "Individual Invoice Description",
           "InvoiceReference": "513456",
           "CurrencyCode": "AUD"
        },
        "Method": "ProcessPayment",
        "DeviceID": "D1234",
        "CustomerIP": "127.0.0.1",
        "PartnerID": "ID",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <Reference>A12345</Reference>
                    <Title>Mr.</Title>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <CompanyName>Demo Shop 123</CompanyName>
                    <JobDescription>Developer</JobDescription>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Mobile>0289712345</Mobile>
                    <Comments>Customer comments</Comments>
                    <Fax>0289712345</Fax>
                    <Url>http://www.ewaypayments.com</Url>
                    <CardDetails>
                        <Number>4444333322221111</Number>
                        <Name>John Smith</Name>
                        <ExpiryMonth>12</ExpiryMonth>
                        <ExpiryYear>25</ExpiryYear>
                        <CVN>123</CVN>
                    </CardDetails>
                </Customer>
                <ShippingAddress>
                    <ShippingMethod>NextDay</ShippingMethod>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Fax>0289712345</Fax>
                </ShippingAddress>
                <Items>
                    <LineItem>
                        <SKU>12345678901234567890</SKU>
                        <Description>Item Description 1</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                    <LineItem>
                        <SKU>123456789012</SKU>
                        <Description>Item Description 2</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                </Items>
                <Options>
                    <Option>
                        <Value>Option1</Value>
                    </Option>
                    <Option>
                        <Value>Option2</Value>
                    </Option>
                </Options>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                    <InvoiceNumber>Inv 21540</InvoiceNumber>
                    <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
                    <InvoiceReference>Individual Invoice Description</InvoiceReference>
                    <CurrencyCode>AUD</CurrencyCode>
                </Payment>
                <CustomerIP>127.0.0.1</CustomerIP>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
                <DeviceID>D1234</DeviceID>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>

<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Customer' => [
        'Reference' => 'A12345',
        'Title' => 'Mr.',
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'CompanyName' => 'Demo Shop 123',
        'JobDescription' => 'Developer',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'PostalCode' => '2000',
        'Country' => 'au',
        'Phone' => '09 889 0986',
        'Mobile' => '09 889 6542',
        'Email' => 'demo@example.org',
        "Url" => "http://www.ewaypayments.com",
        'CardDetails' => [
            'Name' => 'John Smith',
            'Number' => '4444333322221111',
            'ExpiryMonth' => '12',
            'ExpiryYear' => '25',
            'CVN' => '123',
        ]
    ],
    'ShippingAddress' => [
        'ShippingMethod' => \Eway\Rapid\Enum\ShippingMethod::NEXT_DAY,
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'Country' => 'au',
        'PostalCode' => '2000',
        'Phone' => '09 889 0986',
    ],
    'Items' => [
        [
            'SKU' => '12345678901234567890',
            'Description' => 'Item Description 1',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
            // Total is calculated automatically
        ],
        [
            'SKU' => '123456789012',
            'Description' => 'Item Description 2',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
        ],
    ],
    'Options' => [
        [
            'Value' => 'Option1',
        ],
        [
            'Value' => 'Option2',
        ],
    ],
    'Payment' => [
        'TotalAmount' => 1000,
        'InvoiceNumber' => 'Inv 21540',
        'InvoiceDescription' => 'Individual Invoice Description',
        'InvoiceReference' => '513456',
        'CurrencyCode' => 'AUD',
    ],
    'DeviceID' => 'D1234',
    'CustomerIP' => '127.0.0.1',
    'PartnerID' => 'ID',
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'Capture' => true,
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

Customer customer = new Customer();
customer.setReference("A12345");
customer.setTitle("Mr.");
customer.setFirstName("John");
customer.setLastName("Smith");
customer.setCompanyName("eWay");
customer.setJobDescription("Java Developer");
customer.setPhone("09 889 0986");
customer.setMobile("09 889 6542");
customer.setUrl("http://ewaypayments.com");
customer.setCustomerDeviceIP("127.0.0.1");
customer.setEmail("demo@example.org");

Address address = new Address();
address.setStreet1("Level 5");
address.setStreet2("369 Queen Street");
address.setCity("Sydney");
address.setState("NSW");
address.setCountry("au");
address.setPostalCode("2000");
customer.setAddress(address);

CardDetails cardDetails = new CardDetails();
cardDetails.setName("John Smith");
cardDetails.setNumber("4444333322221111");
cardDetails.setExpiryMonth("12");
cardDetails.setExpiryYear("25");
cardDetails.setStartMonth("01");
cardDetails.setStartYear("13");
cardDetails.setIssueNumber("01");
cardDetails.setCVN("123");
customer.setCardDetails(cardDetails);
transaction.setCustomer(customer);

ShippingDetails shippingDetail = new ShippingDetails();
shippingDetail.setFirstName("John");
shippingDetail.setLastName("Smith");
shippingDetail.setPhone("09 889 0986");
shippingDetail.setShippingMethod(ShippingMethod.LowCost);

Address shipAddress = new Address();
shipAddress.setStreet1("Level 5");
shipAddress.setStreet2("369 Queen Street");
shipAddress.setCity("Sydney");
shipAddress.setState("NSW");
shipAddress.setCountry("au");
shipAddress.setPostalCode("2000");
shippingDetail.setShippingAddress(shipAddress);
transaction.setShippingDetails(shippingDetail);

List<LineItem> items = new ArrayList<>();
LineItem item1 = new LineItem();
item1.setSku("12345678901234567890");
item1.setDescription("Item Description 1");
item1.setQuantity(1);
item1.setUnitCost(400);
item1.setTotalTax(100);
item1.setTotal(500);
items.add(item1);

LineItem item2 = new LineItem();
item2.setSku("123456789012");
item2.setDescription("Item Description 2");
item2.setQuantity(1);
item2.setUnitCost(400);
item2.setTotalTax(100);
item2.setTotal(500);
items.add(item2);

transaction.setLineItems(items);

List<String> options = new ArrayList<>();
options.add("Option1");
options.add("Option2");
transaction.setOptions(options);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);
paymentDetails.setCurrencyCode("AUD");
paymentDetails.setInvoiceDescription("Individual Invoice Description");
paymentDetails.setInvoiceNumber("Inv 21540");
paymentDetails.setInvoiceReference("513456");
transaction.setPaymentDetails(paymentDetails);

transaction.setPartnerID("ID");
transaction.setCapture(true);
transaction.setDeviceID("D1234");
transaction.setTransactionType(TransactionType.Purchase);

CreateTransactionResponse response = client.create(PaymentMethod.Direct, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

DirectPaymentRequest transaction = new DirectPaymentRequest()
{
    Customer = new DirectTokenCustomer()
    {
        TokenCustomerID = 321321321, 
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org",
        CardDetails = new CardDetails()
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "11",
            ExpiryYear = "25",
            StartMonth = "01",
            StartYear = "13",
            IssueNumber = "01",
            CVN = "123"
        }
    },
    ShippingAddress = new ShippingAddress()
    {
        FirstName = "John",
        LastName = "Smith",
        Phone = "09 889 0986",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Mobile = "09 889 6542",
        Email = "demo@example.org",
        ShippingMethod = "NextDay"
    },
    Items = new[]
    {
        new LineItem()
        {
            SKU = "12345678901234567890",
            Description = "Item Description 1",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        },
        new LineItem()
        {
            SKU = "123456789012",
            Description = "Item Description 2",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        }
    }.ToList(),
    Options = new List<Option>
    {
        new Option{ Value = "Option1" },
        new Option{ Value = "Option2" }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000,
        InvoiceNumber = "Inv 21540",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceReference = "513456",
        CurrencyCode = "AUD"
    },
    RedirectUrl = "http://www.eway.com.au",
    DeviceID = "D1234",
    PartnerID = "ID",
    CustomerIP = "127.0.0.1",
    TransactionType = TransactionTypes.Purchase
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.DIRECT, {
    "Customer": {
       "Reference": "A12345",
       "Title": "Mr.",
       "FirstName": "John",
       "LastName": "Smith",
       "CompanyName": "Demo Shop 123",
       "JobDescription": "Developer",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "PostalCode": "2000",
       "Country": "au",
       "Phone": "09 889 0986",
       "Mobile": "09 889 6542",
       "Email": "demo@example.org",
       "Url": "http://www.ewaypayments.com",
        "CardDetails": {
         "Name": "John Smith",
         "Number": "4444333322221111",
         "ExpiryMonth": "12",
         "ExpiryYear": "25",
         "StartMonth" : "01",
         "StartYear" : "13",
         "IssueNumber": "01",
         "CVN": "123"
       }
    },
    "ShippingAddress": {
       "ShippingMethod": "NextDay",
       "FirstName": "John",
       "LastName": "Smith",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "Country": "au",
       "PostalCode": "2000",
       "Phone": "09 889 0986"
    },
    "Items": [
     {
       "SKU": "12345678901234567890",
       "Description": "Item Description 1",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     },
     {
       "SKU": "123456789012",
       "Description": "Item Description 2",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     }
    ],
    "Options": [
     {
       "Value": "Option1"
     },
     {
       "Value": "Option2"
     }
    ],
    "Payment": {
       "TotalAmount": 1000,
       "InvoiceNumber": "Inv 21540",
       "InvoiceDescription": "Individual Invoice Description",
       "InvoiceReference": "513456",
       "CurrencyCode": "AUD"
    },
    "DeviceID": "D1234",
    "CustomerIP": "127.0.0.1",
    "PartnerID": "ID",
    "TransactionType": "Purchase",
    "Capture": true
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

customer = EwayRapid::Models::Customer.new
customer.reference = 'A12345'
customer.title = 'Mr.'
customer.first_name = 'John'
customer.last_name = 'Smith'
customer.company_name = 'Company'
customer.job_description = 'Ruby Developer'
customer.phone = '09 889 0986'
customer.mobile = '09 889 0986'
customer.fax = '09 654 1234'
customer.url = 'http://www.ewaypayments.com'
customer.comments = 'customer comment'
customer.customer_device_ip = '127.0.0.1'
customer.email = 'demo@example.org'

card_details = EwayRapid::Models::CardDetails.new
card_details.name = 'John Smith'
card_details.number = '4444333322221111'
card_details.expiry_month = '05'
card_details.expiry_year = '25'
card_details.cvn = '123'
customer.card_details = card_details

address = EwayRapid::Models::Address.new
address.street1 = 'Level 5'
address.street2 = '369 Queen Street'
address.city = 'Sydney'
address.state = 'NSW'
address.country = 'AU'
address.postal_code = '2000'
customer.address = address

transaction.customer = customer

shipping_details = EwayRapid::Models::ShippingDetails.new
shipping_address = EwayRapid::Models::Address.new
shipping_address.street1 = 'Level 5'
shipping_address.street2 = '369 Queen Street'
shipping_address.city = 'Sydney'
shipping_address.state = 'NSW'
shipping_address.country = 'AU'
shipping_address.postal_code = '2000'
shipping_details.shipping_address = shipping_address
shipping_details.first_name = 'John'
shipping_details.last_name = 'Smith'
shipping_details.phone = '09 889 0986'
shipping_details.shipping_method = EwayRapid::Enums::ShippingMethod::LOW_COST
transaction.shipping_details = shipping_details

line_item = EwayRapid::Models::LineItem.new
line_item.sku = '12345678901234567890'
line_item.description = 'Item Description 1'
line_item.quantity = 1
line_item.unit_cost = 400
line_item.tax = 100
line_item.total = 500

line_item1 = EwayRapid::Models::LineItem.new
line_item1.sku = '12345678901234567890'
line_item1.description = 'Item Description 1'
line_item1.quantity = 1
line_item1.unit_cost = 400
line_item1.tax = 100
line_item1.total = 500

line_item2 = EwayRapid::Models::LineItem.new
line_item2.sku = '123456789012'
line_item2.description = 'Item Description 2'
line_item2.quantity = 1
line_item2.unit_cost = 400
line_item2.tax = 100
line_item2.total = 500

line_items = []
line_items.push(line_item1)
line_items.push(line_item2)
transaction.line_items = line_items

options = []
options.push('Option1')
options.push('Option2')
transaction.options = options

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
payment_details.invoice_number = 'Inv 21540'
payment_details.invoice_description = 'Individual Invoice Description'
payment_details.invoice_reference = '513456'
payment_details.currency_code = 'AUD'
transaction.payment_details = payment_details

transaction.device_id = 'D1234'
transaction.partner_id = 'ID'
transaction.capture = true
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)
Field Name Field Type Max Length Data Type Description
CustomerIP* O 50 string The customer's IP address
Method R 20 string The action to perform with this request. See Methods for more information.
One of: ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R 20 enum The type of transaction you're performing (see Transaction Types).
One of: Purchase, MOTO, Recurring
DeviceID O 50 string The identification name/number for the device or application used to process the transaction
PartnerID C 50 string The Partner ID generated from an Eway partner agreement
If you have been approved for Direct Connection with Eway, your PartnerID can be used to whitelist your API calls for PCI-DSS compliance
ThirdPartyWalletID O 50 string This field has been deprecated, please use SecuredCardData instead
SecuredCardData O 500 string A unique token used in place of the card details. Used by Secure Fields and Click to Pay
Capture O 6 boolean Rapid SDK Libraries Only Set to true to capture funds immediately (default), set to false to perform an authorisation and only hold funds.

Field types: R – Required, O – Optional

*When this field is present along with the Customer Country field, any transaction will be processed using Fraud Lite

Payment

This set of fields contains the details of the payment being processed. This section is required when the Method field is set to ProcessPayment or TokenPayment.

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
The value of this field must be 0 for the CreateTokenCustomer and UpdateTokenCustomer methods
InvoiceNumber O 64 string Your invoice number for this transaction
InvoiceDescription O 64 string A description of the purchase that the customer is making
InvoiceReference O 50 string Your reference number for this transaction
CurrencyCode O 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.g. Australian Dollars = AUD

Field types: R – Required, C – Conditionally Required, O – Optional

Customer

This set of fields contains the details of your customer. These are used when creating and updating Token customers.

Field Name Field Type Max Length Data Type Description
TokenCustomerID C 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Required for UpdateTokenCustomer method
Reference O 50 string Your for this customer
Title O 5 string The customer's title, empty string allowed
One of: Mr., Ms., Mrs., Miss, Dr., Sir., Prof.
FirstName C 50 string The customer's first name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
LastName C 50 string The customer's last name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
CompanyName O 50 string The customer's company name
JobDescription O 50 string The customer's job description / title
Street1 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
Street2 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
City O 50 string The customer's city / town / suburb
Providing this information helps with the 3D Secure 2.0 verification
State O 50 string The customer's state / county
Providing this information helps with the 3D Secure 2.0 verification
PostalCode C 30 string The customer's post / zip code
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Country C 2 string The customer's country. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Email C 50 string The customer's email address, which must be correctly formatted if present
Required when using 3D Secure 2.0
Phone C 32 string The customer's phone number
Required when using 3D Secure 2.0
Mobile O 32 string The customer's mobile phone number
Comments O 255 string Any comments you wish to add about the customer
Fax O 32 string The customer's fax number
Url O 512 string The customer's website, which must be correctly formatted if present

Field Types: O – Optional, C – Conditionally Required

When creating a new Token customer, the FirstName, LastName and Country are required

When the Country field is present, along with the Customer's IP address, any transaction will be processed using Fraud Lite

Card Details

The card details section is within the Customer section and is used to pass the customer's card details for the transaction. The Card Details are not required when passing SecuredCardData

Field Name Field Type Max Length Data Type Description
Name C 50 string The name of the card holder
Number C 50 int The card number that is to be processed for this transaction.
Not required when processing using an existing Token ID with TokenPayment method. This should be the encrypted value if using Client Side Encryption
ExpiryMonth C 2 int The month that the card expires.
Not required when processing using an existing Token ID with TokenPayment method
ExpiryYear C 2 int The year that the card expires.
Not required when processing using an existing Token ID with TokenPayment method
StartMonth* O 2 int The month that the card is valid from
StartYear* O 2 int The year that the card is valid from
IssueNumber* O 2 int The card's issue number
CVN C 4 int The Card Verification Number. This should be the encrypted value if using Client Side Encryption.
Required if the TransactionType is Purchase*

Field Types: R – Required, O – Optional, C – Conditionally Required

*Applies to UK only

Shipping Address

The ShippingAddress section is optional. It is used by Fraud Essentials and Fraud Ultimate to assist with the analysis of the transaction.

Field Name Field Type Max Length Data Type Description
ShippingMethod O 30 string The method used to ship the customer's order
One of: Unknown, LowCost, DesignatedByCustomer, International, Military, NextDay, StorePickup, TwoDayService, ThreeDayService, Other
FirstName O 50 string The first name of the person the order is shipped to
LastName O 50 string last name of the person the order is shipped to
Street1 O 50 string The street address the order is shipped to
Street2 O 50 string The street address of the shipping location
City O 50 string The city / suburb of the shipping location
State O 50 string The state / county of the shipping location
PostalCode O 30 string The post / zip code of the shipping location
Country C 2 string The country of the shipping location. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
Email O 50 string The email address of the person the order is shipped to, which must be correctly formatted if present.
Phone O 32 string The phone number of the person the order is shipped to
Fax O 32 string The fax number of the shipping location

Items

The Items section is optional. If provided, it should contain a list of line items purchased by the customer, up to a maximum of 99 items. It is used by Fraud Essentials and Fraud Ultimate as part of the risk analysis of the transaction.
LineItems have the following fields:

Field Name Field Type Max Length Data Type Description
SKU O 12 string The stock keeping unit used to identify this line item
Description O 26 string A brief description of the product
Quantity O 6 int The purchased quantity
UnitCost O 8 int The pre-tax cost per unit of the product in the lowest denomination
Tax O 8 int The tax amount that applies to this line item in the lowest denomination
Total O 8 int The total amount charged for this line item in the lowest denomination

PaymentInstrument

The PaymentInstrument section is conditionally required. This set of fields contains the payment instrument details for the transaction.

SDKs don't support PaymentInstrument currently.

PaymentInstrument

Field Name Field Type Max Length Data Type Description
PaymentType C string Identifies the payment method being used for the payment.
eg. CreditCard or ApplePay
WalletDetails C N/A object The object containing the details of the Digital Wallet
ThreeDSecureAuth O N/A object Added for the third-party when it has pass-through 3D Secure, then gets the authentication result.

Field types: R – Required, C - Conditionally Required, O – Optional

WalletDetails

Field Name Field Type Max Length Data Type Description
Id C string The unique ID for the digital wallet
Token C N/A string The unique token representing the card details received from the digital wallet.

ThreeD Secure Auth

This section is for passing the 3D Secure verification results received from Eway's 3D Secure MPI.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0

Options

This section is optional. Anything appearing in this section is not displayed to the customer. Up to 99 options can be defined. Each option has just one field:

Field Name Field Type Max Length Data Type Description
Value O 254 string This field is not displayed to the customer. Anything can be used here, which can be useful for tracking transactions.
Additional characters are truncated at 254

Response

Example Response


{
    "AuthorisationCode": "843121",
    "ResponseCode": "00",
    "ResponseMessage": "A2000",
    "TransactionID": 30508437,
    "TransactionStatus": true,
    "TransactionType": "Purchase",
    "BeagleScore": null,
    "Verification": {
        "CVN": 0,
        "Address": 0,
        "Email": 0,
        "Mobile": 0,
        "Phone": 0
    },
    "Customer": {
        "CardDetails": {
            "CardType": "VI",
            "Number": "444433XXXXXX1111",
            "Name": "John Smith",
            "ExpiryMonth": "12",
            "ExpiryYear": "25",
            "StartMonth": null,
            "StartYear": null,
            "IssueNumber": null
        },
        "TokenCustomerID": null,
        "Reference": "A12345",
        "Title": "Mr.",
        "FirstName": "John",
        "LastName": "Smith",
        "CompanyName": "Demo Shop 123",
        "JobDescription": "Developer",
        "Street1": "Level 5",
        "Street2": "369 Queen Street",
        "City": "Sydney",
        "State": "NSW",
        "PostalCode": "2000",
        "Country": "au",
        "Email": "demo@example.org",
        "Phone": "09 889 0986",
        "Mobile": "09 889 6542",
        "Comments": "",
        "Fax": "",
        "Url": "http://www.ewaypayments.com"
    },
    "Payment": {
        "TotalAmount": 1000,
        "InvoiceNumber": "Inv 21540",
        "InvoiceDescription": "Individual Invoice Description",
        "InvoiceReference": "513456",
        "CurrencyCode": "AUD",
        "TransactionType": null
    },
    "PaymentInstrument": {
        "ThreeDSecureAuth": {
            "Cryptogram": null,
            "ECI": null,
            "XID": null,
            "AuthStatus": null,
            "Version": null,
            "dsTransactionId": null
        },
        "PaymentType": "CreditCard"
    },
    "Errors": null
}
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <DirectPaymentResponse xmlns="https://api.ewaypayments.com/">
         <DirectPaymentResult>
            <AuthorisationCode>592654</AuthorisationCode>
            <ResponseCode>00</ResponseCode>
            <ResponseMessage>A2000</ResponseMessage>
            <TransactionID>11259550</TransactionID>
            <TransactionStatus>true</TransactionStatus>
            <TransactionType>Purchase</TransactionType>
            <BeagleScore>0</BeagleScore>
            <Verification>
               <CVN>Unchecked</CVN>
               <Address>Unchecked</Address>
               <Email>Unchecked</Email>
               <Mobile>Unchecked</Mobile>
               <Phone>Unchecked</Phone>
            </Verification>
            <Customer>
               <TokenCustomerID xsi:nil="true"/>
               <Reference>A12345</Reference>
               <Title>Mr.</Title>
               <FirstName>John</FirstName>
               <LastName>Smith</LastName>
               <CompanyName>Demo Shop 123</CompanyName>
               <JobDescription>Developer</JobDescription>
               <Street1>Level 5</Street1>
               <Street2>369 Queen Street</Street2>
               <City>Sydney</City>
               <State>NSW</State>
               <PostalCode>2000</PostalCode>
               <Country>au</Country>
               <Email>demo@example.org</Email>
               <Phone>0289712345</Phone>
               <Mobile>0289712345</Mobile>
               <Comments>Customer comments</Comments>
               <Fax>0289712345</Fax>
               <Url>http://www.ewaypayments.com</Url>
               <CardDetails>
                  <Number>444433XXXXXX1111</Number>
                  <Name>John Smith</Name>
                  <ExpiryMonth>12</ExpiryMonth>
                  <ExpiryYear>25</ExpiryYear>
               </CardDetails>
            </Customer>
            <Payment>
               <TotalAmount>1000</TotalAmount>
               <InvoiceNumber>Inv 21540</InvoiceNumber>
               <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
               <InvoiceReference>Individual Invoice Description</InvoiceReference>
               <CurrencyCode>AUD</CurrencyCode>
            </Payment>
         </DirectPaymentResult>
      </DirectPaymentResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available $response properties

if ($response->TransactionStatus) {
    echo 'Payment successful! ID: '.$response->TransactionID;
} else {
    if ($response->getErrors()) {
        foreach ($response->getErrors() as $error) {
            echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
        }
    } else {
        echo 'Sorry, your payment was declined';
    }
}

// See the JSON tab for all the available response properties

if (response.getTransactionStatus().isStatus()) {
    System.out.println("Payment successful! ID: " + response.getTransactionStatus().getTransactionID());
} else {
    String[] errorcodes = response.getTransactionStatus().getProcessingDetails().getResponseMessage().split(",");
    for (String errorcode: errorcodes) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode.trim(), "en"));
    }
}
// See the JSON tab for all the available response properties

IRapidClient rapidClient = new RapidClient(httpClient);
if (response.Errors != null)
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
else
{
    if ((bool)response.TransactionStatus)
    {
        Console.WriteLine("Payment successful! ID: " + response.TransactionID);
    }
}
// See the JSON tab for all the available response properties

.then(function (response) {
    if (response.get('TransactionStatus')) {
        console.log('Payment successful! ID: ' + response.get('TransactionID'));
    } else {
        var errorCodes = response.get('ResponseMessage').split(', ');
        errorCodes.forEach(function(errorCode) {
            console.log("Response Message: " + rapid.getMessage(errorCode, "en"));
        });
    }
})
.catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available response properties

if response.errors.empty?
  if response.transaction_status.status?
    puts "Payment successful! ID: #{response.transaction_status.transaction_id.to_s}"
  else
    puts "Failed! Message #{response.transaction_status.processing_details.response_message}"
  end
else
  response.errors.each { |e| puts "Response message: " + EwayRapid::RapidClient.user_display_message(e) }
end

The response from Eway will contain all relevant details such as the bank authorisation code and a unique number that identifies the transaction in Eway's database (TransactionID).

If a Token customer was involved, the ID that Eway uses to identify that customer will also be returned.

All responses will contain a Response Code and Response Message that represents the result of the action performed.

If applicable, the response will also contain information about the payment that has been processed, as well as the results of any Fraud risk analysis that was performed.

Response Fields Descriptions

Field Name Max Length Data Type Description
AuthorisationCode 6 string The authorisation code for this transaction returned from the bank
ResponseCode 2 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result of the action performed
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
TransactionStatus 5 boolean A Boolean value that indicates whether the transaction was successful or not
TransactionType 9 enum The transaction type that this transaction was processed as.
One of: Purchase, MOTO, or Recurring
BeagleScore 6 string A Fraud Lite score representing the estimated probability that the order is fraudulent. A value between 0.01 and 100.00 representing the likelihood that the transaction is fradulent, wih 0.01 being the lowest and 100.00 being the highest.
In the Sandbox environment the score will always be returned as -1 unless you have configured your Sandbox to fail for Risk Score, in which case the value will be 101.
This field is only returned when using Fraud Lite
Verification N/A object This set of fields is currently unused
Customer N/A object This set of fields contains the details of the customer making the payment
Payment N/A object This set of fields contains the details of the payment
PaymentInstrument N/A object This set of fields contains the details of the payment instrument used for the transaction
Errors 512 string A comma separated list of any errors encountered

Verification

These fields are not currently used.

Field Name Max Length Data Type Description
CVN 10 string Not currently used
Address 10 string Not currently used
Email 10 string Not currently used
Mobile 10 string Not currently used
Phone 10 string Not currently used

Customer

Field Name Max Length Data Type Description
CardDetails N/A object This set of fields contains the details of the card used for the payment
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

Card Details

The card details section is within the Customer section

Field Name Max Length Data Type Description
CardType 2 string The type of card used to process the payment.
  • ALL - all cards
  • VI - Visa
  • MC - Mastercard
  • AX - AMEX
  • DC - Diners Club
  • JC - JCB
  • MD - Maestro UK
  • MI - Maestro International
  • SO - Solo
  • LA - Laser
  • DS - Discover
Number 50 int A masked echo of the card number
Name 50 string An echo of the name of the card holder
ExpiryMonth 2 int An echo of the month that the card expires
ExpiryYear 2 int An echo of the year that the card expires
StartMonth* 2 int An echo of the month that the card is valid from
StartYear* 2 int An echo of the year that the card is valid from
IssueNumber* int An echo of the card's issue number

*Applies to UK only

Payment

This set of fields contains the details of the payment that was processed.

Field Name Max Length Data Type Description
TotalAmount 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
InvoiceNumber 64 string An echo of your invoice number for this transaction
InvoiceDescription 64 string An echo of the purchase that the customer is making
InvoiceReference 50 string An echo of your reference number for this transaction
CurrencyCode 3 string The ISO 4217 3 character code that represents the currency that this transaction was processed in.
TransactionType 9 string Currently unused. Refer to the TransactionType returned under the Transaction response.

PaymentInstrument

This set of fields contains the details of the payment instrument used for the transaction.

Field Name Max Length Data Type Description
ThreeDSecureAuth N/A object This set of fields contains the 3D Secure verification results
PaymentType 10 string The payment method used for the transaction.
eg. CreditCard or ApplePay

ThreeDSecureAuth

This set of fields contains the 3D Secure verification results.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator.
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0.
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0.

Transparent Redirect

If you want to keep the customer on your website as well as reduce your scope of PCI DSS compliance by keeping the card data off your server, then Transparent Redirect is the way to go.

Since the payment form is hosted on your site, it is important that an SSL is used to secure the page and provide reassurance to customers.

Implementing Transparent Redirect is a three step process:

  1. Pass the customer and transaction details to Eway to generate an AccessCode.
  2. Display a payment form on your site using the AccessCode and FormActionURL returned by the API in Step 1 - this form is submitted directly from the customer's brower to Eway. After processing the transaction, the customer is redirected (transparently!) straight back to your nominated RedirectURL.
  3. Once the transaction has been processed, request the results from Eway using the AccessCode.

Step 1: Create an AccessCode

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/AccessCodes
HTTP POST (XML) https://api.ewaypayments.com/CreateAccessCode.xml
HTTP POST (JSON) https://api.ewaypayments.com/CreateAccessCode.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/AccessCodes
HTTP POST (XML) https://api.sandbox.ewaypayments.com/CreateAccessCode.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/CreateAccessCode.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Basic Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Payment": {
           "TotalAmount": 100
        },
        "RedirectUrl": "http://www.eway.com.au",
        "Method": "ProcessPayment",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/AccessCodes
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <CreateAccessCode xmlns="https://api.ewaypayments.com/">
            <request>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <RedirectUrl>http://www.eway.com.au</RedirectUrl>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
            </request>
        </CreateAccessCode>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Payment' => [
        'TotalAmount' => 1000,
    ],
    'RedirectUrl' => 'http://www.eway.com.au',
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::TRANSPARENT_REDIRECT, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

transaction.setPaymentDetails(paymentDetails);
transaction.setRedirectURL("http://www.eway.com.au");
transaction.setTransactionType(TransactionType.Purchase);

CreateTransactionResponse response = client.create(PaymentMethod.TransparentRedirect, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CreateTransparentRedirectRequest transaction = new CreateTransparentRedirectRequest()
{
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    RedirectUrl = "http://www.eway.com.au",
    CancelUrl = "http://www.eway.com.au",
    TransactionType = TransactionTypes.Purchase
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.TRANSPARENT_REDIRECT, {
    "Payment": {
       "TotalAmount": 100
    },
    "RedirectUrl": "http://www.eway.com.au",
    "TransactionType": "Purchase"
}).then(function (response) {

});

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new
payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details
transaction.redirect_url = 'http://www.eway.com.au'
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::TRANSPARENT_REDIRECT, transaction)

Complete Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "Reference": "A12345",
           "Title": "Mr.",
           "FirstName": "John",
           "LastName": "Smith",
           "CompanyName": "Demo Shop 123",
           "JobDescription": "Developer",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "PostalCode": "2000",
           "Country": "au",
           "Email": "demo@example.org",
           "Phone": "09 889 0986",
           "Mobile": "09 889 6542",
           "Comments": "this is a comment",
           "Fax": "09 889 0986",
           "Url": "http://www.ewaypayments.com"
        },
        "ShippingAddress": {
           "ShippingMethod": "NextDay",
           "FirstName": "John",
           "LastName": "Smith",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "Country": "au",
           "PostalCode": "2000",
           "Phone": "09 889 0986"
        },
        "Items": [
         {
           "SKU": "12345678901234567890",
           "Description": "Item Description 1",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         },
         {
           "SKU": "123456789012",
           "Description": "Item Description 2",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         }
        ],
        "Options": [
         {
           "Value": "Option1"
         },
         {
           "Value": "Option2"
         }
        ],
        "Payment": {
           "TotalAmount": 1000,
           "InvoiceNumber": "Inv 21540",
           "InvoiceDescription": "Individual Invoice Description",
           "InvoiceReference": "513456",
           "CurrencyCode": "AUD"
        },
        "RedirectUrl": "http://www.eway.com.au",
        "Method": "ProcessPayment",
        "DeviceID": "D1234",
        "CustomerIP": "127.0.0.1",
        "PartnerID": "ID",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/AccessCodes
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <CreateAccessCode xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <Reference>A12345</Reference>
                    <Title>Mr.</Title>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <CompanyName>Demo Shop 123</CompanyName>
                    <JobDescription>Developer</JobDescription>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Mobile>0289712345</Mobile>
                    <Comments>Customer comments</Comments>
                    <Fax>0289712345</Fax>
                    <Url>http://www.ewaypayments.com</Url>
                </Customer>
                <ShippingAddress>
                    <ShippingMethod>NextDay</ShippingMethod>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Fax>0289712345</Fax>
                </ShippingAddress>
                <Items>
                    <LineItem>
                        <SKU>12345678901234567890</SKU>
                        <Description>Item Description 1</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                    <LineItem>
                        <SKU>123456789012</SKU>
                        <Description>Item Description 2</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                </Items>
                <Options>
                    <Option>
                        <Value>Option1</Value>
                    </Option>
                    <Option>
                        <Value>Option2</Value>
                    </Option>
                </Options>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                    <InvoiceNumber>Inv 21540</InvoiceNumber>
                    <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
                    <InvoiceReference>Individual Invoice Description</InvoiceReference>
                    <CurrencyCode>AUD</CurrencyCode>
                </Payment>
                <RedirectUrl>http://www.eway.com.au</RedirectUrl>
                <CustomerIP>127.0.0.1</CustomerIP>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
                <DeviceID>D1234</DeviceID>
            </request>
        </CreateAccessCode>
    </soap:Body>
</soap:Envelope>

<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Customer' => [
        'Reference' => 'A12345',
        'Title' => 'Mr.',
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'CompanyName' => 'Demo Shop 123',
        'JobDescription' => 'PHP Developer',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'PostalCode' => '2000',
        'Country' => 'au',
        'Phone' => '09 889 0986',
        'Mobile' => '09 889 6542',
        'Email' => 'demo@example.org',
        "Url" => "http://www.ewaypayments.com",
    ],
    'ShippingAddress' => [
        'ShippingMethod' => \Eway\Rapid\Enum\ShippingMethod::NEXT_DAY,
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'Country' => 'au',
        'PostalCode' => '2000',
        'Phone' => '09 889 0986',
    ],
    'Items' => [
        [
            'SKU' => '12345678901234567890',
            'Description' => 'Item Description 1',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
            // Total is calculated automatically
        ],
        [
            'SKU' => '123456789012',
            'Description' => 'Item Description 2',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
        ],
    ],
    'Options' => [
        [
            'Value' => 'Option1',
        ],
        [
            'Value' => 'Option2',
        ],
    ],
    'Payment' => [
        'TotalAmount' => 1000,
        'InvoiceNumber' => 'Inv 21540',
        'InvoiceDescription' => 'Individual Invoice Description',
        'InvoiceReference' => '513456',
        'CurrencyCode' => 'AUD',
    ],
    'RedirectUrl' => 'http://www.eway.com.au',
    'DeviceID' => 'D1234',
    'CustomerIP' => '127.0.0.1',
    'PartnerID' => 'ID',
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'Capture' => true,
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::TRANSPARENT_REDIRECT, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

Customer customer = new Customer();
customer.setReference("A12345");
customer.setTitle("Mr.");
customer.setFirstName("John");
customer.setLastName("Smith");
customer.setCompanyName("eWay");
customer.setJobDescription("Java Developer");
customer.setPhone("09 889 0986");
customer.setMobile("09 889 6542");
customer.setUrl("http://ewaypayments.com");
customer.setCustomerDeviceIP("127.0.0.1");
customer.setEmail("demo@example.org");

Address address = new Address();
address.setStreet1("Level 5");
address.setStreet2("369 Queen Street");
address.setCity("Sydney");
address.setState("NSW");
address.setCountry("au");
address.setPostalCode("2000");
customer.setAddress(address);
transaction.setCustomer(customer);

ShippingDetails shippingDetail = new ShippingDetails();
shippingDetail.setFirstName("John");
shippingDetail.setLastName("Smith");
shippingDetail.setPhone("09 889 0986");
shippingDetail.setShippingMethod(ShippingMethod.LowCost);

Address shipAddress = new Address();
shipAddress.setStreet1("Level 5");
shipAddress.setStreet2("369 Queen Street");
shipAddress.setCity("Sydney");
shipAddress.setState("NSW");
shipAddress.setCountry("au");
shipAddress.setPostalCode("2000");
shippingDetail.setShippingAddress(shipAddress);
transaction.setShippingDetails(shippingDetail);

List<LineItem> items = new ArrayList<>();
LineItem item1 = new LineItem();
item1.setSku("12345678901234567890");
item1.setDescription("Item Description 1");
item1.setQuantity(1);
item1.setUnitCost(400);
item1.setTotalTax(100);
item1.setTotal(500);
items.add(item1);

LineItem item2 = new LineItem();
item2.setSku("123456789012");
item2.setDescription("Item Description 2");
item2.setQuantity(1);
item2.setUnitCost(400);
item2.setTotalTax(100);
item2.setTotal(500);
items.add(item2);

transaction.setLineItems(items);

List<String> options = new ArrayList<>();
options.add("Option1");
options.add("Option2");
transaction.setOptions(options);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);
paymentDetails.setCurrencyCode("AUD");
paymentDetails.setInvoiceDescription("Individual Invoice Description");
paymentDetails.setInvoiceNumber("Inv 21540");
paymentDetails.setInvoiceReference("513456");
transaction.setPaymentDetails(paymentDetails);

transaction.setPartnerID("ID");
transaction.setCapture(true);
transaction.setRedirectURL("http://www.eway.com.au");
transaction.setDeviceID("D1234");
transaction.setTransactionType(TransactionType.Purchase);
transaction.setSaveCustomer(false);

CreateTransactionResponse response = client.create(PaymentMethod.TransparentRedirect, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CreateTransparentRedirectRequest transaction = new CreateTransparentRedirectRequest()
{
    Customer = new Customer()
    {
        TokenCustomerID = 321321321, 
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org"
    },
    ShippingAddress = new ShippingAddress()
    {
        FirstName = "John",
        LastName = "Smith",
        Phone = "09 889 0986",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Mobile = "09 889 6542",
        Email = "demo@example.org",
        ShippingMethod = "NextDay"
    },
    Items = new[]
    {
        new LineItem()
        {
            SKU = "12345678901234567890",
            Description = "Item Description 1",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        },
        new LineItem()
        {
            SKU = "123456789012",
            Description = "Item Description 2",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        }
    }.ToList(),
    Options = new List<Option>
    {
        new Option{ Value = "Option1" },
        new Option{ Value = "Option2" }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000,
        InvoiceNumber = "Inv 21540",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceReference = "513456",
        CurrencyCode = "AUD"
    },
    RedirectUrl = "http://www.eway.com.au",
    CancelUrl = "http://www.eway.com.au",
    DeviceID = "D1234",
    PartnerID = "ID",
    CustomerIP = "127.0.0.1",
    TransactionType = TransactionTypes.Purchase,
    Capture = true,
    SaveCustomer = false
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.TRANSPARENT_REDIRECT,{
    "Customer": {
       "Reference": "A12345",
       "Title": "Mr.",
       "FirstName": "John",
       "LastName": "Smith",
       "CompanyName": "Demo Shop 123",
       "JobDescription": "Developer",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "PostalCode": "2000",
       "Country": "au",
       "Phone": "09 889 0986",
       "Mobile": "09 889 6542",
       "Email": "demo@example.org",
       "Url": "http://www.ewaypayments.com"
    },
    "ShippingAddress": {
       "ShippingMethod": "NextDay",
       "FirstName": "John",
       "LastName": "Smith",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "Country": "au",
       "PostalCode": "2000",
       "Phone": "09 889 0986"
    },
    "Items": [
     {
       "SKU": "12345678901234567890",
       "Description": "Item Description 1",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     },
     {
       "SKU": "123456789012",
       "Description": "Item Description 2",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     }
    ],
    "Options": [
     {
       "Value": "Option1"
     },
     {
       "Value": "Option2"
     }
    ],
    "Payment": {
       "TotalAmount": 1000,
       "InvoiceNumber": "Inv 21540",
       "InvoiceDescription": "Individual Invoice Description",
       "InvoiceReference": "513456",
       "CurrencyCode": "AUD"
    },
    "RedirectUrl": "http://www.eway.com.au",
    "DeviceID": "D1234",
    "CustomerIP": "127.0.0.1",
    "PartnerID": "ID",
    "TransactionType": "Purchase",
    "Capture": true
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

customer = EwayRapid::Models::Customer.new
customer.reference = 'A12345'
customer.title = 'Mr.'
customer.first_name = 'John'
customer.last_name = 'Smith'
customer.company_name = 'Company'
customer.job_description = 'Ruby Developer'
customer.phone = '09 889 0986'
customer.mobile = '09 889 0986'
customer.fax = '09 654 1234'
customer.url = 'http://www.ewaypayments.com'
customer.comments = 'customer comment'
customer.customer_device_ip = '127.0.0.1'
customer.email = 'demo@example.org'

address = EwayRapid::Models::Address.new
address.street1 = 'Level 5'
address.street2 = '369 Queen Street'
address.city = 'Sydney'
address.state = 'NSW'
address.country = 'AU'
address.postal_code = '2000'
customer.address = address

transaction.customer = customer

shipping_details = EwayRapid::Models::ShippingDetails.new
shipping_address = EwayRapid::Models::Address.new
shipping_address.street1 = 'Level 5'
shipping_address.street2 = '369 Queen Street'
shipping_address.city = 'Sydney'
shipping_address.state = 'NSW'
shipping_address.country = 'AU'
shipping_address.postal_code = '2000'
shipping_details.shipping_address = shipping_address
shipping_details.first_name = 'John'
shipping_details.last_name = 'Smith'
shipping_details.phone = '09 889 0986'
shipping_details.shipping_method = EwayRapid::Enums::ShippingMethod::LOW_COST
transaction.shipping_details = shipping_details

line_item = EwayRapid::Models::LineItem.new
line_item.sku = '12345678901234567890'
line_item.description = 'Item Description 1'
line_item.quantity = 1
line_item.unit_cost = 400
line_item.tax = 100
line_item.total = 500

line_item1 = EwayRapid::Models::LineItem.new
line_item1.sku = '12345678901234567890'
line_item1.description = 'Item Description 1'
line_item1.quantity = 1
line_item1.unit_cost = 400
line_item1.tax = 100
line_item1.total = 500

line_item2 = EwayRapid::Models::LineItem.new
line_item2.sku = '123456789012'
line_item2.description = 'Item Description 2'
line_item2.quantity = 1
line_item2.unit_cost = 400
line_item2.tax = 100
line_item2.total = 500

line_items = []
line_items.push(line_item1)
line_items.push(line_item2)
transaction.line_items = line_items

options = []
options.push('Option1')
options.push('Option2')
transaction.options = options

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
payment_details.invoice_number = 'Inv 21540'
payment_details.invoice_description = 'Individual Invoice Description'
payment_details.invoice_reference = '513456'
payment_details.currency_code = 'AUD'
transaction.payment_details = payment_details

transaction.redirect_url = 'http://www.eway.com.au'
transaction.device_id = 'D1234'
transaction.partner_id = 'ID'
transaction.capture = true
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::TRANSPARENT_REDIRECT, transaction)

To request an AccessCode, make a server-side call to the CreateAccessCode endpoint of the API. The API will respond with an AccessCode, a FormActionURL and the customer data.

If the request involves an existing Token customer, their details will be returned in the response including the masked credit card number.

If Token Payments are not in use for this transaction, the returned customer data will be an echo of the data in the request.

Field Name Field Type Max Length Data Type Description
RedirectUrl R 512 string The web address the customer is redirected to after the card details has been submitted.
Note that the AccessCode is appended as a query string parameter to the RedirectUrl – existing query string parameters are preserved.
CustomerIP O 50 string The customer's IP address.
When this field is present along with the Country field, any transaction will be processed using Fraud Lite
Method R 20 string The action to perform with this request. See Methods for more information.
One of: ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R Int enum The type of transaction you're performing (see Transaction Types). Values: Purchase, MOTO, Recurring
DeviceID O 50 string The identification name/number for the device or application used to process the transaction.
PartnerID O 50 string The partner ID generated from an Eway partner agreement.
Capture O 6 boolean Rapid SDK Libraries Only Set to true to capture funds immediately (default), set to false to perform an authorisation and only hold funds.
SaveCustomer O 6 boolean Rapid SDK Libraries Only Set to true to create a token customer when the transaction is complete

Field types: R – Required, O – Optional

Customer

This set of fields contains the details of the customer.

Field Name Field Type Max Length Data Type Description
TokenCustomerID C 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Required for UpdateTokenCustomer method
Reference O 50 string Your for this customer
Title O 5 string The customer's title, empty string allowed
One of: Mr., Ms., Mrs., Miss, Dr., Sir., Prof.
FirstName C 50 string The customer's first name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
LastName C 50 string The customer's last name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
CompanyName O 50 string The customer's company name
JobDescription O 50 string The customer's job description / title
Street1 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
Street2 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
City O 50 string The customer's city / town / suburb
Providing this information helps with the 3D Secure 2.0 verification
State O 50 string The customer's state / county
Providing this information helps with the 3D Secure 2.0 verification
PostalCode C 30 string The customer's post / zip code
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Country C 2 string The customer's country. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Email C 50 string The customer's email address, which must be correctly formatted if present
Required when using 3D Secure 2.0
Phone C 32 string The customer's phone number
Required when using 3D Secure 2.0
Mobile O 32 string The customer's mobile phone number
Comments O 255 string Any comments you wish to add about the customer
Fax O 32 string The customer's fax number
Url O 512 string The customer's website, which must be correctly formatted if present

Field Types: O – Optional, C – Conditionally Required

When creating a new Token customer, the FirstName, LastName and Country are required

When the Country field is present, along with the Customer's IP address, any transaction will be processed using Fraud Lite

Payment

This set of fields contains the details of the payment being processed. This section is required when the Method field is set to ProcessPayment or TokenPayment.

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
The value of this field must be 0 for the CreateTokenCustomer and UpdateTokenCustomer methods
InvoiceNumber O 64 string Your invoice number for this transaction
InvoiceDescription O 64 string A description of the purchase that the customer is making
InvoiceReference O 50 string Your reference number for this transaction
CurrencyCode O 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.g. Australian Dollars = AUD

Field types: R – Required, C – Conditionally Required, O – Optional

Shipping Address

The ShippingAddress section is optional. It is used by Fraud Essentials and Fraud Ultimate to assist with the analysis of the transaction.

Field Name Field Type Max Length Data Type Description
ShippingMethod O 30 string The method used to ship the customer's order
One of: Unknown, LowCost, DesignatedByCustomer, International, Military, NextDay, StorePickup, TwoDayService, ThreeDayService, Other
FirstName O 50 string The first name of the person the order is shipped to
LastName O 50 string last name of the person the order is shipped to
Street1 O 50 string The street address the order is shipped to
Street2 O 50 string The street address of the shipping location
City O 50 string The city / suburb of the shipping location
State O 50 string The state / county of the shipping location
Country C 2 string The country of the shipping location. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
PostalCode O 30 string The post / zip code of the shipping location
Email O 50 string The email address of the person the order is shipped to, which must be correctly formatted if present.
Phone O 32 string The phone number of the person the order is shipped to
Fax O 32 string The fax number of the shipping location

Items

The Items section is optional. If provided, it should contain a list of line items purchased by the customer, up to a maximum of 99 items. It is used by Fraud Essentials and Fraud Ultimate as part of the risk analysis of the transaction.
LineItems have the following fields:

Field Name Field Type Max Length Data Type Description
SKU O 12 string The stock keeping unit used to identify this line item
Description O 26 string A brief description of the product
Quantity O 6 int The purchased quantity
UnitCost O 8 int The pre-tax cost per unit of the product in the lowest denomination
Tax O 8 int The tax amount that applies to this line item in the lowest denomination
Total O 8 int The total amount charged for this line item in the lowest denomination

Options

This section is optional. Anything appearing in this section is not displayed to the customer. Up to 99 options can be defined. Each option has just one field:

Field Name Field Type Max Length Data Type Description
Value O 254 string This field is not displayed to the customer. Anything can be used here, which can be useful for tracking transactions.
Additional characters are truncated at 254

Example Response

"AccessCode": "44DD7UkA7zOC8hjeXJGyVu1Wub7xH5ayPXUgUlRQeXqYq0ZWMJnKEA6BEUCqZFYmYoVtQc3bUWX6h6vVIrc260Y8NHrsIIV9wWY3O6a-C3oQZgUH0IwxSXnfll6LS7rXVRS0O",
"Customer": {
    "CardNumber": "",
    "CardStartMonth": "",
    "CardStartYear": "",
    "CardIssueNumber": "",
    "CardName": "",
    "CardExpiryMonth": "",
    "CardExpiryYear": "",
    "IsActive": false,
    "CardDetails": null,
    "TokenCustomerID": null,
    "Reference": "A12345",
    "Title": "Mr.",
    "FirstName": "John",
    "LastName": "Smith",
    "CompanyName": "Demo Shop 123",
    "JobDescription": "Developer",
    "Street1": "Level 5",
    "Street2": "369 Queen Street",
    "City": "Sydney",
    "State": "NSW",
    "PostalCode": "2000",
    "Country": "au",
    "Email": "demo@example.org",
    "Phone": "09 889 0986",
    "Mobile": "09 889 6542",
    "Comments": "",
    "Fax": "",
    "Url": "http://www.ewaypayments.com"
},
"Payment": {
    "TotalAmount": 1000,
    "InvoiceNumber": "Inv 21540",
    "InvoiceDescription": "Individual Invoice Description",
    "InvoiceReference": "513456",
    "CurrencyCode": "AUD"
},
"FormActionURL": "https://secure-au.sandbox.ewaypayments.com/AccessCode/44DD7UkA7zOC8hjeXJGyVu1Wub7xH5ayPXUgUlRQeXqYq0ZWMJnKEA6BEUCqZFYmYoVtQc3bUWX6h6vVIrc260Y8NHrsIIV9wWY3O6a-C3oQZgUH0IwxSXnfll6LS7rXVRS0O",
"CompleteCheckoutURL": null,
"AmexECEncryptedData": null,
"Errors": null
}

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CreateAccessCodeResponse xmlns="https://api.ewaypayments.com/">
         <CreateAccessCodeResult>
            <AccessCode>A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto</AccessCode>
            <Customer>
               <TokenCustomerID xsi:nil="true"/>
               <Reference>A12345</Reference>
               <Title>Mr.</Title>
               <FirstName>John</FirstName>
               <LastName>Smith</LastName>
               <CompanyName>Demo Shop 123</CompanyName>
               <JobDescription>Developer</JobDescription>
               <Street1>Level 5</Street1>
               <Street2>369 Queen Street</Street2>
               <City>Sydney</City>
               <State>NSW</State>
               <PostalCode>2000</PostalCode>
               <Country>au</Country>
               <Email>demo@example.org</Email>
               <Phone>0289712345</Phone>
               <Mobile>0289712345</Mobile>
               <Comments>Customer comments</Comments>
               <Fax>0289712345</Fax>
               <Url>http://www.ewaypayments.com</Url>
               <CardNumber/>
               <CardStartMonth/>
               <CardStartYear/>
               <CardIssueNumber/>
               <CardName/>
               <CardExpiryMonth/>
               <CardExpiryYear/>
               <IsActive>false</IsActive>
            </Customer>
            <Payment>
               <TotalAmount>1000</TotalAmount>
               <InvoiceNumber>Inv 21540</InvoiceNumber>
               <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
               <InvoiceReference>Individual Invoice Description</InvoiceReference>
               <CurrencyCode>AUD</CurrencyCode>
            </Payment>
            <FormActionURL>https://secure-au.sandbox.ewaypayments.com/Process</FormActionURL>
         </CreateAccessCodeResult>
      </CreateAccessCodeResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available $response properties

if (!$response->getErrors()) {
    $accessCode = $response->AccessCode;
    $formUrl = $response->FormActionURL;
} else {
    foreach ($response->getErrors() as $error) {
        echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
    }
}

// See the JSON tab for all the available response properties

if (response.getErrors().isEmpty()) {
    String accessCode = response.getAccessCode();
    String formUrl = response.getFormActionUrl();
} else {
    for (String errorcode: response.getErrors()) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode, "en"));
    };
}
// See the JSON tab for all the available response properties

if (response.Codetails == null)
{
    string accessCode = response.AccessCode;
    string formUrl = response.FormActionUrl;
}
else
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
// See the JSON tab for all the available response properties

.then(function (response) {
    if (response.getErrors().length == 0) {
        var accessCode = response.get('AccessCode');
        var formUrl = response.get('FormActionURL');
    } else {
        response.getErrors().forEach(function(error) {
            console.log("Response Messages: " + rapid.getMessage(error, "en"));
        });
    }
})
.catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available response properties

if response.errors.empty?
  access_code = response.access_code
  form_url = response.form_action_url
else
  response.errors.each { |e| puts "Response message: "+ EwayRapid::RapidClient.user_display_message(e) }
end

Response

The response received from Eway will contain the AccessCode that should be used for all further requests associated with this transaction.

The response will also contain the FormActionURL. This is the URL that the form should be posted to in Step 2 of the process.

Depending on the Method being used for this request, some additional information will be returned in the response.

If processing a payment, the response will also include an echo of the payment information submitted in the request.

If using an existing Token customer, the customer's masked card data will be included in the response. This enables existing Token customers to elect to pay without having to enter their card details again, with the exception of the CVN, which cannot be stored.

Response Field Descriptions

Field Name Max Length Data Type Description
AccessCode 512 string A unique AccessCode that is used to identify this transaction with the Rapid API. This AccessCode will need to be present for all future requests associated with this transaction.
FormActionURL 512 string The URL that the form should be POSTed to in Step 2
CompleteCheckoutURL 512 string Depreciated. This field will return a null value
AmexECEncryptedData 512 string Depreciated. This field will return a null value
Errors 512 string A comma separated list of any errors encountered

Customer

Field Name Max Length Data Type Description
CardNumber 50 string The Token customer's masked credit card number
CardName 50 string The Token customer's card holder name
CardExpiryMonth 2 string The Token customer's card expiry month
CardExpiryYear 2 string The Token customer's card expiry year
CardStartMonth* 2 string The Token customer's card valid from month
CardStartYear* 2 string The Token customer's card valid from year
CardIssueNumber* 2 string The Token customer's card issue number
IsActive 5 boolean This is a boolean value indicating whether the Token customer is active
CardDetails string Currently unused. This will return a null value
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

*Applies to UK only

Payment

Field Name Max Length Data Type Description
TotalAmount 10 int The amount of the transaction in the lowest denomination, as passed in the original request.
e.g. $25.00 = 2500
InvoiceNumber 64 string Your invoice number for this transaction.
InvoiceDescription 64 string A description of the purchase that the customer is making.
InvoiceReference 50 string Your reference number for this transaction.
CurrencyCode 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used.

Step 2: Customer Submits Their Card Details Directly to Eway

Once you receive the AccessCode response from Eway, the customer must be redirected to a secure page that contains an HTML form. Eway will only accept data from forms that use the POST method. Any data posted from a form that has the method attribute set to GET will be rejected.

This request does not require the "Authorization" HTTP header, as authentication is instead performed using the AccessCode.

The form's action attribute must be set to the URL returned in the FormActionURL of the response returned in Step 1.

Your payment form will need to contain the following input fields:

Example HTML form

<form method="POST" action="<<FormActionURL Goes Here>>" id="payment_form">
  <input type="hidden" name="EWAY_ACCESSCODE" value="<<AccessCode Goes Here>>" />
  <input type="hidden" name="EWAY_PAYMENTTYPE" value="Credit Card" />
  Card Name: <input type="text" name="EWAY_CARDNAME" />
  Card Number: <input type="text" name="EWAY_CARDNUMBER" />
  Card Expiry Month: <input type="text" name="EWAY_CARDEXPIRYMONTH" />
  Card Expiry Year: <input type="text" name="EWAY_CARDEXPIRYYEAR" />
  Card Start Date: <input type="text" name="EWAY_CARDSTARTMONTH" />
  Card Start Year: <input type="text" name="EWAY_CARDSTARTYEAR" />
  Card Issue Number: <input type="text" name="EWAY_CARDISSUENUMBER" />
  Card CVN: <input type="text" name="EWAY_CARDCVN" />
  <input type="submit" value="Process" text="Process" />
</form>
Field Name Field Type Description
EWAY_ACCESSCODE R The Access Code returned in Step 1. The Access Code is case sensitive.
EWAY_PAYMENTTYPE C The type of payment you are processing. If this value is not present the payment is assumed to be a credit card payment and all values necessary to perform a credit card transaction are required.
One of: Credit Card, ApplePay, VisaCheckout
EWAY_CARDNAME C The name of the card holder.
Required if PaymentType is Credit Card
EWAY_CARDNUMBER C The card number that is to be processed for this transaction.
Required if PaymentType is Credit Card
EWAY_CARDEXPIRYMONTH C The month that the card expires.
Required if PaymentType is Credit Card
EWAY_CARDEXPIRYYEAR C The year that the card expires.
Required if PaymentType is Credit Card
EWAY_CARDSTARTMONTH O The month that the card is valid from
UK only
EWAY_CARDSTARTYEAR O The year that the card is valid from
UK only
EWAY_CARDISSUENUMBER O The card's issue number
UK only
EWAY_CARDCVN C The Card Verification Number
Required if PaymentType is CreditCard and TransactionType is Purchase
APPLEPAY_NETWORKTOKEN C The paymentData JSON received from Apple Pay
Required if PaymentType is ApplePay
VISA_CHECKOUT_CALLID C The Visa Checkout Call ID obtained from Click to Pay
Required if PaymentType is VisaCheckout
VISA_CHECKOUT_EVENTTYPE C Identifies the action being completed. Must be set to Capture when processing a payment, or Cancel if you no longer want to proceed with the payment
Required if PaymentType is VisaCheckout
VISA_CHECKOUT_RESPONSE C The response from the Click to Pay lightbox in JSON format.
Required PaymentType is VisaCheckout and no VISA_CHECKOUT_CALLID is supplied

Field Types: R – Required, O – Optional, C – Conditionally Required

Once the customer has entered their card details, the form is submitted directly to Eway.

What happens next depends on the Method you sent in the CreateAccessCode request.

In all cases, the customer's browser will then be redirected to the URL specified in the RedirectURL field of the initial request.

AJAX with JSONP

Example Script

<script type="text/javascript">
  // Add the submit handler
  var form = document.getElementById("payment_form");
  if (form.addEventListener) {
    //Modern browsers
    form.addEventListener("submit", ewayAjax, false);  
  } else if (form.attachEvent) {
    //Old IE
    form.attachEvent('onsubmit', ewayAjax);            
  }

  function ewayAjax(e) {
    // call eWAY to process the request
    eWAY.process(
      document.getElementById("payment_form"),
      {
        autoRedirect: false,
        onComplete: function (data) {
          // this is a callback to hook into when the requests completes
          alert('The JSONP request has completed.');
          if (data.Is3DSecure) {
            window.location.replace(data.RedirectUrl);
          }
        },
        onError: function (e) {
          // this is a callback you can hook into when an error occurs
          alert('There was an error processing the request');
        },
        onTimeout: function (e) {
          // this is a callback you can hook into when the request times out
          alert('The request has timed out.');
        }
      }
    );
    // Stop the form from submitting
    e.preventDefault();
  }
</script>

Transparent Redirect can be incorporated into an AJAX page using the JSONP submission script. To utilise JSONP, load the scripts into the page as follows:

<script type="text/javascript" src="https://api.ewaypayments.com/JSONP/v3/js"></script>

Then, to use JSONP in the form submission process a call to the method eWAY.process() is required. This should be called when the submit button is pressed, overriding the form's default submission.

eWAY.process() takes two parameters:

Available Options and Callbacks

autoRedirect: Whether the page should redirect automatically to the returned RedirectUrl once the callback function has completed. The default value for this is true.

onComplete: The callback to run when the request completes successfully. In this callback, a data object is available that has the following properties: RedirectUrl, Is3DSecure, AccessCode

Note: When Is3Dsecure is set to true, the customer must be redirected to the RedirectUrl or they will not be able to successfully complete the transaction.

onError: The callback to run when an error occurs.

onTimeout: The callback to run when a timeout occurs. The timeout length is 90 seconds.

When an error or timeout occurs, the form should not be resubmitted. Instead, the merchant should proceed to step 3 and retrieve the results as a transaction may have occurred.

Step 3: Request the Results

Once the customer has been redirected to the RedirectUrl page, request the results from Eway by calling the GetAccessCodeResult method of the API.

The final page will have the AccessCode for the transaction appended to the RedirectUrl as a query string (as ?AccessCode=).

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.ewaypayments.com/AccessCode/{AccessCode}
HTTP POST (XML) https://api.ewaypayments.com/GetAccessCodeResult.xml
HTTP POST (JSON) https://api.ewaypayments.com/GetAccessCodeResult.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.sandbox.ewaypayments.com/AccessCode/{AccessCode}
HTTP POST (XML) https://api.sandbox.ewaypayments.com/GetAccessCodeResult.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/GetAccessCodeResult.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Example request

curl --request GET \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    https://api.sandbox.ewaypayments.com/AccessCode/A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <GetAccessCodeResult xmlns="https://api.ewaypayments.com/">
         <request>
            <AccessCode>A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto</AccessCode>
         </request>
      </GetAccessCodeResult>
   </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$response = $client->queryTransaction('A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto');
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

QueryTransactionResponse response = client.queryTransaction("A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto");
IRapidClient rapidClient = new RapidClient(httpClient);

QueryAccessCodeResponse response = await rapidClient.QueryAccessCode ("A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto");
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.queryTransaction("A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto")
.then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

response = client.query_transaction_by_access_code('A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto')

Request Field Descriptions

Field Name Field Type Max Length Data Type Description
AccessCode R 512 string The AccessCode that was appended to the RedirectURL

Field Types: R – Required

If a transaction has been processed, the response received from Eway will contain all relevant details such as the bank authorisation code and a unique number that identifies the transaction in Eway's database (TransactionID).

If a Token customer was involved, the Token ID that Eway uses to identify that customer will also be returned.

All responses will contain a Response Code and Response Message that represents the result of the action performed.

If applicable, the response will also contain information about the payment that has been processed, as well as the results of any Fraud risk analysis that was performed.

Example response

{
    "AccessCode": "F9802L7BENl4HwBtfw_Q-kLMjN3Z68fHgweKDswJ7DcaiMmVoCQ-GyI7WoM11d_omVl-h3PZULgOV9MSJBD2Xn6IVAZWw0wEjTtma87DWKVBQG5MjWosHFtFl1teNcDHpPTnC",
    "AuthorisationCode": "271117",
    "ResponseCode": "00",
    "ResponseMessage": "A2000",
    "InvoiceNumber": "Inv 21540",
    "InvoiceReference": "513456",
    "TotalAmount": 2000,
    "TransactionID": 30516852,
    "TransactionStatus": true,
    "TokenCustomerID": null,
    "BeagleScore": null,
    "Options": [
        {
            "Value": "Option1"
        },
        {
            "Value": "Option2"
        }
    ],
    "Verification": {
        "CVN": 0,
        "Address": 0,
        "Email": 0,
        "Mobile": 0,
        "Phone": 0
    },
    "BeagleVerification": {
        "Email": 0,
        "Phone": 0
    },
    "PaymentInstrument": {
        "ThreeDSecureAuth": {
            "Cryptogram": null,
            "ECI": null,
            "XID": null,
            "AuthStatus": null,
            "Version": null,
            "dsTransactionId": null
        },
        "PaymentType": "CreditCard"
    },
    "Customer": {
        "CardDetails": {
            "CardType": "VI",
            "Number": "444433XXXXXX1111",
            "Name": "John Smith",
            "ExpiryMonth": "04",
            "ExpiryYear": "25",
            "StartMonth": null,
            "StartYear": null,
            "IssueNumber": null
        },
        "TokenCustomerID": null,
        "Reference": null,
        "Title": null,
        "FirstName": null,
        "LastName": null,
        "CompanyName": null,
        "JobDescription": null,
        "Street1": null,
        "Street2": null,
        "City": null,
        "State": null,
        "PostalCode": null,
        "Country": null,
        "Email": null,
        "Phone": null,
        "Mobile": null,
        "Comments": null,
        "Fax": null,
        "Url": null
    },
    "Errors": null
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetAccessCodeResultResponse xmlns="https://api.ewaypayments.com/">
         <GetAccessCodeResultResult>
            <AccessCode>A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto</AccessCode>
            <AuthorisationCode>849311</AuthorisationCode>
            <ResponseCode>00</ResponseCode>
            <ResponseMessage>A2000</ResponseMessage>
            <InvoiceNumber>Inv 21540</InvoiceNumber>
            <InvoiceReference>513456</InvoiceReference>
            <TotalAmount>1000</TotalAmount>
            <TransactionID>11237905</TransactionID>
            <TransactionStatus>true</TransactionStatus>
            <TokenCustomerID xsi:nil="true"/>
            <BeagleScore>0</BeagleScore>
            <Options>
               <Option>
                  <Value>Option1</Value>
               </Option>
               <Option>
                  <Value>Option2</Value>
               </Option>
            </Options>
            <Verification>
               <CVN>Unchecked</CVN>
               <Address>Unchecked</Address>
               <Email>Unchecked</Email>
               <Mobile>Unchecked</Mobile>
               <Phone>Unchecked</Phone>
            </Verification>
            <BeagleVerification>
               <Email>NotVerified</Email>
               <Phone>NotVerified</Phone>
            </BeagleVerification>
         </GetAccessCodeResultResult>
      </GetAccessCodeResultResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available properties

$transactionResponse = $response->Transactions[0];

if ($transactionResponse->TransactionStatus) {
    echo 'Payment successful! ID: '.$transactionResponse->TransactionID;
} else {
    $errors = explode(', ', $transactionResponse->ResponseMessage);
    foreach ($errors as $error) {
        echo "Payment failed: ".\Eway\Rapid::getMessage($error)."<br>";
    }
}

// See the JSON tab for all the available properties

if (response.getTransactionStatus().isStatus()) {
    System.out.println("Payment successful! ID: " + response.getTransactionStatus().getTransactionID());
} else {
    String[] errorcodes = response.getTransactionStatus().getProcessingDetails().getResponseMessage().split(",");
    for (String errorcode: errorcodes) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode.trim(), "en"));
    }
}
// See the JSON tab for all the available properties

if ((bool)response.TransactionStatus)
{
    Console.WriteLine("Payment successful! ID: " + response.TransactionID);
}
else
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
// See the JSON tab for all the available properties

.then(function (response) {
    if (response.get('Transactions[0].TransactionStatus')) {
        console.log('Payment successful! ID: ' + response.get('Transactions[0].TransactionID'));
    } else {
        var errorCodes = response.get('Transactions[0].ResponseMessage').split(', ');
        errorCodes.forEach(function(errorCode) {
            console.log("Response Message: " + rapid.getMessage(errorCode, "en"));
        });
    }
}).catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});

if response.transaction_status.status?
  puts "Payment successful! ID: #{response.transaction_status.transaction_id.to_s}"
else
  puts "Failed! Message #{response.transaction_status.processing_details.response_message}"
end

Response Field Descriptions

Field Name Max Length Data Type Description
AccessCode 512 string An echo of the AccessCode used in the request
AuthorisationCode 6 string The authorisation code for this transaction as returned by the bank
ResponseCode 2 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result if the action performed.
If a Fraud Essentials rule is triggered, this may contain multiple codes: eg. D4405, F7003
InvoiceNumber 64 string An echo of the merchant's invoice number for this transaction
InvoiceReference 64 string An echo of the merchant's reference number for this transaction
TotalAmount 10 int The amount that was authorised for this transaction
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
TransactionStatus 16 boolean A Boolean value that indicates whether the transaction was successful or not
TokenCustomerID 16 long An Eway-issued ID that represents the Token customer that was loaded or created for this transaction (if applicable)
BeagleScore 6 string A Fraud Lite score representing the estimated probability that the order is fraudulent. A value between 0.01 and 100.00 representing the likelihood that the transaction is fradulent, wih 0.01 being the lowest and 100.00 being the highest.
In the Sandbox environment the score will always be returned as -1 unless you have configured your Sandbox to fail for Risk Score, in which case the value will be 101.
This field is only returned when using Fraud Lite
Options N/A object An echo of the options collection passed in the CreateAccessCode request
Verification N/A object This set of fields is currently unused
BaegleVerification N/A object This will contain the results of the Fraud Verification identification checks that may have been performed
PaymentInstrument N/A object This set of fields contains the details of the payment instrument used for the transaction
Customer N/A object This set of fields contains the details of the customer making the payment
Errors 512 string A comma separated list of any error encountered. These can be looked up in the Response and Error Codes section.

Options

The Options collection passed in the original request will be echoed back in the response here.

Field Name Max Length Data Type Description
Value 255 string An echo of the option submitted for this transaction

Verification

These fields are currently unused

Field Name Max Length Data Type Description
CVN 10 string This field is not currently used
Address 10 string This field is not currently used
Email 10 string This field is not currently used
Mobile 10 string This field is not currently used
Phone 10 string This field is not currently used

BeagleVerification

This will contain the results of the Fraud Verification identification checks that may have been performed. These options are only active when using the Responsive Shared Page.

Field Name Max Length Data Type Description
Email 11 string The result of the email verification
Phone 11 string The result of the phone verification

PaymentInstrument

This set of fields contains the details of the payment instrument used for the transaction.

Field Name Max Length Data Type Description
ThreeDSecureAuth N/A object This set of fields contains the 3D Secure verification results
PaymentType 10 string The payment method used for the transaction.
eg. CreditCard or ApplePay

ThreeDSecureAuth

This set of fields contains the 3D Secure verification results.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0

Customer

Field Name Max Length Data Type Description
CardDetails N/A object This set of fields contains the details of the card used for the payment
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

Card Details

The card details section is within the Customer section.

Field Name Max Length Data Type Description
Name 50 string An echo of the name of the card holder
Number 50 int A masked echo of the card number
ExpiryMonth 2 int An echo of the month that the card expires
ExpiryYear 2 int An echo of the year that the card expires
StartMonth* 2 int An echo of the month that the card is valid from
StartYear* 2 int An echo of the year that the card is valid from
IssueNumber* int An echo of the card's issue number

*Applies to UK only

Responsive Shared Page

Eway's Responsive Shared Page API provides a hosted payment form to securely capture payment information. The Responsive Shared Page is hosted on Eway's secure servers and will reduce your scope of PCI DSS compliance by removing the payment processing from your environment. There are a number of themes to customise the look of the form, plus it adapts to any screen size to be suitable for viewing on both mobiles and PCs.

The Responsive Shared Page also comes with built support for 3D Secure and our digital wallet solutions - no further development is required, simply enable the functionality in your MyEway portal!

Implementing the Responsive Shared Page API is a three step process:

  1. Pass the customer and transaction details to Eway to generate an AccessCode and Shared Payment URL.
  2. Redirect the customer to the provided URL to enter their payment information. After processing the transaction, the customer is directed back to the nominated Redirect URL.
  3. Once the transaction has been processed, request the results from Eway using the AccessCode.

Step 1: Create an AccessCode and Shared Payment URL

To request a Shared Payment URL, make a server-side call to the CreateAccessCodeShared method of the API. Eway will respond with an AccessCode, a SharedPaymentUrl and return the customer data.

If the request involves an existing Token customer, their details will be returned in the response including the masked credit card number.

If Token Payments are not in use for this transaction, the returned customer data will be an echo of the data in the request.

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/AccessCodesShared
HTTP POST (XML) https://api.ewaypayments.com/CreateAccessCodeShared.xml
HTTP POST (JSON) https://api.ewaypayments.com/CreateAccessCodeShared.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/AccessCodesShared
HTTP POST (XML) https://api.sandbox.ewaypayments.com/CreateAccessCodeShared.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/CreateAccessCodeShared.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Request Field Descriptions

Basic Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Payment": {
           "TotalAmount": 100
        },
        "RedirectUrl": "http://www.eway.com.au",
        "CancelUrl": "http://www.eway.com.au",
        "Method": "ProcessPayment",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/AccessCodesShared
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <CreateAccessCodeShared xmlns="https://api.ewaypayments.com/">
            <request>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <RedirectUrl>http://www.eway.com.au</RedirectUrl>
                <CancelUrl>http://www.eway.com.au</CancelUrl>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
            </request>
        </CreateAccessCodeShared>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'RedirectUrl' => 'http://www.eway.com.au',
    'CancelUrl' => "http://www.eway.com.au",
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'Payment' => [
        'TotalAmount' => 1000,
    ]
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

transaction.setPaymentDetails(paymentDetails);
transaction.setRedirectURL("http://www.eway.com.au");
transaction.setCancelURL("http://www.eway.com.au");
transaction.setTransactionType(TransactionType.Purchase);

CreateTransactionResponse response = client.create(PaymentMethod.ResponsiveShared, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CreateResponsiveSharedRequest transaction = new CreateResponsiveSharedRequest()
{
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    RedirectUrl = "http://www.eway.com.au",
    CancelUrl = "http://www.eway.com.au",
    LogoUrl = "https://mysite.com/images/logo4eway.jpg",
    HeaderText = "My Site Header Text",
    Language = "EN",
    CustomView = CustomView.Bootstrap,
    TransactionType = TransactionTypes.Purchase
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.RESPONSIVE_SHARED, {
    "Payment": {
       "TotalAmount": 100
    },
    "RedirectUrl": "http://www.eway.com.au",
    "CancelUrl": "http://www.eway.com.au",
    "TransactionType": "Purchase"
}).then(function (response) {

});

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new
payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details
transaction.redirect_url = 'http://www.eway.com.au'
transaction.cancel_url = 'http://www.eway.com.au'
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::RESPONSIVE_SHARED, transaction)

Complete Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "Reference": "A12345",
           "Title": "Mr.",
           "FirstName": "John",
           "LastName": "Smith",
           "CompanyName": "Demo Shop 123",
           "JobDescription": "Developer",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "PostalCode": "2000",
           "Country": "au",
           "Email": "demo@example.org",
           "Phone": "09 889 0986",
           "Mobile": "09 889 6542",
           "Comments": "This is a a comment",
           "Fax": "09 889 6542",
           "Url": "http://www.ewaypayments.com"
        },
        "ShippingAddress": {
           "ShippingMethod": "NextDay",
           "FirstName": "John",
           "LastName": "Smith",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "Country": "au",
           "PostalCode": "2000",
           "Email": "demo@example.org",
           "Phone": "09 889 0986",
           "Fax": "09 889 6542"
        },
        "Items": [
         {
           "SKU": "12345678901234567890",
           "Description": "Item Description 1",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         },
         {
           "SKU": "123456789012",
           "Description": "Item Description 2",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         }
        ],
        "Options": [
         {
           "Value": "Option1"
         },
         {
           "Value": "Option2"
         }
        ],
        "Payment": {
           "TotalAmount": 1000,
           "InvoiceNumber": "Inv 21540",
           "InvoiceDescription": "Individual Invoice Description",
           "InvoiceReference": "513456",
           "CurrencyCode": "AUD"
        },
        "RedirectUrl": "http://www.eway.com.au",
        "CancelUrl": "http://www.eway.com.au",
        "Method": "ProcessPayment",
        "DeviceID": "D1234",
        "CustomerIP": "127.0.0.1",
        "PartnerID": "ID",
        "TransactionType": "Purchase",
        "LogoUrl": "https://mysite.com/images/logo4eway.jpg",
        "HeaderText": "My Site Header Text",
        "FooterText": "This is my footer text",
        "Language": "EN",
        "CustomerReadOnly": true,
        "CustomView": "bootstrap",
        "VerifyCustomerPhone": false,
        "VerifyCustomerEmail": false
        }' \
    https://api.sandbox.ewaypayments.com/AccessCodesShared
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <CreateAccessCodeShared xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <Reference>A12345</Reference>
                    <Title>Mr.</Title>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <CompanyName>Demo Shop 123</CompanyName>
                    <JobDescription>Developer</JobDescription>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Mobile>0289712345</Mobile>
                    <Comments>Customer comments</Comments>
                    <Fax>0289712345</Fax>
                    <Url>http://www.ewaypayments.com</Url>
                </Customer>
                <ShippingAddress>
                    <ShippingMethod>NextDay</ShippingMethod>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Fax>0289712345</Fax>
                </ShippingAddress>
                <Items>
                    <LineItem>
                        <SKU>12345678901234567890</SKU>
                        <Description>Item Description 1</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                    <LineItem>
                        <SKU>123456789012</SKU>
                        <Description>Item Description 2</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                </Items>
                <Options>
                    <Option>
                        <Value>Option1</Value>
                    </Option>
                    <Option>
                        <Value>Option2</Value>
                    </Option>
                </Options>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                    <InvoiceNumber>Inv 21540</InvoiceNumber>
                    <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
                    <InvoiceReference>Individual Invoice Description</InvoiceReference>
                    <CurrencyCode>AUD</CurrencyCode>
                </Payment>
                <RedirectUrl>http://www.eway.com.au</RedirectUrl>
                <CancelUrl>http://www.eway.com.au</CancelUrl>
                <CustomerIP>127.0.0.1</CustomerIP>
                <DeviceID>D1234</DeviceID>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
                <CheckoutPayment>false</CheckoutPayment>
                <CustomerReadOnly>true</CustomerReadOnly>
                <VerifyCustomerPhone>false</VerifyCustomerPhone>
                <VerifyCustomerEmail>false</VerifyCustomerEmail>
                <LogoUrl>https://mysite.com/images/logo4eway.jpg</LogoUrl>
                <HeaderText>My Site Header Text</HeaderText>
                <Language>EN</Language>
                <CustomView>Bootstrap</CustomView>
            </request>
        </CreateAccessCodeShared>
    </soap:Body>
</soap:Envelope>

<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Customer' => [
        'Reference' => 'A12345',
        'Title' => 'Mr.',
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'CompanyName' => 'Demo Shop 123',
        'JobDescription' => 'Developer',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'PostalCode' => '2000',
        'Country' => 'au',
        'Phone' => '09 889 0986',
        'Mobile' => '09 889 6542',
        'Email' => 'demo@example.org',
        "Url" => "http://www.ewaypayments.com",
    ],
    'ShippingAddress' => [
        'ShippingMethod' => \Eway\Rapid\Enum\ShippingMethod::NEXT_DAY,
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'Country' => 'au',
        'PostalCode' => '2000',
        'Phone' => '09 889 0986',
    ],
    'Items' => [
        [
            'SKU' => '12345678901234567890',
            'Description' => 'Item Description 1',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
            // Total is calculated automatically
        ],
        [
            'SKU' => '123456789012',
            'Description' => 'Item Description 2',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
        ],
    ],
    'Options' => [
        [
            'Value' => 'Option1',
        ],
        [
            'Value' => 'Option2',
        ],
    ],
    'Payment' => [
        'TotalAmount' => 1000,
        'InvoiceNumber' => 'Inv 21540',
        'InvoiceDescription' => 'Individual Invoice Description',
        'InvoiceReference' => '513456',
        'CurrencyCode' => 'AUD',
    ],
    'RedirectUrl' => 'http://www.eway.com.au',
    'CancelUrl' => "http://www.eway.com.au",
    'DeviceID' => 'D1234',
    'CustomerIP' => '127.0.0.1',
    'PartnerID' => 'ID',
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'Capture' => true,
    'LogoUrl' => 'https://mysite.com/images/logo4eway.jpg',
    'HeaderText' => 'My Site Header Text',
    'Language' => 'EN',
    'CustomerReadOnly' => true
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

Customer customer = new Customer();
customer.setReference("A12345");
customer.setTitle("Mr.");
customer.setFirstName("John");
customer.setLastName("Smith");
customer.setCompanyName("eWay");
customer.setJobDescription("Java Developer");
customer.setPhone("09 889 0986");
customer.setMobile("09 889 6542");
customer.setUrl("http://ewaypayments.com");
customer.setCustomerDeviceIP("127.0.0.1");
customer.setEmail("demo@example.org");

Address address = new Address();
address.setStreet1("Level 5");
address.setStreet2("369 Queen Street");
address.setCity("Sydney");
address.setState("NSW");
address.setCountry("au");
address.setPostalCode("2000");
customer.setAddress(address);
transaction.setCustomer(customer);

ShippingDetails shippingDetail = new ShippingDetails();
shippingDetail.setFirstName("John");
shippingDetail.setLastName("Smith");
shippingDetail.setPhone("09 889 0986");
shippingDetail.setShippingMethod(ShippingMethod.LowCost);

Address shipAddress = new Address();
shipAddress.setStreet1("Level 5");
shipAddress.setStreet2("369 Queen Street");
shipAddress.setCity("Sydney");
shipAddress.setState("NSW");
shipAddress.setCountry("au");
shipAddress.setPostalCode("2000");
shippingDetail.setShippingAddress(shipAddress);
transaction.setShippingDetails(shippingDetail);

List<LineItem> items = new ArrayList<>();
LineItem item1 = new LineItem();
item1.setSku("12345678901234567890");
item1.setDescription("Item Description 1");
item1.setQuantity(1);
item1.setUnitCost(400);
item1.setTotalTax(100);
item1.setTotal(500);
items.add(item1);

LineItem item2 = new LineItem();
item2.setSku("123456789012");
item2.setDescription("Item Description 2");
item2.setQuantity(1);
item2.setUnitCost(400);
item2.setTotalTax(100);
item2.setTotal(500);
items.add(item2);

transaction.setLineItems(items);

List<String> options = new ArrayList<>();
options.add("Option1");
options.add("Option2");
transaction.setOptions(options);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);
paymentDetails.setCurrencyCode("AUD");
paymentDetails.setInvoiceDescription("Individual Invoice Description");
paymentDetails.setInvoiceNumber("Inv 21540");
paymentDetails.setInvoiceReference("513456");
transaction.setPaymentDetails(paymentDetails);

transaction.setPartnerID("ID");
transaction.setCapture(true);
transaction.setRedirectURL("http://www.eway.com.au");
transaction.setCancelURL("http://www.eway.com.au");
transaction.setDeviceID("D1234");
transaction.setTransactionType(TransactionType.Purchase);
transaction.setLogoUrl("https://mysite.com/images/logo4eway.jpg");
transaction.setHeaderText("My Site Header Text");
transaction.setLanguage("EN");
transaction.setCustomerReadOnly(true);
transaction.setCustomView("bootstrap");
transaction.setVerifyCustomerPhone(false);
transaction.setVerifyCustomerEmail(false);
transaction.setSaveCustomer(false);

CreateTransactionResponse response = client.create(PaymentMethod.ResponsiveShared, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CreateResponsiveSharedRequest transaction = new CreateResponsiveSharedRequest()
{
    Customer = new DirectTokenCustomer()
    {
        TokenCustomerID = 321321321, 
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org",
        CardDetails = new CardDetails
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "12",
            ExpiryYear = "25",
            CVN = "123"
        }
    },
    ShippingAddress = new ShippingAddress()
    {
        FirstName = "John",
        LastName = "Smith",
        Phone = "09 889 0986",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Mobile = "09 889 6542",
        Email = "demo@example.org",
        ShippingMethod = "NextDay"
    },
    Items = new[]
    {
        new LineItem()
        {
            SKU = "12345678901234567890",
            Description = "Item Description 1",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        },
        new LineItem()
        {
            SKU = "123456789012",
            Description = "Item Description 2",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        }
    }.ToList(),
    Options = new List<Option>
    {
        new Option{ Value = "Option1" },
        new Option{ Value = "Option2" }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000,
        InvoiceNumber = "Inv 21540",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceReference = "513456",
        CurrencyCode = "AUD"
    },
    RedirectUrl = "http://www.eway.com.au",
    CancelUrl = "http://www.eway.com.au",
    DeviceID = "D1234",
    PartnerID = "ID",
    CustomerIP = "127.0.0.1",
    TransactionType = TransactionTypes.Purchase,
    LogoUrl = "https://mysite.com/images/logo4eway.jpg",
    HeaderText = "My Site Header Text",
    Language = "EN",
    CustomerReadOnly = true,
    CustomView = CustomView.Bootstrap,
    VerifyCustomerPhone = false,
    VerifyCustomerEmail = false,
    Capture = true,
    SaveCustomer = false
};

var response = await rapidClient.CreateTransaction(PaymentMethod.ResponsiveShared, transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.RESPONSIVE_SHARED, {
    "Customer": {
       "Reference": "A12345",
       "Title": "Mr.",
       "FirstName": "John",
       "LastName": "Smith",
       "CompanyName": "Demo Shop 123",
       "JobDescription": "Developer",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "PostalCode": "2000",
       "Country": "au",
       "Phone": "09 889 0986",
       "Mobile": "09 889 6542",
       "Email": "demo@example.org",
       "Url": "http://www.ewaypayments.com"
    },
    "ShippingAddress": {
       "ShippingMethod": "NextDay",
       "FirstName": "John",
       "LastName": "Smith",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "Country": "au",
       "PostalCode": "2000",
       "Phone": "09 889 0986"
    },
    "Items": [
     {
       "SKU": "12345678901234567890",
       "Description": "Item Description 1",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     },
     {
       "SKU": "123456789012",
       "Description": "Item Description 2",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     }
    ],
    "Options": [
     {
       "Value": "Option1"
     },
     {
       "Value": "Option2"
     }
    ],
    "Payment": {
       "TotalAmount": 1000,
       "InvoiceNumber": "Inv 21540",
       "InvoiceDescription": "Individual Invoice Description",
       "InvoiceReference": "513456",
       "CurrencyCode": "AUD"
    },
    "RedirectUrl": "http://www.eway.com.au",
    "CancelUrl": "http://www.eway.com.au",
    "DeviceID": "D1234",
    "CustomerIP": "127.0.0.1",
    "PartnerID": "ID",
    "TransactionType": "Purchase",
    "LogoUrl": "https://mysite.com/images/logo4eway.jpg",
    "HeaderText": "My Site Header Text",
    "Language": "EN",
    "CustomerReadOnly": true,
    "CustomView": "bootstrap",
    "VerifyCustomerPhone": false,
    "VerifyCustomerEmail": false
}).then(function (response) {

});

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

customer = EwayRapid::Models::Customer.new
customer.reference = 'A12345'
customer.title = 'Mr.'
customer.first_name = 'John'
customer.last_name = 'Smith'
customer.company_name = 'Company'
customer.job_description = 'Ruby Developer'
customer.phone = '09 889 0986'
customer.mobile = '09 889 0986'
customer.fax = '09 654 1234'
customer.url = 'http://www.ewaypayments.com'
customer.comments = 'customer comment'
customer.customer_device_ip = '127.0.0.1'
customer.email = 'demo@example.org'

address = EwayRapid::Models::Address.new
address.street1 = 'Level 5'
address.street2 = '369 Queen Street'
address.city = 'Sydney'
address.state = 'NSW'
address.country = 'AU'
address.postal_code = '2000'
customer.address = address

transaction.customer = customer

shipping_details = EwayRapid::Models::ShippingDetails.new
shipping_address = EwayRapid::Models::Address.new
shipping_address.street1 = 'Level 5'
shipping_address.street2 = '369 Queen Street'
shipping_address.city = 'Sydney'
shipping_address.state = 'NSW'
shipping_address.country = 'AU'
shipping_address.postal_code = '2000'
shipping_details.shipping_address = shipping_address
shipping_details.first_name = 'John'
shipping_details.last_name = 'Smith'
shipping_details.phone = '09 889 0986'
shipping_details.shipping_method = EwayRapid::Enums::ShippingMethod::LOW_COST
transaction.shipping_details = shipping_details

line_item = EwayRapid::Models::LineItem.new
line_item.sku = '12345678901234567890'
line_item.description = 'Item Description 1'
line_item.quantity = 1
line_item.unit_cost = 400
line_item.tax = 100
line_item.total = 500

line_item1 = EwayRapid::Models::LineItem.new
line_item1.sku = '12345678901234567890'
line_item1.description = 'Item Description 1'
line_item1.quantity = 1
line_item1.unit_cost = 400
line_item1.tax = 100
line_item1.total = 500

line_item2 = EwayRapid::Models::LineItem.new
line_item2.sku = '123456789012'
line_item2.description = 'Item Description 2'
line_item2.quantity = 1
line_item2.unit_cost = 400
line_item2.tax = 100
line_item2.total = 500

line_items = []
line_items.push(line_item1)
line_items.push(line_item2)
transaction.line_items = line_items

options = []
options.push('Option1')
options.push('Option2')
transaction.options = options

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
payment_details.invoice_number = 'Inv 21540'
payment_details.invoice_description = 'Individual Invoice Description'
payment_details.invoice_reference = '513456'
payment_details.currency_code = 'AUD'
transaction.payment_details = payment_details

transaction.redirect_url = 'http://www.eway.com.au'
transaction.cancel_url = 'http://www.eway.com.au'
transaction.device_id = 'D1234'
transaction.partner_id = 'ID'
transaction.capture = true
transaction.logo_url = 'https://mysite.com/images/logo4eway.jpg'
transaction.header_text = 'My Site Header Text'
transaction.language = 'EN'
transaction.customer_read_only = true
transaction.custom_view = 'bootstrap'
transaction.verify_customer_phone = false
transaction.verify_customer_email = false
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::RESPONSIVE_SHARED, transaction)
Field Name Field Type Max Length Data Type Description
CustomerIP O 50 string The customer's IP address.
When this field is present along with the Country field, any transaction will be processed using Fraud Lite
Method R 20 string The action to perform with this request. See Methods for more information.
One of: ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R Int enum The type of transaction you're performing (see Transaction Types).
One of: Purchase, MOTO, Recurring
DeviceID O 50 string The identification name/number for the device or application used to process the transaction
PartnerID O 50 string The partner ID generated from an Eway partner agreement
RedirectUrl R 512 string, URL The URL that the shared page redirects to after a payment is processed
CancelUrl R 512 string, URL The URL that the shared page redirects to if a customer cancels the transaction
LogoUrl O 512 string, URL The URL of your logo to display on the shared page. This must start with https://. If blank or omitted, the logo defined in the Shared Page settings in MyEway will be used.
HeaderText O 255 string Short text description to be placed under the logo on the shared page. If blank or omitted, the text defined in the Shared Page settings in MYeWAY will be used.
Language O 5 string Language code determines the language that the shared page will be displayed in.
One of: EN (English, default), ES (Spanish), zh-Hans (Chinese-Simplified), zh-Hant (Chinese-Traditional)
CustomerReadOnly O boolean When set to false, cardholders will be able to edit the information on the shared page, even if it's sent through in the CreateAccessCode request. To fetch the details the customer entered, do a Transaction Query once the transaction is complete.
CustomView O string Set the theme of the Responsive Shared Page from 12 available themes:
Bootstrap, BootstrapAmelia, BootstrapCerulean, BootstrapCosmo, BootstrapCyborg, BootstrapFlatly, BootstrapJournal, BootstrapReadable, BootstrapSimplex, BootstrapSlate, BootstrapSpacelab, BootstrapUnited
VerifyCustomerPhone O boolean Set whether the customer's phone number should be confirmed using Fraud Verify
VerifyCustomerEmail O boolean Set whether the customer's email should be confirmed using Fraud Verify
Capture O 6 boolean Rapid SDK Libraries Only Set to true to capture funds immediately (default), set to false to perform an authorisation and only hold funds.
SaveCustomer O 6 boolean Rapid SDK Libraries Only Set to true to create a token customer when the transaction is complete

Field types: R – Required, O – Optional

Note that the AccessCode is appended as a querystring parameter to the RedirectURL – existing querystring parameters are preserved.

Field Name Field Type Max Length Data Type Description
RedirectUrl R 512 string The web address the customer is redirected to after the card details has been submitted.
Note that the AccessCode is appended as a query string parameter to the RedirectUrl – existing query string parameters are preserved.
CustomerIP O 50 string The customer's IP address.
When this field is present along with the Country field, any transaction will be processed using Fraud Lite
Method R 20 string The action to perform with this request. See Methods for more information.
One of: ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R Int enum The type of transaction you're performing (see Transaction Types). Values: Purchase, MOTO, Recurring
DeviceID O 50 string The identification name/number for the device or application used to process the transaction.
PartnerID O 50 string The partner ID generated from an Eway partner agreement.
Capture O 6 boolean Rapid SDK Libraries Only Set to true to capture funds immediately (default), set to false to perform an authorisation and only hold funds.
SaveCustomer O 6 boolean Rapid SDK Libraries Only Set to true to create a token customer when the transaction is complete

Field types: R – Required, O – Optional

Customer

This set of fields contains the details of the customer.

Field Name Field Type Max Length Data Type Description
TokenCustomerID C 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Required for UpdateTokenCustomer method
Reference O 50 string Your for this customer
Title O 5 string The customer's title, empty string allowed
One of: Mr., Ms., Mrs., Miss, Dr., Sir., Prof.
FirstName C 50 string The customer's first name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
LastName C 50 string The customer's last name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
CompanyName O 50 string The customer's company name
JobDescription O 50 string The customer's job description / title
Street1 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
Street2 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
City O 50 string The customer's city / town / suburb
Providing this information helps with the 3D Secure 2.0 verification
State O 50 string The customer's state / county
Providing this information helps with the 3D Secure 2.0 verification
PostalCode C 30 string The customer's post / zip code
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Country C 2 string The customer's country. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Email C 50 string The customer's email address, which must be correctly formatted if present
Required when using 3D Secure 2.0
Phone C 32 string The customer's phone number
Required when using 3D Secure 2.0
Mobile O 32 string The customer's mobile phone number
Comments O 255 string Any comments you wish to add about the customer
Fax O 32 string The customer's fax number
Url O 512 string The customer's website, which must be correctly formatted if present

Field Types: O – Optional, C – Conditionally Required

When creating a new Token customer, the FirstName, LastName and Country are required

When the Country field is present, along with the Customer's IP address, any transaction will be processed using Fraud Lite

Payment

This set of fields contains the details of the payment being processed. This section is required when the Method field is set to ProcessPayment or TokenPayment.

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
The value of this field must be 0 for the CreateTokenCustomer and UpdateTokenCustomer methods
InvoiceNumber O 64 string Your invoice number for this transaction
InvoiceDescription O 64 string A description of the purchase that the customer is making
InvoiceReference O 50 string Your reference number for this transaction
CurrencyCode O 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.g. Australian Dollars = AUD

Field types: R – Required, C – Conditionally Required, O – Optional

Shipping Address

The ShippingAddress section is optional. It is used by Fraud Essentials and Fraud Ultimate to assist with the analysis of the transaction.

Field Name Field Type Max Length Data Type Description
ShippingMethod O 30 string The method used to ship the customer's order
One of: Unknown, LowCost, DesignatedByCustomer, International, Military, NextDay, StorePickup, TwoDayService, ThreeDayService, Other
FirstName O 50 string The first name of the person the order is shipped to
LastName O 50 string last name of the person the order is shipped to
Street1 O 50 string The street address the order is shipped to
Street2 O 50 string The street address of the shipping location
City O 50 string The city / suburb of the shipping location
State O 50 string The state / county of the shipping location
Country C 2 string The country of the shipping location. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
PostalCode O 30 string The post / zip code of the shipping location
Email O 50 string The email address of the person the order is shipped to, which must be correctly formatted if present.
Phone O 32 string The phone number of the person the order is shipped to
Fax O 32 string The fax number of the shipping location

Items

The Items section is optional. If provided, it should contain a list of line items purchased by the customer, up to a maximum of 99 items. It is used by Fraud Essentials and Fraud Ultimate as part of the risk analysis of the transaction.
LineItems have the following fields:

Field Name Field Type Max Length Data Type Description
SKU O 12 string The stock keeping unit used to identify this line item
Description O 26 string A brief description of the product
Quantity O 6 int The purchased quantity
UnitCost O 8 int The pre-tax cost per unit of the product in the lowest denomination
Tax O 8 int The tax amount that applies to this line item in the lowest denomination
Total O 8 int The total amount charged for this line item in the lowest denomination

Options

This section is optional. Anything appearing in this section is not displayed to the customer. Up to 99 options can be defined. Each option has just one field:

Field Name Field Type Max Length Data Type Description
Value O 254 string This field is not displayed to the customer. Anything can be used here, which can be useful for tracking transactions.
Additional characters are truncated at 254

Example Response

{
    "SharedPaymentUrl": "https://secure-au.sandbox.ewaypayments.com/sharedpage/sharedpayment?AccessCode=A1001lxSbo1jj5E2ceq-9wu0CSmmvfxtafqw-lAYbtrY-JJ1nHDAiv1B9FNAhsHN6Lut2E-3nl8cQqaoEoYFqrgcBNQLsW8K_h-DfNl7KeST9kOvwnYJD-auC5Clk48RCY5fW",
    "AccessCode": "A1001lxSbo1jj5E2ceq-9wu0CSmmvfxtafqw-lAYbtrY-JJ1nHDAiv1B9FNAhsHN6Lut2E-3nl8cQqaoEoYFqrgcBNQLsW8K_h-DfNl7KeST9kOvwnYJD-auC5Clk48RCY5fW",
    "Customer": {
        "CardNumber": "",
        "CardStartMonth": "",
        "CardStartYear": "",
        "CardIssueNumber": "",
        "CardName": "",
        "CardExpiryMonth": "",
        "CardExpiryYear": "",
        "IsActive": false,
        "CardDetails": null,
        "TokenCustomerID": null,
        "Reference": "A12345",
        "Title": "Mr.",
        "FirstName": "John",
        "LastName": "Smith",
        "CompanyName": "Demo Shop 123",
        "JobDescription": "Developer",
        "Street1": "Level 5",
        "Street2": "369 Queen Street",
        "City": "Sydney",
        "State": "NSW",
        "PostalCode": "2000",
        "Country": "au",
        "Email": "demo@example.org",
        "Phone": "09 889 0986",
        "Mobile": "09 889 6542",
        "Comments": "This is a a comment",
        "Fax": "09 889 6542",
        "Url": "http://www.ewaypayments.com"
    },
    "Payment": {
        "TotalAmount": 1000,
        "InvoiceNumber": "Inv 21540",
        "InvoiceDescription": "Individual Invoice Description",
        "InvoiceReference": "513456",
        "CurrencyCode": "AUD"
    },
    "FormActionURL": "https://secure-au.sandbox.ewaypayments.com/AccessCode/A1001lxSbo1jj5E2ceq-9wu0CSmmvfxtafqw-lAYbtrY-JJ1nHDAiv1B9FNAhsHN6Lut2E-3nl8cQqaoEoYFqrgcBNQLsW8K_h-DfNl7KeST9kOvwnYJD-auC5Clk48RCY5fW",
    "CompleteCheckoutURL": null,
    "Errors": null
}
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CreateAccessCodeSharedResponse xmlns="https://api.ewaypayments.com/">
         <CreateAccessCodeSharedResult>
            <AccessCode>44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</AccessCode>
            <Customer>
               <TokenCustomerID xsi:nil="true"/>
               <Reference>A12345</Reference>
               <Title>Mr.</Title>
               <FirstName>John</FirstName>
               <LastName>Smith</LastName>
               <CompanyName>Demo Shop 123</CompanyName>
               <JobDescription>Developer</JobDescription>
               <Street1>Level 5</Street1>
               <Street2>369 Queen Street</Street2>
               <City>Sydney</City>
               <State>NSW</State>
               <PostalCode>2000</PostalCode>
               <Country>au</Country>
               <Email>demo@example.org</Email>
               <Phone>0289712345</Phone>
               <Mobile>0289712345</Mobile>
               <Comments>Customer comments</Comments>
               <Fax>0289712345</Fax>
               <Url>http://www.ewaypayments.com</Url>
               <CardNumber/>
               <CardStartMonth/>
               <CardStartYear/>
               <CardIssueNumber/>
               <CardName/>
               <CardExpiryMonth/>
               <CardExpiryYear/>
               <IsActive>false</IsActive>
            </Customer>
            <Payment>
               <TotalAmount>1000</TotalAmount>
               <InvoiceNumber>Inv 21540</InvoiceNumber>
               <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
               <InvoiceReference>Individual Invoice Description</InvoiceReference>
               <CurrencyCode>AUD</CurrencyCode>
            </Payment>
            <FormActionURL>https://secure-au.sandbox.ewaypayments.com/Process</FormActionURL>            <SharedPaymentUrl>https://secure-au.sandbox.ewaypayments.com/sharedpage/sharedpayment?AccessCode=44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</SharedPaymentUrl>
         </CreateAccessCodeSharedResult>
      </CreateAccessCodeSharedResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available $response properties

if (!$response->getErrors()) {
    // Redirect to the Responsive Shared Page
    header('Location: '.$response->SharedPaymentUrl);
    die();
} else {
    foreach ($response->getErrors() as $error) {
        echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
    }
}

// See the JSON tab for all the available response properties

if (response.getErrors().isEmpty()) {
    // Redirect the user to this location
    $redirectURL = response.getSharedPaymentUrl();
} else {
    for (String errorcode: response.getErrors()) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode, "en"));
    };
}
if (response.Errors == null)
{
    Response.Redirect(response.SharedPaymentUrl);
}
else
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
// See the JSON tab for all the available response properties

.then(function (response) {
    if (response.getErrors().length == 0) {
        var redirectURL = response.get('SharedPaymentUrl');
    } else {
        response.getErrors().forEach(function(error) {
            console.log("Response Messages: " + rapid.getMessage(error, "en"));
        });
    }
})
.catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available response properties

if response.errors.empty?
  redirect_url = response.shared_payment_url
else
  response.errors.each { |e| puts "Response message: "+ EwayRapid::RapidClient.user_display_message(e) }
end

Response

The response received from Eway will contain the AccessCode that should be used for all further requests associated with this transaction.

The response will also contain the SharedPaymentUrl. This is the URL that you will need to redirect the customer to in order for them to provide their card details and complete the payment.

Depending on the Method being used for this request, some additional information will be returned in the response.

If processing a payment, the response will also include an echo of the payment information submitted in the request.

Response Fields Descriptions

Field Name Max Length Data Type Description
SharedPaymentUrl 512 String The URL to redirect the customer to enter their card details
AccessCode 512 String A unique AccessCode that is used to identify this transaction with the Rapid API. This code will need to be present for all future requests associated with this transaction
FormActionURL 512 string The URL that the form should be POSTed to if using Transparent Redirect.
Not used for the Responsive Shared Page
CompleteCheckoutURL 512 string Depreciated. This field will return a null value
Errors 512 String A comma separated list of any errors encountered

Customer

Field Name Max Length Data Type Description
CardNumber 50 string The Token customer's masked credit card number
CardName 50 string The Token customer's card holder name
CardExpiryMonth 2 string The Token customer's card expiry month
CardExpiryYear 2 string The Token customer's card expiry year
CardStartMonth* 2 string The Token customer's card valid from month
CardStartYear* 2 string The Token customer's card valid from year
CardIssueNumber* 2 string The Token customer's card issue number
IsActive 5 boolean This is a boolean value indicating whether the Token customer is active
CardDetails string Currently unused. This will return a null value
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

*Applies to UK only

Payment

Field Name Max Length Data Type Description
TotalAmount 10 int The amount of the transaction in the lowest denomination, as passed in the original request.
e.g. $25.00 = 2500
InvoiceNumber 64 string Your invoice number for this transaction.
InvoiceDescription 64 string A description of the purchase that the customer is making.
InvoiceReference 50 string Your reference number for this transaction.
CurrencyCode 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used.

Step 2: Redirect the Customer to Eway

Using the SharedPaymentUrl you must now redirect the customer's browser to Eway to process their credit card details. Once they complete their payment, Eway will redirect them to your nominated RedirectUrl

Step 3: Request the Results

Once the customer has been redirected to the RedirectUrl page, request the results from Eway by calling the GetAccessCodeResult method of the API.

The final page will have the AccessCode for the transaction appended to the RedirectUrl as a query string (as ?AccessCode=).

If CustomerReadOnly was set to false, the details the customer entered on the Responsive Shared Page can be fetched using Transaction Query.

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.ewaypayments.com/AccessCode/{AccessCode}
HTTP POST (XML) https://api.ewaypayments.com/GetAccessCodeResult.xml
HTTP POST (JSON) https://api.ewaypayments.com/GetAccessCodeResult.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.sandbox.ewaypayments.com/AccessCode/{AccessCode}
HTTP POST (XML) https://api.sandbox.ewaypayments.com/GetAccessCodeResult.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/GetAccessCodeResult.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Example request

curl --request GET \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    https://api.sandbox.ewaypayments.com/AccessCode/44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <GetAccessCodeResult xmlns="https://api.ewaypayments.com/">
         <request>
            <AccessCode>44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</AccessCode>
         </request>
      </GetAccessCodeResult>
   </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$response = $client->queryTransaction('44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2');
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

QueryTransactionResponse response = client.queryTransaction("44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2");
IRapidClient rapidClient = new RapidClient(httpClient);

var response = await rapidClient.QueryAccessCode("44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2");
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.queryTransaction("44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2")
.then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

response = client.query_transaction_by_access_code('44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2')

Request Field Descriptions

Field Name Field Type Max Length Data Type Description
AccessCode R 512 string The AccessCode that was appended to the RedirectURL

Field Types: R – Required

If a transaction has been processed, the response received from Eway will contain all relevant details such as the bank authorisation code and a unique number that identifies the transaction in Eway's database (TransactionID).

If a Token customer was involved, the Token ID that Eway uses to identify that customer will also be returned.

All responses will contain a Response Code and Response Message that represents the result of the action performed.

If applicable, the response will also contain information about the payment that has been processed, as well as the results of any Fraud risk analysis that was performed.

Example response

{
    "AccessCode": "44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2",
    "AuthorisationCode": "522587",
    "ResponseCode": "00",
    "ResponseMessage": "A2000",
    "InvoiceNumber": "Inv 21540",
    "InvoiceReference": "513456",
    "TotalAmount": 1000,
    "TransactionID": 11259580,
    "TransactionStatus": true,
    "TokenCustomerID": null,
    "BeagleScore": 0,
    "Options": [{
        "Value": "Option1"
    }, {
        "Value": "Option2"
    }],
    "Verification": {
        "CVN": 0,
        "Address": 0,
        "Email": 0,
        "Mobile": 0,
        "Phone": 0
    },
    "BeagleVerification": {
        "Email": 0,
        "Phone": 0
    },
    "Errors": null
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetAccessCodeResultResponse xmlns="https://api.ewaypayments.com/">
         <GetAccessCodeResultResult>
            <AccessCode>44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</AccessCode>
            <AuthorisationCode>522587</AuthorisationCode>
            <ResponseCode>00</ResponseCode>
            <ResponseMessage>A2000</ResponseMessage>
            <InvoiceNumber>Inv 21540</InvoiceNumber>
            <InvoiceReference>513456</InvoiceReference>
            <TotalAmount>1000</TotalAmount>
            <TransactionID>11259580</TransactionID>
            <TransactionStatus>true</TransactionStatus>
            <TokenCustomerID xsi:nil="true"/>
            <BeagleScore>0</BeagleScore>
            <Options>
               <Option>
                  <Value>Option1</Value>
               </Option>
               <Option>
                  <Value>Option2</Value>
               </Option>
            </Options>
            <Verification>
               <CVN>Unchecked</CVN>
               <Address>Unchecked</Address>
               <Email>Unchecked</Email>
               <Mobile>Unchecked</Mobile>
               <Phone>Unchecked</Phone>
            </Verification>
            <BeagleVerification>
               <Email>NotVerified</Email>
               <Phone>NotVerified</Phone>
            </BeagleVerification>
         </GetAccessCodeResultResult>
      </GetAccessCodeResultResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available properties

$transactionResponse = $response->Transactions[0];

if ($transactionResponse->TransactionStatus) {
    echo 'Payment successful! ID: '.$transactionResponse->TransactionID;
} else {
    $errors = explode(',', $transactionResponse->ResponseMessage);
    foreach ($errors as $error) {
        echo "Payment failed: ".\Eway\Rapid::getMessage(trim($error))."<br>";
    }
}

// See the JSON tab for all the available properties

if (response.getTransactionStatus().isStatus()) {
    System.out.println("Payment successful! ID: " + response.getTransactionStatus().getTransactionID());
} else {
    String[] errorcodes = response.getTransactionStatus().getProcessingDetails().getResponseMessage().split(",");
    for (String errorcode: errorcodes) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode.trim(), "en"));
    }
}
// See the JSON tab for all the available properties

if ((bool)response.TransactionStatus)
{
    Console.WriteLine("Payment successful! ID: " + response.TransactionStatus.TransactionID);
}
else
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
// See the JSON tab for all the available properties

.then(function (response) {
    if (response.get('Transactions[0].TransactionStatus')) {
        console.log('Payment successful! ID: ' + response.get('Transactions[0].TransactionID'));
    } else {
        var errorCodes = response.get('Transactions[0].ResponseMessage').split(', ');
        errorCodes.forEach(function(errorCode) {
            console.log("Response Message: " + rapid.getMessage(errorCode, "en"));
        });
    }
}).catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});

if response.transaction_status.status?
  puts "Payment successful! ID: #{response.transaction_status.transaction_id.to_s}"
else
  puts "Failed! Message #{response.transaction_status.processing_details.response_message}"
end

Response Field Descriptions

Field Name Max Length Data Type Description
AccessCode 512 string An echo of the AccessCode used in the request
AuthorisationCode 6 string The authorisation code for this transaction as returned by the bank
ResponseCode 2 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result if the action performed.
If a Fraud Essentials rule is triggered, this may contain multiple codes: eg. D4405, F7003
InvoiceNumber 64 string An echo of the merchant's invoice number for this transaction
InvoiceReference 64 string An echo of the merchant's reference number for this transaction
TotalAmount 10 int The amount that was authorised for this transaction
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
TransactionStatus 16 boolean A Boolean value that indicates whether the transaction was successful or not
TokenCustomerID 16 long An Eway-issued ID that represents the Token customer that was loaded or created for this transaction (if applicable)
BeagleScore 6 string A Fraud Lite score representing the estimated probability that the order is fraudulent. A value between 0.01 and 100.00 representing the likelihood that the transaction is fradulent, wih 0.01 being the lowest and 100.00 being the highest.
In the Sandbox environment the score will always be returned as -1 unless you have configured your Sandbox to fail for Risk Score, in which case the value will be 101.
This field is only returned when using Fraud Lite
Options N/A object An echo of the options collection passed in the CreateAccessCode request
Verification N/A object This set of fields is currently unused
BaegleVerification N/A object This will contain the results of the Fraud Verification identification checks that may have been performed
PaymentInstrument N/A object This set of fields contains the details of the payment instrument used for the transaction
Customer N/A object This set of fields contains the details of the customer making the payment
Errors 512 string A comma separated list of any error encountered. These can be looked up in the Response and Error Codes section.

Options

The Options collection passed in the original request will be echoed back in the response here.

Field Name Max Length Data Type Description
Value 255 string An echo of the option submitted for this transaction

Verification

These fields are currently unused

Field Name Max Length Data Type Description
CVN 10 string This field is not currently used
Address 10 string This field is not currently used
Email 10 string This field is not currently used
Mobile 10 string This field is not currently used
Phone 10 string This field is not currently used

BeagleVerification

This will contain the results of the Fraud Verification identification checks that may have been performed. These options are only active when using the Responsive Shared Page.

When using the REST API, a number will be returned which maps as follows:

0 = NotVerified
1 = Attempted
2 = Verified
3 = Failed

Field Name Max Length Data Type Description
Email 11 string The result of the email verification
Phone 11 string The result of the phone verification

PaymentInstrument

This set of fields contains the details of the payment instrument used for the transaction.

Field Name Max Length Data Type Description
ThreeDSecureAuth N/A object This set of fields contains the 3D Secure verification results
PaymentType 10 string The payment method used for the transaction.
eg. CreditCard or ApplePay

ThreeDSecureAuth

This set of fields contains the 3D Secure verification results.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0

Customer

Field Name Max Length Data Type Description
CardDetails N/A object This set of fields contains the details of the card used for the payment
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

Card Details

The card details section is within the Customer section.

Field Name Max Length Data Type Description
Name 50 string An echo of the name of the card holder
Number 50 int A masked echo of the card number
ExpiryMonth 2 int An echo of the month that the card expires
ExpiryYear 2 int An echo of the year that the card expires
StartMonth* 2 int An echo of the month that the card is valid from
StartYear* 2 int An echo of the year that the card is valid from
IssueNumber* int An echo of the card's issue number

*Applies to UK only

Iframe

The Responsive Shared Page can be displayed on your site as a modal iframe. This provides the security and reduced PCI compliance scope of the Responsive Shared Page with the advantage of customers never leaving your site.

Implementing the IFrame is a three step process:

  1. Pass the customer and transaction details to Eway to generate an AccessCode and Shared Payment URL.
  2. Use the Eway JavaScript to display the Iframe to accept the payment.
  3. Once the transaction has been processed, request the results from Eway using the AccessCode.

Step 1: Create an AccessCode and Shared Payment URL

To request a Shared Payment URL, make a server-side call to the CreateAccessCodeShared method of the API. Eway will respond with an AccessCode, a SharedPaymentUrl and return the customer data.

If the request involves an existing Token customer, their details will be returned in the response including the masked credit card number.

If Token Payments are not in use for this transaction, the returned customer data will be an echo of the data in the request.

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/AccessCodesShared
HTTP POST (XML) https://api.ewaypayments.com/CreateAccessCodeShared.xml
HTTP POST (JSON) https://api.ewaypayments.com/CreateAccessCodeShared.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/AccessCodesShared
HTTP POST (XML) https://api.sandbox.ewaypayments.com/CreateAccessCodeShared.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/CreateAccessCodeShared.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Request Field Descriptions

Basic Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Payment": {
           "TotalAmount": 100
        },
        "RedirectUrl": "http://www.eway.com.au",
        "CancelUrl": "http://www.eway.com.au",
        "Method": "ProcessPayment",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/AccessCodesShared
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <CreateAccessCodeShared xmlns="https://api.ewaypayments.com/">
            <request>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <RedirectUrl>http://www.eway.com.au</RedirectUrl>
                <CancelUrl>http://www.eway.com.au</CancelUrl>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
            </request>
        </CreateAccessCodeShared>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'RedirectUrl' => 'http://www.eway.com.au',
    'CancelUrl' => "http://www.eway.com.au",
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'Payment' => [
        'TotalAmount' => 1000,
    ]
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

transaction.setPaymentDetails(paymentDetails);
transaction.setRedirectURL("http://www.eway.com.au");
transaction.setCancelURL("http://www.eway.com.au");
transaction.setTransactionType(TransactionType.Purchase);

CreateTransactionResponse response = client.create(PaymentMethod.ResponsiveShared, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CreateResponsiveSharedRequest transaction = new CreateResponsiveSharedRequest()
{
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    RedirectUrl = "http://www.eway.com.au",
    CancelUrl = "http://www.eway.com.au",
    LogoUrl = "https://mysite.com/images/logo4eway.jpg",
    HeaderText = "My Site Header Text",
    Language = "EN",
    CustomView = CustomView.Bootstrap,
    TransactionType = TransactionTypes.Purchase
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.RESPONSIVE_SHARED, {
    "Payment": {
       "TotalAmount": 100
    },
    "RedirectUrl": "http://www.eway.com.au",
    "CancelUrl": "http://www.eway.com.au",
    "TransactionType": "Purchase"
}).then(function (response) {

});

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new
payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details
transaction.redirect_url = 'http://www.eway.com.au'
transaction.cancel_url = 'http://www.eway.com.au'
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::RESPONSIVE_SHARED, transaction)

Complete Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "Reference": "A12345",
           "Title": "Mr.",
           "FirstName": "John",
           "LastName": "Smith",
           "CompanyName": "Demo Shop 123",
           "JobDescription": "Developer",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "PostalCode": "2000",
           "Country": "au",
           "Email": "demo@example.org",
           "Phone": "09 889 0986",
           "Mobile": "09 889 6542",
           "Comments": "This is a a comment",
           "Fax": "09 889 6542",
           "Url": "http://www.ewaypayments.com"
        },
        "ShippingAddress": {
           "ShippingMethod": "NextDay",
           "FirstName": "John",
           "LastName": "Smith",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "Country": "au",
           "PostalCode": "2000",
           "Email": "demo@example.org",
           "Phone": "09 889 0986",
           "Fax": "09 889 6542"
        },
        "Items": [
         {
           "SKU": "12345678901234567890",
           "Description": "Item Description 1",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         },
         {
           "SKU": "123456789012",
           "Description": "Item Description 2",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         }
        ],
        "Options": [
         {
           "Value": "Option1"
         },
         {
           "Value": "Option2"
         }
        ],
        "Payment": {
           "TotalAmount": 1000,
           "InvoiceNumber": "Inv 21540",
           "InvoiceDescription": "Individual Invoice Description",
           "InvoiceReference": "513456",
           "CurrencyCode": "AUD"
        },
        "RedirectUrl": "http://www.eway.com.au",
        "CancelUrl": "http://www.eway.com.au",
        "Method": "ProcessPayment",
        "DeviceID": "D1234",
        "CustomerIP": "127.0.0.1",
        "PartnerID": "ID",
        "TransactionType": "Purchase",
        "LogoUrl": "https://mysite.com/images/logo4eway.jpg",
        "HeaderText": "My Site Header Text",
        "FooterText": "This is my footer text",
        "Language": "EN",
        "CustomerReadOnly": true,
        "CustomView": "bootstrap",
        "VerifyCustomerPhone": false,
        "VerifyCustomerEmail": false
        }' \
    https://api.sandbox.ewaypayments.com/AccessCodesShared
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <CreateAccessCodeShared xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <Reference>A12345</Reference>
                    <Title>Mr.</Title>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <CompanyName>Demo Shop 123</CompanyName>
                    <JobDescription>Developer</JobDescription>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Mobile>0289712345</Mobile>
                    <Comments>Customer comments</Comments>
                    <Fax>0289712345</Fax>
                    <Url>http://www.ewaypayments.com</Url>
                </Customer>
                <ShippingAddress>
                    <ShippingMethod>NextDay</ShippingMethod>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Fax>0289712345</Fax>
                </ShippingAddress>
                <Items>
                    <LineItem>
                        <SKU>12345678901234567890</SKU>
                        <Description>Item Description 1</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                    <LineItem>
                        <SKU>123456789012</SKU>
                        <Description>Item Description 2</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                </Items>
                <Options>
                    <Option>
                        <Value>Option1</Value>
                    </Option>
                    <Option>
                        <Value>Option2</Value>
                    </Option>
                </Options>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                    <InvoiceNumber>Inv 21540</InvoiceNumber>
                    <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
                    <InvoiceReference>Individual Invoice Description</InvoiceReference>
                    <CurrencyCode>AUD</CurrencyCode>
                </Payment>
                <RedirectUrl>http://www.eway.com.au</RedirectUrl>
                <CancelUrl>http://www.eway.com.au</CancelUrl>
                <CustomerIP>127.0.0.1</CustomerIP>
                <DeviceID>D1234</DeviceID>
                <TransactionType>Purchase</TransactionType>
                <Method>ProcessPayment</Method>
                <CheckoutPayment>false</CheckoutPayment>
                <CustomerReadOnly>true</CustomerReadOnly>
                <VerifyCustomerPhone>false</VerifyCustomerPhone>
                <VerifyCustomerEmail>false</VerifyCustomerEmail>
                <LogoUrl>https://mysite.com/images/logo4eway.jpg</LogoUrl>
                <HeaderText>My Site Header Text</HeaderText>
                <Language>EN</Language>
                <CustomView>Bootstrap</CustomView>
            </request>
        </CreateAccessCodeShared>
    </soap:Body>
</soap:Envelope>

<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Customer' => [
        'Reference' => 'A12345',
        'Title' => 'Mr.',
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'CompanyName' => 'Demo Shop 123',
        'JobDescription' => 'Developer',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'PostalCode' => '2000',
        'Country' => 'au',
        'Phone' => '09 889 0986',
        'Mobile' => '09 889 6542',
        'Email' => 'demo@example.org',
        "Url" => "http://www.ewaypayments.com",
    ],
    'ShippingAddress' => [
        'ShippingMethod' => \Eway\Rapid\Enum\ShippingMethod::NEXT_DAY,
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'Street1' => 'Level 5',
        'Street2' => '369 Queen Street',
        'City' => 'Sydney',
        'State' => 'NSW',
        'Country' => 'au',
        'PostalCode' => '2000',
        'Phone' => '09 889 0986',
    ],
    'Items' => [
        [
            'SKU' => '12345678901234567890',
            'Description' => 'Item Description 1',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
            // Total is calculated automatically
        ],
        [
            'SKU' => '123456789012',
            'Description' => 'Item Description 2',
            'Quantity' => 1,
            'UnitCost' => 400,
            'Tax' => 100,
        ],
    ],
    'Options' => [
        [
            'Value' => 'Option1',
        ],
        [
            'Value' => 'Option2',
        ],
    ],
    'Payment' => [
        'TotalAmount' => 1000,
        'InvoiceNumber' => 'Inv 21540',
        'InvoiceDescription' => 'Individual Invoice Description',
        'InvoiceReference' => '513456',
        'CurrencyCode' => 'AUD',
    ],
    'RedirectUrl' => 'http://www.eway.com.au',
    'CancelUrl' => "http://www.eway.com.au",
    'DeviceID' => 'D1234',
    'CustomerIP' => '127.0.0.1',
    'PartnerID' => 'ID',
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'Capture' => true,
    'LogoUrl' => 'https://mysite.com/images/logo4eway.jpg',
    'HeaderText' => 'My Site Header Text',
    'Language' => 'EN',
    'CustomerReadOnly' => true
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::RESPONSIVE_SHARED, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

Customer customer = new Customer();
customer.setReference("A12345");
customer.setTitle("Mr.");
customer.setFirstName("John");
customer.setLastName("Smith");
customer.setCompanyName("eWay");
customer.setJobDescription("Java Developer");
customer.setPhone("09 889 0986");
customer.setMobile("09 889 6542");
customer.setUrl("http://ewaypayments.com");
customer.setCustomerDeviceIP("127.0.0.1");
customer.setEmail("demo@example.org");

Address address = new Address();
address.setStreet1("Level 5");
address.setStreet2("369 Queen Street");
address.setCity("Sydney");
address.setState("NSW");
address.setCountry("au");
address.setPostalCode("2000");
customer.setAddress(address);
transaction.setCustomer(customer);

ShippingDetails shippingDetail = new ShippingDetails();
shippingDetail.setFirstName("John");
shippingDetail.setLastName("Smith");
shippingDetail.setPhone("09 889 0986");
shippingDetail.setShippingMethod(ShippingMethod.LowCost);

Address shipAddress = new Address();
shipAddress.setStreet1("Level 5");
shipAddress.setStreet2("369 Queen Street");
shipAddress.setCity("Sydney");
shipAddress.setState("NSW");
shipAddress.setCountry("au");
shipAddress.setPostalCode("2000");
shippingDetail.setShippingAddress(shipAddress);
transaction.setShippingDetails(shippingDetail);

List<LineItem> items = new ArrayList<>();
LineItem item1 = new LineItem();
item1.setSku("12345678901234567890");
item1.setDescription("Item Description 1");
item1.setQuantity(1);
item1.setUnitCost(400);
item1.setTotalTax(100);
item1.setTotal(500);
items.add(item1);

LineItem item2 = new LineItem();
item2.setSku("123456789012");
item2.setDescription("Item Description 2");
item2.setQuantity(1);
item2.setUnitCost(400);
item2.setTotalTax(100);
item2.setTotal(500);
items.add(item2);

transaction.setLineItems(items);

List<String> options = new ArrayList<>();
options.add("Option1");
options.add("Option2");
transaction.setOptions(options);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);
paymentDetails.setCurrencyCode("AUD");
paymentDetails.setInvoiceDescription("Individual Invoice Description");
paymentDetails.setInvoiceNumber("Inv 21540");
paymentDetails.setInvoiceReference("513456");
transaction.setPaymentDetails(paymentDetails);

transaction.setPartnerID("ID");
transaction.setCapture(true);
transaction.setRedirectURL("http://www.eway.com.au");
transaction.setCancelURL("http://www.eway.com.au");
transaction.setDeviceID("D1234");
transaction.setTransactionType(TransactionType.Purchase);
transaction.setLogoUrl("https://mysite.com/images/logo4eway.jpg");
transaction.setHeaderText("My Site Header Text");
transaction.setLanguage("EN");
transaction.setCustomerReadOnly(true);
transaction.setCustomView("bootstrap");
transaction.setVerifyCustomerPhone(false);
transaction.setVerifyCustomerEmail(false);
transaction.setSaveCustomer(false);

CreateTransactionResponse response = client.create(PaymentMethod.ResponsiveShared, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CreateResponsiveSharedRequest transaction = new CreateResponsiveSharedRequest()
{
    Customer = new Customer()
    {
        TokenCustomerID = 321321321,
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org"
    },
    ShippingAddress = new ShippingAddress()
    {
        FirstName = "John",
        LastName = "Smith",
        Phone = "09 889 0986",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Mobile = "09 889 6542",
        Email = "demo@example.org",
        ShippingMethod = "NextDay"
    },
    Items = new[]
    {
        new LineItem()
        {
            SKU = "12345678901234567890",
            Description = "Item Description 1",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        },
        new LineItem()
        {
            SKU = "123456789012",
            Description = "Item Description 2",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        }
    }.ToList(),
    Options = new List<Option>
    {
        new Option{ Value = "Option1" },
        new Option{ Value = "Option2" }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000,
        InvoiceNumber = "Inv 21540",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceReference = "513456",
        CurrencyCode = "AUD"
    },
    RedirectUrl = "http://www.eway.com.au",
    CancelUrl = "http://www.eway.com.au",
    DeviceID = "D1234",
    PartnerID = "ID",
    CustomerIP = "127.0.0.1",
    TransactionType = TransactionTypes.Purchase,
    LogoUrl = "https://mysite.com/images/logo4eway.jpg",
    HeaderText = "My Site Header Text",
    Language = "EN",
    CustomerReadOnly = true,
    CustomView = CustomView.Bootstrap,
    VerifyCustomerPhone = false,
    VerifyCustomerEmail = false,
    Capture = true,
    SaveCustomer = false
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.RESPONSIVE_SHARED, {
    "Customer": {
       "Reference": "A12345",
       "Title": "Mr.",
       "FirstName": "John",
       "LastName": "Smith",
       "CompanyName": "Demo Shop 123",
       "JobDescription": "Developer",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "PostalCode": "2000",
       "Country": "au",
       "Phone": "09 889 0986",
       "Mobile": "09 889 6542",
       "Email": "demo@example.org",
       "Url": "http://www.ewaypayments.com"
    },
    "ShippingAddress": {
       "ShippingMethod": "NextDay",
       "FirstName": "John",
       "LastName": "Smith",
       "Street1": "Level 5",
       "Street2": "369 Queen Street",
       "City": "Sydney",
       "State": "NSW",
       "Country": "au",
       "PostalCode": "2000",
       "Phone": "09 889 0986"
    },
    "Items": [
     {
       "SKU": "12345678901234567890",
       "Description": "Item Description 1",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     },
     {
       "SKU": "123456789012",
       "Description": "Item Description 2",
       "Quantity": 1,
       "UnitCost": 400,
       "Tax": 100,
       "Total": 500
     }
    ],
    "Options": [
     {
       "Value": "Option1"
     },
     {
       "Value": "Option2"
     }
    ],
    "Payment": {
       "TotalAmount": 1000,
       "InvoiceNumber": "Inv 21540",
       "InvoiceDescription": "Individual Invoice Description",
       "InvoiceReference": "513456",
       "CurrencyCode": "AUD"
    },
    "RedirectUrl": "http://www.eway.com.au",
    "CancelUrl": "http://www.eway.com.au",
    "DeviceID": "D1234",
    "CustomerIP": "127.0.0.1",
    "PartnerID": "ID",
    "TransactionType": "Purchase",
    "LogoUrl": "https://mysite.com/images/logo4eway.jpg",
    "HeaderText": "My Site Header Text",
    "Language": "EN",
    "CustomerReadOnly": true,
    "CustomView": "bootstrap",
    "VerifyCustomerPhone": false,
    "VerifyCustomerEmail": false
}).then(function (response) {

});

client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

customer = EwayRapid::Models::Customer.new
customer.reference = 'A12345'
customer.title = 'Mr.'
customer.first_name = 'John'
customer.last_name = 'Smith'
customer.company_name = 'Company'
customer.job_description = 'Ruby Developer'
customer.phone = '09 889 0986'
customer.mobile = '09 889 0986'
customer.fax = '09 654 1234'
customer.url = 'http://www.ewaypayments.com'
customer.comments = 'customer comment'
customer.customer_device_ip = '127.0.0.1'
customer.email = 'demo@example.org'

address = EwayRapid::Models::Address.new
address.street1 = 'Level 5'
address.street2 = '369 Queen Street'
address.city = 'Sydney'
address.state = 'NSW'
address.country = 'AU'
address.postal_code = '2000'
customer.address = address

transaction.customer = customer

shipping_details = EwayRapid::Models::ShippingDetails.new
shipping_address = EwayRapid::Models::Address.new
shipping_address.street1 = 'Level 5'
shipping_address.street2 = '369 Queen Street'
shipping_address.city = 'Sydney'
shipping_address.state = 'NSW'
shipping_address.country = 'AU'
shipping_address.postal_code = '2000'
shipping_details.shipping_address = shipping_address
shipping_details.first_name = 'John'
shipping_details.last_name = 'Smith'
shipping_details.phone = '09 889 0986'
shipping_details.shipping_method = EwayRapid::Enums::ShippingMethod::LOW_COST
transaction.shipping_details = shipping_details

line_item = EwayRapid::Models::LineItem.new
line_item.sku = '12345678901234567890'
line_item.description = 'Item Description 1'
line_item.quantity = 1
line_item.unit_cost = 400
line_item.tax = 100
line_item.total = 500

line_item1 = EwayRapid::Models::LineItem.new
line_item1.sku = '12345678901234567890'
line_item1.description = 'Item Description 1'
line_item1.quantity = 1
line_item1.unit_cost = 400
line_item1.tax = 100
line_item1.total = 500

line_item2 = EwayRapid::Models::LineItem.new
line_item2.sku = '123456789012'
line_item2.description = 'Item Description 2'
line_item2.quantity = 1
line_item2.unit_cost = 400
line_item2.tax = 100
line_item2.total = 500

line_items = []
line_items.push(line_item1)
line_items.push(line_item2)
transaction.line_items = line_items

options = []
options.push('Option1')
options.push('Option2')
transaction.options = options

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
payment_details.invoice_number = 'Inv 21540'
payment_details.invoice_description = 'Individual Invoice Description'
payment_details.invoice_reference = '513456'
payment_details.currency_code = 'AUD'
transaction.payment_details = payment_details

transaction.redirect_url = 'http://www.eway.com.au'
transaction.cancel_url = 'http://www.eway.com.au'
transaction.device_id = 'D1234'
transaction.partner_id = 'ID'
transaction.capture = true
transaction.logo_url = 'https://mysite.com/images/logo4eway.jpg'
transaction.header_text = 'My Site Header Text'
transaction.language = 'EN'
transaction.customer_read_only = true
transaction.custom_view = 'bootstrap'
transaction.verify_customer_phone = false
transaction.verify_customer_email = false
transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::RESPONSIVE_SHARED, transaction)
Field Name Field Type Max Length Data Type Description
CustomerIP O 50 string The customer's IP address.
When this field is present along with the Country field, any transaction will be processed using Fraud Lite
Method R 20 string The action to perform with this request. See Methods for more information.
One of: ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R Int enum The type of transaction you're performing (see Transaction Types).
One of: Purchase, MOTO, Recurring
DeviceID O 50 string The identification name/number for the device or application used to process the transaction
PartnerID O 50 string The partner ID generated from an Eway partner agreement
RedirectUrl R 512 string, URL The URL that the shared page redirects to after a payment is processed
This variable is required but currently unused.
CancelUrl R 512 string, URL The URL that the shared page redirects to if a customer cancels the transaction
This variable is required but currently unused.
LogoUrl O 512 string, URL The URL of your logo to display on the shared page. This must start with https://. If blank or omitted, the logo defined in the Shared Page settings in MyEway will be used.
HeaderText O 255 string Short text description to be placed under the logo on the shared page. If blank or omitted, the text defined in the Shared Page settings in MYeWAY will be used.
Language O 5 string Language code determines the language that the shared page will be displayed in.
One of: EN (English, default), ES (Spanish), zh-Hans (Chinese-Simplified), zh-Hant (Chinese-Traditional)
CustomerReadOnly O boolean When set to false, cardholders will be able to edit the information on the shared page, even if it's sent through in the CreateAccessCode request. To fetch the details the customer entered, do a Transaction Query once the transaction is complete.
CustomView O string Set the theme of the Responsive Shared Page from 12 available themes:
Bootstrap, BootstrapAmelia, BootstrapCerulean, BootstrapCosmo, BootstrapCyborg, BootstrapFlatly, BootstrapJournal, BootstrapReadable, BootstrapSimplex, BootstrapSlate, BootstrapSpacelab, BootstrapUnited
VerifyCustomerPhone O boolean Set whether the customer's phone number should be confirmed using Fraud Verify
VerifyCustomerEmail O boolean Set whether the customer's email should be confirmed using Fraud Verify
Capture O 6 boolean Rapid SDK Libraries Only Set to true to capture funds immediately (default), set to false to perform an authorisation and only hold funds.
SaveCustomer O 6 boolean Rapid SDK Libraries Only Set to true to create a token customer when the transaction is complete

Field types: R – Required, O – Optional

Note that the AccessCode is appended as a querystring parameter to the RedirectURL – existing querystring parameters are preserved.

Field Name Field Type Max Length Data Type Description
RedirectUrl R 512 string The web address the customer is redirected to after the card details has been submitted.
Note that the AccessCode is appended as a query string parameter to the RedirectUrl – existing query string parameters are preserved.
CustomerIP O 50 string The customer's IP address.
When this field is present along with the Country field, any transaction will be processed using Fraud Lite
Method R 20 string The action to perform with this request. See Methods for more information.
One of: ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R Int enum The type of transaction you're performing (see Transaction Types). Values: Purchase, MOTO, Recurring
DeviceID O 50 string The identification name/number for the device or application used to process the transaction.
PartnerID O 50 string The partner ID generated from an Eway partner agreement.
Capture O 6 boolean Rapid SDK Libraries Only Set to true to capture funds immediately (default), set to false to perform an authorisation and only hold funds.
SaveCustomer O 6 boolean Rapid SDK Libraries Only Set to true to create a token customer when the transaction is complete

Field types: R – Required, O – Optional

Customer

This set of fields contains the details of the customer.

Field Name Field Type Max Length Data Type Description
TokenCustomerID C 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Required for UpdateTokenCustomer method
Reference O 50 string Your for this customer
Title O 5 string The customer's title, empty string allowed
One of: Mr., Ms., Mrs., Miss, Dr., Sir., Prof.
FirstName C 50 string The customer's first name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
LastName C 50 string The customer's last name
Required when method is set to CreateTokenCustomer or when using 3D Secure 2.0
CompanyName O 50 string The customer's company name
JobDescription O 50 string The customer's job description / title
Street1 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
Street2 O 50 string The customer's street address
Providing this information helps with the 3D Secure 2.0 verification
City O 50 string The customer's city / town / suburb
Providing this information helps with the 3D Secure 2.0 verification
State O 50 string The customer's state / county
Providing this information helps with the 3D Secure 2.0 verification
PostalCode C 30 string The customer's post / zip code
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Country C 2 string The customer's country. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
Providing this information helps with the 3D Secure 2.0 verification
Required for 3D Secure 2.0 when the customer's billing country is US or CA
Email C 50 string The customer's email address, which must be correctly formatted if present
Required when using 3D Secure 2.0
Phone C 32 string The customer's phone number
Required when using 3D Secure 2.0
Mobile O 32 string The customer's mobile phone number
Comments O 255 string Any comments you wish to add about the customer
Fax O 32 string The customer's fax number
Url O 512 string The customer's website, which must be correctly formatted if present

Field Types: O – Optional, C – Conditionally Required

When creating a new Token customer, the FirstName, LastName and Country are required

When the Country field is present, along with the Customer's IP address, any transaction will be processed using Fraud Lite

Payment

This set of fields contains the details of the payment being processed. This section is required when the Method field is set to ProcessPayment or TokenPayment.

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
The value of this field must be 0 for the CreateTokenCustomer and UpdateTokenCustomer methods
InvoiceNumber O 64 string Your invoice number for this transaction
InvoiceDescription O 64 string A description of the purchase that the customer is making
InvoiceReference O 50 string Your reference number for this transaction
CurrencyCode O 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.g. Australian Dollars = AUD

Field types: R – Required, C – Conditionally Required, O – Optional

Shipping Address

The ShippingAddress section is optional. It is used by Fraud Essentials and Fraud Ultimate to assist with the analysis of the transaction.

Field Name Field Type Max Length Data Type Description
ShippingMethod O 30 string The method used to ship the customer's order
One of: Unknown, LowCost, DesignatedByCustomer, International, Military, NextDay, StorePickup, TwoDayService, ThreeDayService, Other
FirstName O 50 string The first name of the person the order is shipped to
LastName O 50 string last name of the person the order is shipped to
Street1 O 50 string The street address the order is shipped to
Street2 O 50 string The street address of the shipping location
City O 50 string The city / suburb of the shipping location
State O 50 string The state / county of the shipping location
Country C 2 string The country of the shipping location. This should be the two letter ISO 3166-1 alpha-2 code. This field must be lower case.
e.g. Australia = au
PostalCode O 30 string The post / zip code of the shipping location
Email O 50 string The email address of the person the order is shipped to, which must be correctly formatted if present.
Phone O 32 string The phone number of the person the order is shipped to
Fax O 32 string The fax number of the shipping location

Items

The Items section is optional. If provided, it should contain a list of line items purchased by the customer, up to a maximum of 99 items. It is used by Fraud Essentials and Fraud Ultimate as part of the risk analysis of the transaction.
LineItems have the following fields:

Field Name Field Type Max Length Data Type Description
SKU O 12 string The stock keeping unit used to identify this line item
Description O 26 string A brief description of the product
Quantity O 6 int The purchased quantity
UnitCost O 8 int The pre-tax cost per unit of the product in the lowest denomination
Tax O 8 int The tax amount that applies to this line item in the lowest denomination
Total O 8 int The total amount charged for this line item in the lowest denomination

Options

This section is optional. Anything appearing in this section is not displayed to the customer. Up to 99 options can be defined. Each option has just one field:

Field Name Field Type Max Length Data Type Description
Value O 254 string This field is not displayed to the customer. Anything can be used here, which can be useful for tracking transactions.
Additional characters are truncated at 254

Example Response

{
    "SharedPaymentUrl": "https://secure-au.sandbox.ewaypayments.com/sharedpage/sharedpayment?AccessCode=A1001lxSbo1jj5E2ceq-9wu0CSmmvfxtafqw-lAYbtrY-JJ1nHDAiv1B9FNAhsHN6Lut2E-3nl8cQqaoEoYFqrgcBNQLsW8K_h-DfNl7KeST9kOvwnYJD-auC5Clk48RCY5fW",
    "AccessCode": "A1001lxSbo1jj5E2ceq-9wu0CSmmvfxtafqw-lAYbtrY-JJ1nHDAiv1B9FNAhsHN6Lut2E-3nl8cQqaoEoYFqrgcBNQLsW8K_h-DfNl7KeST9kOvwnYJD-auC5Clk48RCY5fW",
    "Customer": {
        "CardNumber": "",
        "CardStartMonth": "",
        "CardStartYear": "",
        "CardIssueNumber": "",
        "CardName": "",
        "CardExpiryMonth": "",
        "CardExpiryYear": "",
        "IsActive": false,
        "CardDetails": null,
        "TokenCustomerID": null,
        "Reference": "A12345",
        "Title": "Mr.",
        "FirstName": "John",
        "LastName": "Smith",
        "CompanyName": "Demo Shop 123",
        "JobDescription": "Developer",
        "Street1": "Level 5",
        "Street2": "369 Queen Street",
        "City": "Sydney",
        "State": "NSW",
        "PostalCode": "2000",
        "Country": "au",
        "Email": "demo@example.org",
        "Phone": "09 889 0986",
        "Mobile": "09 889 6542",
        "Comments": "This is a a comment",
        "Fax": "09 889 6542",
        "Url": "http://www.ewaypayments.com"
    },
    "Payment": {
        "TotalAmount": 1000,
        "InvoiceNumber": "Inv 21540",
        "InvoiceDescription": "Individual Invoice Description",
        "InvoiceReference": "513456",
        "CurrencyCode": "AUD"
    },
    "FormActionURL": "https://secure-au.sandbox.ewaypayments.com/AccessCode/A1001lxSbo1jj5E2ceq-9wu0CSmmvfxtafqw-lAYbtrY-JJ1nHDAiv1B9FNAhsHN6Lut2E-3nl8cQqaoEoYFqrgcBNQLsW8K_h-DfNl7KeST9kOvwnYJD-auC5Clk48RCY5fW",
    "CompleteCheckoutURL": null,
    "Errors": null
}
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CreateAccessCodeSharedResponse xmlns="https://api.ewaypayments.com/">
         <CreateAccessCodeSharedResult>
            <AccessCode>44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</AccessCode>
            <Customer>
               <TokenCustomerID xsi:nil="true"/>
               <Reference>A12345</Reference>
               <Title>Mr.</Title>
               <FirstName>John</FirstName>
               <LastName>Smith</LastName>
               <CompanyName>Demo Shop 123</CompanyName>
               <JobDescription>Developer</JobDescription>
               <Street1>Level 5</Street1>
               <Street2>369 Queen Street</Street2>
               <City>Sydney</City>
               <State>NSW</State>
               <PostalCode>2000</PostalCode>
               <Country>au</Country>
               <Email>demo@example.org</Email>
               <Phone>0289712345</Phone>
               <Mobile>0289712345</Mobile>
               <Comments>Customer comments</Comments>
               <Fax>0289712345</Fax>
               <Url>http://www.ewaypayments.com</Url>
               <CardNumber/>
               <CardStartMonth/>
               <CardStartYear/>
               <CardIssueNumber/>
               <CardName/>
               <CardExpiryMonth/>
               <CardExpiryYear/>
               <IsActive>false</IsActive>
            </Customer>
            <Payment>
               <TotalAmount>1000</TotalAmount>
               <InvoiceNumber>Inv 21540</InvoiceNumber>
               <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
               <InvoiceReference>Individual Invoice Description</InvoiceReference>
               <CurrencyCode>AUD</CurrencyCode>
            </Payment>
            <FormActionURL>https://secure-au.sandbox.ewaypayments.com/Process</FormActionURL>            <SharedPaymentUrl>https://secure-au.sandbox.ewaypayments.com/sharedpage/sharedpayment?AccessCode=44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</SharedPaymentUrl>
         </CreateAccessCodeSharedResult>
      </CreateAccessCodeSharedResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available $response properties

if (!$response->getErrors()) {
    // Redirect to the Responsive Shared Page
    header('Location: '.$response->SharedPaymentUrl);
    die();
} else {
    foreach ($response->getErrors() as $error) {
        echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
    }
}

// See the JSON tab for all the available response properties

if (response.getErrors().isEmpty()) {
    // Redirect the user to this location
    $redirectURL = response.getSharedPaymentUrl();
} else {
    for (String errorcode: response.getErrors()) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode, "en"));
    };
}
// See the JSON tab for all the available response properties

IRapidClient rapidClient = new RapidClient(httpClient);
if (response.Errors != null)
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
else
{
    Response.Redirect(response.SharedPaymentUrl);
}
// See the JSON tab for all the available response properties

.then(function (response) {
    if (response.getErrors().length == 0) {
        var redirectURL = response.get('SharedPaymentUrl');
    } else {
        response.getErrors().forEach(function(error) {
            console.log("Response Messages: " + rapid.getMessage(error, "en"));
        });
    }
})
.catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available response properties

if response.errors.empty?
  redirect_url = response.shared_payment_url
else
  response.errors.each { |e| puts "Response message: "+ EwayRapid::RapidClient.user_display_message(e) }
end

Response

The response received from Eway will contain the AccessCode that should be used for all further requests associated with this transaction.

The response will also contain the SharedPaymentUrl. This is the URL that you will need to redirect the customer to in order for them to provide their card details and complete the payment.

Depending on the Method being used for this request, some additional information will be returned in the response.

If processing a payment, the response will also include an echo of the payment information submitted in the request.

Response Fields Descriptions

Field Name Max Length Data Type Description
SharedPaymentUrl 512 String The URL to redirect the customer to enter their card details
AccessCode 512 String A unique AccessCode that is used to identify this transaction with the Rapid API. This code will need to be present for all future requests associated with this transaction
FormActionURL 512 string The URL that the form should be POSTed to if using Transparent Redirect.
Not used for the Iframe
CompleteCheckoutURL 512 string Depreciated. This field will return a null value
Errors 512 String A comma separated list of any errors encountered

Customer

Field Name Max Length Data Type Description
CardNumber 50 string The Token customer's masked credit card number
CardName 50 string The Token customer's card holder name
CardExpiryMonth 2 string The Token customer's card expiry month
CardExpiryYear 2 string The Token customer's card expiry year
CardStartMonth* 2 string The Token customer's card valid from month
CardStartYear* 2 string The Token customer's card valid from year
CardIssueNumber* 2 string The Token customer's card issue number
IsActive 5 boolean This is a boolean value indicating whether the Token customer is active
CardDetails string Currently unused. This will return a null value
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

*Applies to UK only

Payment

Field Name Max Length Data Type Description
TotalAmount 10 int The amount of the transaction in the lowest denomination, as passed in the original request.
e.g. $25.00 = 2500
InvoiceNumber 64 string Your invoice number for this transaction.
InvoiceDescription 64 string A description of the purchase that the customer is making.
InvoiceReference 50 string Your reference number for this transaction.
CurrencyCode 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used.

Step 2: Display the Eway Iframe

Example iframe display script

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"></script>
<script>

    /**
     * Eway Rapid IFrame config object. Contains the SharedPaymentUrl
     */
    var eWAYConfig = {
      sharedPaymentUrl: "<<SharedPaymentUrl Goes Here>>"
    };

    /**
     * Example Eway Rapid IFrame callback
     */
    function resultCallback(result, transactionID, errors) {
      if (result == "Complete") {
        alert("Payment complete! eWAY Transaction ID: " + transactionID);
      } else if (result == "Error") {
        alert("There was a problem completing the payment: " + errors);
      }
    }

</script>

<button type="button" onClick="eCrypt.showModalPayment(eWAYConfig, resultCallback);">Pay with eWAY</button>

Once the AccessCode has been received, the Rapid IFrame can be displayed to the customer. Displaying the iframe simply involves adding the Eway eCrypt library and a JavaScript call:

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"></script>

eCrypt.showModalPayment(eWAYConfig, resultCallback)

This call can be triggered in whatever way makes sense for your application: on a click of a button or even just when the page loads.

The showModalPayment function accepts two arguments:

Config

The Config object passes the following configuration information to the Iframe

Value Description
sharedPaymentUrl The SharedPaymentUrl returned from Eway in Step 1.

Note: The first version of Iframe required the variables endpoint and accessCode in the config. This will continue to work, except for UK merchants who must use sharedPaymentUrl.

Callback

The Callback function is called once the customer has completed the transaction in the Iframe, cancelled the Iframe or if there was an error loading the Iframe. The function should accept three arguments, which contain the following:

Argument Description
result Whether a transaction was processed. One of Complete, Cancel, or Error
transactionID The transaction ID if the transaction was completed
errors Any errors associated with displaying the Iframe

Note: Whether the transaction is approved or declined cannot be determined by the callback, you must request the results of the transaction as descrived in Step 3 to determine the transaction status. The result returned to the callback only describes if the Iframe could be shown.

Step 3: Request the Results

Once the customer has completed the payment, the callback will be invoked and you will need to request the results from Eway by calling the GetAccessCodeResult method of the API. This is done using the AccessCode requested in Step 1.

If CustomerReadOnly was set to false, the details the customer entered in the iframe can be fetched using Transaction Query.

Live Endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.ewaypayments.com/AccessCode/{AccessCode}
HTTP POST (XML) https://api.ewaypayments.com/GetAccessCodeResult.xml
HTTP POST (JSON) https://api.ewaypayments.com/GetAccessCodeResult.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox Endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.sandbox.ewaypayments.com/AccessCode/{AccessCode}
HTTP POST (XML) https://api.sandbox.ewaypayments.com/GetAccessCodeResult.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/GetAccessCodeResult.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Example request

curl --request GET \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    https://api.sandbox.ewaypayments.com/AccessCode/44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <GetAccessCodeResult xmlns="https://api.ewaypayments.com/">
         <request>
            <AccessCode>44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</AccessCode>
         </request>
      </GetAccessCodeResult>
   </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$response = $client->queryTransaction('44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2');
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

QueryTransactionResponse response = client.queryTransaction("44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2");
IRapidClient rapidClient = new RapidClient(httpClient);

QueryTransactionResponse response = await rapidClient.QueryTransaction("44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2");
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.queryTransaction("44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2")
.then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

response = client.query_transaction_by_access_code('44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2')

Request Field Descriptions

Field Name Field Type Max Length Data Type Description
AccessCode R 512 string The AccessCode that was appended to the RedirectURL

Field Types: R – Required

If a transaction has been processed, the response received from Eway will contain all relevant details such as the bank authorisation code and a unique number that identifies the transaction in Eway's database (TransactionID).

If a Token customer was involved, the Token ID that Eway uses to identify that customer will also be returned.

All responses will contain a Response Code and Response Message that represents the result of the action performed.

If applicable, the response will also contain information about the payment that has been processed, as well as the results of any Fraud risk analysis that was performed.

Example response

{
    "AccessCode": "44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2",
    "AuthorisationCode": "522587",
    "ResponseCode": "00",
    "ResponseMessage": "A2000",
    "InvoiceNumber": "Inv 21540",
    "InvoiceReference": "513456",
    "TotalAmount": 1000,
    "TransactionID": 11259580,
    "TransactionStatus": true,
    "TokenCustomerID": null,
    "BeagleScore": 0,
    "Options": [{
        "Value": "Option1"
    }, {
        "Value": "Option2"
    }],
    "Verification": {
        "CVN": 0,
        "Address": 0,
        "Email": 0,
        "Mobile": 0,
        "Phone": 0
    },
    "BeagleVerification": {
        "Email": 0,
        "Phone": 0
    },
    "Errors": null
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <GetAccessCodeResultResponse xmlns="https://api.ewaypayments.com/">
         <GetAccessCodeResultResult>
            <AccessCode>44DD7aVwPYUPemGRf7pcWxyX2FJS-0Wk7xr9iE7Vatk_5vJimEbHveGSqX52B00QsBXqbLh9mGZxMHcjThQ_ITsCZ3JxKOY88WOVsFTLPrGtHRkK0E9ZDVh_Wz326QZlNlwx2</AccessCode>
            <AuthorisationCode>522587</AuthorisationCode>
            <ResponseCode>00</ResponseCode>
            <ResponseMessage>A2000</ResponseMessage>
            <InvoiceNumber>Inv 21540</InvoiceNumber>
            <InvoiceReference>513456</InvoiceReference>
            <TotalAmount>1000</TotalAmount>
            <TransactionID>11259580</TransactionID>
            <TransactionStatus>true</TransactionStatus>
            <TokenCustomerID xsi:nil="true"/>
            <BeagleScore>0</BeagleScore>
            <Options>
               <Option>
                  <Value>Option1</Value>
               </Option>
               <Option>
                  <Value>Option2</Value>
               </Option>
            </Options>
            <Verification>
               <CVN>Unchecked</CVN>
               <Address>Unchecked</Address>
               <Email>Unchecked</Email>
               <Mobile>Unchecked</Mobile>
               <Phone>Unchecked</Phone>
            </Verification>
            <BeagleVerification>
               <Email>NotVerified</Email>
               <Phone>NotVerified</Phone>
            </BeagleVerification>
         </GetAccessCodeResultResult>
      </GetAccessCodeResultResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available properties

$transactionResponse = $response->Transactions[0];

if ($transactionResponse->TransactionStatus) {
    echo 'Payment successful! ID: '.$transactionResponse->TransactionID;
} else {
    $errors = explode(',', $transactionResponse->ResponseMessage);
    foreach ($errors as $error) {
        echo "Payment failed: ".\Eway\Rapid::getMessage(trim($error))."<br>";
    }
}

// See the JSON tab for all the available properties

if (response.getTransactionStatus().isStatus()) {
    System.out.println("Payment successful! ID: " + response.getTransactionStatus().getTransactionID());
} else {
    String[] errorcodes = response.getTransactionStatus().getProcessingDetails().getResponseMessage().split(",");
    for (String errorcode: errorcodes) {
        System.out.println("Response Messages: " + RapidSDK.userDisplayMessage(errorcode.trim(), "en"));
    }
}
// See the JSON tab for all the available properties

IRapidClient rapidClient = new RapidClient(httpClient);
if ((bool)response.TransactionStatus)
{
    Console.WriteLine("Payment successful! ID: " + response.TransactionID);
}
else
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
// See the JSON tab for all the available properties

.then(function (response) {
    if (response.get('Transactions[0].TransactionStatus')) {
        console.log('Payment successful! ID: ' + response.get('Transactions[0].TransactionID'));
    } else {
        var errorCodes = response.get('Transactions[0].ResponseMessage').split(', ');
        errorCodes.forEach(function(errorCode) {
            console.log("Response Message: " + rapid.getMessage(errorCode, "en"));
        });
    }
}).catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});

if response.transaction_status.status?
  puts "Payment successful! ID: #{response.transaction_status.transaction_id.to_s}"
else
  puts "Failed! Message #{response.transaction_status.processing_details.response_message}"
end

Response Field Descriptions

Field Name Max Length Data Type Description
AccessCode 512 string An echo of the AccessCode used in the request
AuthorisationCode 6 string The authorisation code for this transaction as returned by the bank
ResponseCode 2 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result if the action performed.
If a Fraud Essentials rule is triggered, this may contain multiple codes: eg. D4405, F7003
InvoiceNumber 64 string An echo of the merchant's invoice number for this transaction
InvoiceReference 64 string An echo of the merchant's reference number for this transaction
TotalAmount 10 int The amount that was authorised for this transaction
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
TransactionStatus 16 boolean A Boolean value that indicates whether the transaction was successful or not
TokenCustomerID 16 long An Eway-issued ID that represents the Token customer that was loaded or created for this transaction (if applicable)
BeagleScore 6 string A Fraud Lite score representing the estimated probability that the order is fraudulent. A value between 0.01 and 100.00 representing the likelihood that the transaction is fradulent, wih 0.01 being the lowest and 100.00 being the highest.
In the Sandbox environment the score will always be returned as -1 unless you have configured your Sandbox to fail for Risk Score, in which case the value will be 101.
This field is only returned when using Fraud Lite
Options N/A object An echo of the options collection passed in the CreateAccessCode request
Verification N/A object This set of fields is currently unused
BaegleVerification N/A object This will contain the results of the Fraud Verification identification checks that may have been performed
PaymentInstrument N/A object This set of fields contains the details of the payment instrument used for the transaction
Customer N/A object This set of fields contains the details of the customer making the payment
Errors 512 string A comma separated list of any error encountered. These can be looked up in the Response and Error Codes section.

Options

The Options collection passed in the original request will be echoed back in the response here.

Field Name Max Length Data Type Description
Value 255 string An echo of the option submitted for this transaction

Verification

These fields are currently unused

Field Name Max Length Data Type Description
CVN 10 string This field is not currently used
Address 10 string This field is not currently used
Email 10 string This field is not currently used
Mobile 10 string This field is not currently used
Phone 10 string This field is not currently used

BeagleVerification

This will contain the results of the Fraud Verification identification checks that may have been performed. These options are only active when using the Responsive Shared Page.

When using the REST API, a number will be returned which maps as follows:

0 = NotVerified
1 = Attempted
2 = Verified
3 = Failed

Field Name Max Length Data Type Description
Email 11 string The result of the email verification
Phone 11 string The result of the phone verification

PaymentInstrument

This set of fields contains the details of the payment instrument used for the transaction.

Field Name Max Length Data Type Description
ThreeDSecureAuth N/A object This set of fields contains the 3D Secure verification results
PaymentType 10 string The payment method used for the transaction.
eg. CreditCard or ApplePay

ThreeDSecureAuth

This set of fields contains the 3D Secure verification results.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0

Customer

Field Name Max Length Data Type Description
CardDetails N/A object This set of fields contains the details of the card used for the payment
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

Card Details

The card details section is within the Customer section.

Field Name Max Length Data Type Description
Name 50 string An echo of the name of the card holder
Number 50 int A masked echo of the card number
ExpiryMonth 2 int An echo of the month that the card expires
ExpiryYear 2 int An echo of the year that the card expires
StartMonth* 2 int An echo of the month that the card is valid from
StartYear* 2 int An echo of the year that the card is valid from
IssueNumber* int An echo of the card's issue number

*Applies to UK only

Secure Fields

Eway's Secure Fields solution provides the flexibility of a form that appears entirely on your site, with fields that are hosted securely by Eway. This is done by using JavaScript to replace specified divs with iframes which consist only of the input text field.

Since the payment form is displayed on your site, it is important that SSL is used to secure the page and provide reassurance to customers.

Implementing Eway's Secure Fields requires:

  1. Using JavaScript and HTML to add the Secure Fields to the website
  2. Passing the secureFieldCode using the Direct Connection API to complete the transaction

Configuring Secure Fields

<script type="text/javascript">
    var publicApiKey = "epk-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";
    var fieldStyles = "line-height: 1; height: 28px; border: 1px solid #AAA; color: #000; padding: 2px;";

    var nameFieldConfig = {
            publicApiKey: publicApiKey,
            fieldDivId: "eway-secure-field-name",
            fieldType: "name",
            styles: fieldStyles
        };
    var cardFieldConfig = {
            publicApiKey: publicApiKey,
            fieldDivId: "eway-secure-field-card",
            fieldType: "card",
            styles: fieldStyles
        };
    var expiryFieldConfig = {
            publicApiKey: publicApiKey,
            fieldDivId: "eway-secure-field-expiry",
            fieldType: "expiry",
            styles: fieldStyles
        };
    var cvnFieldConfig = {
            publicApiKey: publicApiKey,
            fieldDivId: "eway-secure-field-cvn",
            fieldType: "cvn",
            styles: fieldStyles
        };
</script>

<form method="POST" action="/createTransaction" id="payment_form">
    Card Name: <div id="eway-secure-field-name"></div><br>
    Card Number: <div id="eway-secure-field-card"></div><br>
    Card Expiry: <div id="eway-secure-field-expiry"></div><br>
    Card CVN: <div id="eway-secure-field-cvn"></div><br><br>
    <input type="hidden" id="securefieldcode" name="SecuredCardData" value="" />
    <input type="submit" value="Process" text="Process" />    
</form>   

Step 1: Configure the Fields

Each Secure Field requires a config that tells Eway what field to display and how it should look. This is done with a JavaScript object, which accepts the following values:

*denotes a required field

Each field requires a corresponding <div> with the id defined in the configuration. A height style is recommended for the divs to restrict their size.

There are two options to display expiry date controls. expiry which displays two drop down list boxes for month and year, and expirytext which displays a single text box.

Creating a Secure Fields callback

<script type="text/javascript">
    function secureFieldCallback(event) {
        if (!event.fieldValid) {
            alert(event.errors);
        } else {
            // set the hidden Secure Field Code field
            var s = document.getElementById("securefieldcode");
            s.value = event.secureFieldCode
        }
    }
</script>

Step 2: Create a Callback

The Secure Fields will return data via a JavaScript callback function. This data contains the secureFieldCode to process the transaction, along with useful details such as validation and error states. The function should accept one parameter, which contains the following values:

Note that this callback is called each time the associated Secure Field is updated or focus is lost.

Initialising Secure Fields

<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>

<script type="text/javascript">
    window.onload = function () {
        eWAY.setupSecureField(nameFieldConfig, secureFieldCallback);
        eWAY.setupSecureField(cardFieldConfig, secureFieldCallback);
        eWAY.setupSecureField(expiryFieldConfig, secureFieldCallback);
        eWAY.setupSecureField(cvnFieldConfig, secureFieldCallback);
    };
</script>

Step 3: Initialise the Secure Fields

To initialise the Secure Fields, first the eWAY.js JavaScript needs to be included:

<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>

Then each field should be initialised using the function eWAY.setupSecureField(). This accepts two parameters: A configuration object and a callback function.

When the page is loaded, the Secure Fields will be loaded into the specified divs. The secureFieldCode returned in the callback function should be submitted with any other data being captured on the page when the customer submits the payment form.

Basic Direct Connection Request for Secure Fields

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Payment": {
           "TotalAmount": 1000
        },
        "Method": "ProcessPayment",
        "TransactionType": "Purchase",
        "SecuredCardData": "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw="
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <Method>ProcessPayment</Method>
                <TransactionType>Purchase</TransactionType>
                <SecuredCardData>44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=</SecuredCardData>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Payment' => [
        'TotalAmount' => 1000,
    ],
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'SecuredCardData' => '44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=',
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

transaction.setPaymentDetails(paymentDetails);
transaction.setTransactionType(TransactionType.Purchase);
transaction.setSecuredCardData("44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=");

CreateTransactionResponse response = client.create(PaymentMethod.Direct, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

DirectPaymentRequest transaction = new DirectPaymentRequest()
{
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    TransactionType = TransactionTypes.Purchase,
    SecuredCardData = "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw="
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.DIRECT, {
    "Payment": {
       "TotalAmount": 1000
    },
    "TransactionType": "Purchase",
    "SecuredCardData": "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw="
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details

transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE
transaction.secured_card_data = '44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw='

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)

Step 4: Process the Transaction with Direct Connection

Once the form has been submitted and the secureFieldCode has been passed to your server, a transaction can be processed by calling the Direct Connection API.

This works the same as a standard Direct Connection request, however instead of using CardDetails, the secureFieldCode should be passed in the SecuredCardData field. You can either complete a payment or create a Token customer with this data. Refer to Direct Connection for a full list of available request parameters.

Note: the secureFieldCode is only valid for a single use, and only for a limited time from when it's created. If the Direct Connection API returns a V6148 Error, this indicates that the secureFieldCode has expired.

Secure Panel

Configuring Secure Panel

<script type="text/javascript">
var cardStyles = "padding: 2px; border: 1px solid #AAA; height: 34px; width: 100%;";
var labelStyles = "padding-right: 20px; float: right;";
var publicApiKey = "epk-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";

var groupFieldConfig = {
        publicApiKey: publicApiKey,
        fieldDivId: "eway-secure-panel",
        fieldType: "group",
        layout : {
            fonts: [ "Lobster"],
            rows : [ {
                        cells:  [ {
                                    label: { text: "Card Name:", styles: "font-family: Lobster" },
                                    field: { fieldType: "name", styles: cardStyles, autocomplete: "true" }
                                  }, {
                                    label: { text: "Card Number:", styles: labelStyles },
                                    field: { fieldType: "card", styles: cardStyles, autocomplete: "true" }
                                  }
                        ],
                     },
                     {
                        cells:  [ {
                                    label: { text: "Expiry:", styles: labelStyles },
                                    field: { fieldType: "expirytext", styles: cardStyles, autocomplete: "true" }
                                  }, {
                                    label: { text: "CVV Number:", styles: labelStyles },
                                    field: { fieldType: "cvn", styles: cardStyles, autocomplete: "true" }
                                  }
                        ]
                     }
            ]
        }
    };
</script>

<h1> This is a simple page demonstrating Eway Secure Panel</h1>
<form method="POST" action="/createTransaction" id="payment_form">
    <div id="eway-secure-panel" style="width: 50%;"></div><br><br>
    <input type="hidden" id="securefieldcode" name="SecuredCardData" value="" />
    <input id="Submit" type="submit" value="Process" text="Process" onclick="return saveAndSubmit();" />    
</form>   

Eway's Secure Panel solution provides the flexibility of a form that appears entirely on the merchant's site, but where the credit card fields are hosted securely by Eway. Like Eway's Secure Fields this is done by using JavaScript to replace a specified div with a single iframe which contains the credit card fields.

Because all credit card controls reside in the same iframe, cardholders can use the secure autofill facilities of modern browsers to populate all the card fields with a single click. To take advantage of autofill, it is a requirement that SSL is used to secure the page and provide reassurance to customers. Autofilling forms and credit cards will help increase your basket conversion.

Even though the contents of the iframe are hosted on Eway's secure servers, your site can provide layout and styling so that the Secure Panel merges seamlessly with the containing page.

Implementing Eway's Secure Panel requires:

  1. Using JavaScript and HTML to add the Secure Panel to the website
  2. Passing the secureFieldCode using the Direct Connection API to complete the transaction

A page that already uses Secure Fields can be easily converted to use a Secure Panel with some small HTML, JavaScript, and additional layout information.

Step 1: Configure the Panel

The Secure Panel requires a config that tells Eway what fields to display and how they should look. This is done with a JavaScript object, which accepts the following values:

*denotes a required field

A Secure Panel requires a corresponding <div> with the id defined in the configuration. Unlike Secure Fields a height style is not required as the div will resize as required to display it's contents.

Creating the Secure Panel callback

<script type="text/javascript">
function securePanelCallback(event) {
    if (!event.fieldValid) {
        alert(event.errors);
    } else {
        // set the hidden Secure Field Code field
        var s = document.getElementById("securefieldcode");
        s.value = event.secureFieldCode
    }
}

function doneCallback() {
        var form = document.getElementById("payment_form");
        form.submit();
}

function saveAndSubmit() {
    eWAY.saveAllFields(doneCallback, 2000);
    return false;
}
</script>

Step 2: Create a Callback

The Secure Panel will return data via a JavaScript callback function. This data contains the secureFieldCode to process the transaction, along with useful details such as validation and error states. The function should accept one parameter, which contains the following values:

Note that this callback is called each time the Secure Panel is updated or focus is lost. However it is always a good idea to also call the eWAY.saveAllFields client side API to ensure all field data has been submitted to Eway's servers before processing a form.

Initialising Secure Panel

<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>

<script type="text/javascript">
    window.onload = function() {
        // Setup the field, will create iframe load, and hook in the callback
        eWAY.setupSecureField(groupFieldConfig, securePanelCallback);
    };
</script>

Step 3: Initialise the Secure Panel

To initialise the Secure Panel, first the eWAY.js JavaScript needs to be included:

<script src="https://secure.ewaypayments.com/scripts/eWAY.min.js" data-init="false"></script>

Then the Secure Panel should be initialised using the function eWAY.setupSecureField(). This accepts two parameters: A configuration object and a callback function.

When the page is loaded, the Secure Panel will be loaded into the specified div. The secureFieldCode returned in the callback function should be submitted with any other data being captured on the page when the customer submits the payment form.

Basic Direct Connection Request for Secure Panel

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Payment": {
           "TotalAmount": 1000
        },
        "Method": "ProcessPayment",
        "TransactionType": "Purchase",
        "SecuredCardData": "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw="
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <Method>ProcessPayment</Method>
                <TransactionType>Purchase</TransactionType>
                <SecuredCardData>44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=</SecuredCardData>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Payment' => [
        'TotalAmount' => 1000,
    ],
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::PURCHASE,
    'SecuredCardData' => '44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=',
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

transaction.setPaymentDetails(paymentDetails);
transaction.setTransactionType(TransactionType.Purchase);
transaction.setSecuredCardData("44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=");

CreateTransactionResponse response = client.create(PaymentMethod.Direct, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

DirectPaymentRequest transaction = new DirectPaymentRequest()
{
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    TransactionType = TransactionTypes.Purchase,
    SecuredCardData = "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw="
};

var response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.DIRECT, {
    "Payment": {
       "TotalAmount": 1000
    },
    "TransactionType": "Purchase",
    "SecuredCardData": "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw="
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details

transaction.transaction_type = EwayRapid::Enums::TransactionType::PURCHASE
transaction.secured_card_data = '44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw='

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)

Step 4: Process the Transaction with Direct Connection

Once the form has been submitted and the secureFieldCode has been passed to your server, a transaction can be processed by calling the Direct Connection API.

This works the same as a standard Direct Connection request, however instead of using CardDetails, the secureFieldCode should be passed in the SecuredCardData field. You can either complete a payment or create a Token customer with this data. Refer to Direct Connection for a full list of available request parameters.

Note: the secureFieldCode is only valid for a single use, and only for a limited time from when it's created. If the Direct Connection API returns a V6148 Error, this indicates that the secureFieldCode has expired.

Customised Secure Panel Layout

<script type="text/javascript">
var cardStyles = "padding: 2px; border: 1px solid #AAA; border-radius: 3px; height: 34px; width: 100%; font-family:Quattrocento+Sans;";
var rowStyles = "";
var groupStyles = "";
var publicApiKey = "epk-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX";

var groupFieldConfig = {
        publicApiKey: publicApiKey,
        fieldDivId: "eway-secure-panel",
        fieldType: "group",
        styles: groupStyles,
        layout : {
            fonts: [
                "Quattrocento+Sans:400,700,400italic",
                "Lobster"
             ],
            rows : [
                {
                    styles: rowStyles,
                    cells: [
                        {
                            colSpan: 12,
                            styles: "margin-top: 15px;",
                            label: {
                                fieldColSpan: 4,
                                text: "Card Name:",
                                styles: "font-family: Lobster;",
                            },
                            field: {
                                fieldColSpan: 8,
                                fieldType: "name",
                                styles: cardStyles,
                                divStyles: "padding-left: 10px;"
                            }
                        },
                        {
                            colSpan: 12,
                            styles: "margin-top: 15px;",
                            label: {
                                fieldColSpan: 4,
                                text: "Expiry:",
                                styles: "",
                            },
                            field: {
                                fieldColSpan: 8,
                                fieldType: "expirytext",
                                styles: cardStyles,
                                divStyles: "padding-left: 10px;"
                            }
                        }
                    ]
                },
                {
                    styles: rowStyles,
                    cells: [
                        {
                            colSpan: 12,
                            styles: "margin-top: 15px;",
                            label: {
                                fieldColSpan: 4,
                                text: "Card Number:",
                                styles: "",
                            },
                            field: {
                                fieldColSpan: 8,
                                fieldType: "card",
                                styles: cardStyles,
                            }
                        },
                        {
                            colSpan: 12,
                            styles: "margin-top: 15px;",
                            label: {
                                fieldColSpan: 4,
                                text: "CVV Number:",
                                styles: "",
                            },
                            field: {
                                fieldColSpan: 8,
                                fieldType: "cvn",
                                styles: cardStyles,
                            }
                        }
                    ]
                }
            ]
        }
    };

</script>

Step 5: Customise Secure Panel Layout

A Secure Panel can be constructed from any combination of Secure Fields that can be displayed in any order. How the fields and their respective labels are displayed is defined using the layout value in the Secure Panel definition.

The layout value is a JSON object with a structure defined below. It describes which fields and labels are to appear in the iframe, using a row/column structure. You can use colSpan values to control the spacing, and additionally you're able to specify style elements for each field control, label, the containing divs for each, and the overall containing divs.

The HTML generated from the layout is a Bootstrap style responsive layout using divs and CSS. Spacing for each element in a row, and for the spacing of each label/field is controlled using colSpan values of 1-12. At iframe widths of 480 pixels or less, each element stacks (i.e. consumes all 12 of the available columns).

Default values are provided for simple layouts which evenly space each label/field pair in a row. Style properties can be set on each element and containing div, allowing precise spacing to match existing grids. In general, use of padding on containing divs is the best approach to achieve a specific alignment as that ensures that iFrame scrollbars will not occur.

layout object definition

row object definition

Each row object in a layout's 'rows' array describes a single row consisting of multiple cells. It also contains style values to apply to the containing div for the row. It contains following values:

cell object definition

Each cell object in the cells array describes a single secure field, and its label along with style and spacing properties. It contains the following values:

label object definition

Describes the label that is attached to the field. It contains following values:

field object definition

Describes a secure field to be displayed. Properties are as per the existing Secure Fields documentation. It contains following values:

Pay Now button

Payments made even easier!

Now you can let your customers purchase from your website with a Pre-Coded Pay Now Button.

We have already done the work for you - we give you the HTML, and all you need to do is copy and paste it onto your site. Your customers will then be able to click the Pay Now Button with the purchase amount displayed, and pay you using Visa, MasterCard, AMEX, or Diners Club, without leaving your site!

Browser Support

The Pay Now Button supports all modern web browsers.

Getting Started

Start using the Eway Pay Now Button in 3 easy steps:

1. Get the button code

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"
  class="eway-paynow-button"
  data-publicapikey="XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  data-amount="1000"
  data-currency="AUD" >
</script>

2. Add the Button to your website

Select the pages across your website that you would like to place the Pay Now Button.

All you need to do is paste the HTML code that you received in Step 1 on the desired web pages and edit the data-amount field to change the amount that is hardcoded on the button (remember, the amount is in cents, so for $10.00 use 1000).

Your customers are now able to click the Pay Now button on your website to make a payment to you.

3. Start receiving payments

Once your customers have clicked the Pay Now Button, a secure payment window will then slide down on your website, allowing the customer to enter their credit card details and click Pay.

Your customer will get an almost immediate response confirming the payment has been processed. To check the status of the payment, you can log in to MyEway or use the server side code to perform a Transaction Query

Configuration Attributes

Change the button text
You can add the data-label attribute to the script to change the text on the button:

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"
 class="eway-paynow-button"
 data-publicapikey="XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
 data-amount="100"
 data-label="Buy me now!"
 data-currency="AUD" >
</script>

Change the colours
You can change the colours of the button using the data-buttoncolor attributes

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"
  class="eway-paynow-button"
  data-publicapikey="XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  data-amount="500"
  data-currency="AUD"
  data-buttoncolor="#d9edf7"
  data-buttonerrorcolor="#f2dede"
  data-buttonprocessedcolor="#dff0d8"
  data-buttondisabledcolor="#f5f5f5"
  data-buttontextcolor="#000000" >
</script>

Add some extra detail to the transaction
You can set fields to pass extra details with the transaction such as invoice description, invoice reference, customer number and customer email. The customer fields can also be made editable with the data-allowedit attribute.

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"
  class="eway-paynow-button"
  data-publicapikey="XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  data-amount="500"
  data-currency="AUD"
  data-invoiceref="INV-001"
  data-invoicedescription="Coffee coffee"
  data-email="caffinate@eway.com.au"
  data-phone="1800 10 65 65"
  data-allowedit="true" >
</script>

Redirect on payment
Once a payment has been completed, the page can be set to redirect using data-resulturl. The redirected page will have the AccessCode added as a URL parameter so the transaction can be looked up using the Transaction Query API.

<script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"
  class="eway-paynow-button"
  data-publicapikey="XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
  data-amount="500"
  data-currency="AUD"
  data-resulturl="http://www.eway.com.au/shared-demo/results.aspx" >
</script>

Form submission
If the button is placed in a form, then by setting the data-submitform attribute to yes the form will automatically submit once the transaction is complete. The AccessCode will be added as a hidden form field with the name "EWAY_ACCESSCODE"

<form action="?" method="POST">
  Name: <input type="text" name="customer_name" value="" />

  <script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"
    class="eway-paynow-button"
    data-publicapikey="XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
    data-amount="500"
    data-currency="AUD"
    data-submitform="yes" >
  </script>

</form>

The Pay Now Button can be customised to change the colour of the button, as well as the text that it displays. You can also configure a redirect to occur after the payment has been made, which will allow you to obtain the AccessCode for the transaction so that you can look up the results of the payment using the Transaction Query API.

See the below table for the full list of configuration attributes.

Attribute Required/Type/Default Purpose,Example
data-amount required, numeric The transaction amount in cents value. e.g. 1000 = $10.00
data-publicapikey required, string The Public API Key from your MyEway account
data-currency string, Defaults to merchant's currency. Required if merchant accepts multicurrency The currency the transaction will be processed in "AUD", "NZD", etc
data-invoiceref optional, string, empty This value will be set as the Invoice Reference when creating the transaction.
data-invoicedescription optional, string, empty This value will be set as the Invoice Description when creating the transaction
data-email optional, string, empty Sets the cardholder's email. May be overridden by the cardholder in the modal payment page if data-allowedit is "true"
data-phone optional, string, empty Sets the cardholder's phone number. May be overridden by the cardholder in the modal payment page if data-allowedit is "true"
data-allowedit optional, string, "false" Enables the cardholder to edit phone and email in the payment page if value is set to true
data-resulturl optional, string, empty If supplied, and a valid URL, when the payment is complete the browser will be redirected to this URL
data-label optional, string, empty This is used to specify the label on the Pay Now Button. This can be any text, but if it does not contain the amount placeholder"#amount#", then the amount of the transaction will be appended to the button text. e.g. "Buy me a coffee for #amount#"
data-submitform optional, string, "yes" When set to yes and if the script is inside a form, then when the payment is complete the EWAY_ACCESSCODE hidden field will be added to the form and the form will be posted to the server
data-buttoncolor optional, string, empty You can pass an HTML Colour Code to change the colour of the button. This overrides the default styling
data-buttonerrorcolor optional, string, empty You can pass an HTML Colour Code to change the colour of the button when it is in an error state. This overrides the default styling
data-buttonprocessedcolor optional, string, empty You can pass an HTML Colour Code to change the colour of the button when it's in a processed state. This overrides the default styling
data-buttondisabledcolor optional, string, empty You can pass an HTML Colour Code to change the colour of the button when it's in a disabled state. This overrides the default styling
data-buttontextcolor optional, string, empty You can pass an HTML Colour Code to changethe colour of the button text. This overrides the default styling

Pre-Auths

Eway's Pre-authorisation solution allows you to reserve funds on a customer's card without charging it immediately. This allows you to confirm the transaction at you convenience and capture it at a later date via MyEway or through the API. This service is perfect for merchants whose prices are dependent on variable costs.

Authorising a Payment

To authorise a payment, you use the same process flow as submitting a normal transaction to the API through your preferred Conection Method with the only difference being that you set the Method set Authorise.

When using an Eway Rapid SDK, setting the Capture property on the transaction to false will perform an authorisation.

Remember to store the Transaction ID so that you can Capture or Cancel the payment!

Example Authorisation Request

IRapidClient rapidClient = new RapidClient(httpClient);

DirectPaymentRequest request = new DirectPaymentRequest{
    Customer = new DirectTokenCustomer()
    {
        TokenCustomerID = 321321321,
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org",
        CardDetails = new CardDetails()
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "11",
            ExpiryYear = "25",
            StartMonth = "01",
            StartYear = "13",
            IssueNumber = "01",
            CVN = "123"
        }
    },
    ShippingAddress = new ShippingAddress()
    {
        FirstName = "John",
        LastName = "Smith",
        Phone = "09 889 0986",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Mobile = "09 889 6542",
        Email = "demo@example.org",
        ShippingMethod = "NextDay"
    },
    Items = new[]
    {
        new LineItem()
        {
            SKU = "12345678901234567890",
            Description = "Item Description 1",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        },
        new LineItem()
        {
            SKU = "123456789012",
            Description = "Item Description 2",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        }
    }.ToList(),
    Options = new List<Option>
    {
        new Option{ Value = "Option1" },
        new Option{ Value = "Option2" }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000,
        InvoiceNumber = "Inv 21540",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceReference = "513456",
        CurrencyCode = "AUD"
    },
    RedirectUrl = "http://www.eway.com.au",
    DeviceID = "D1234",
    PartnerID = "ID",
    CustomerIP = "127.0.0.1",
    TransactionType = TransactionTypes.Purchase
};

var response = await rapidClient.CreateTransaction(request);

Capturing a Payment

Once a payment has been authorised, the transaction can be completed with a Capture request

Live endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/CapturePayment

Sandbox endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/CapturePayment

Request Field Descriptions

Example Capture Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
          "Payment": {
             "TotalAmount": 1000,
             "InvoiceNumber": "Inv 4444",
             "InvoiceDescription": "Individual Invoice Description",
             "InvoiceReference": "513456",
             "CurrencyCode": "AUD"
          },
          "TransactionId": 11260833
        }' \
    https://api.sandbox.ewaypayments.com/CapturePayment
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <CapturePayment xmlns="https://api.ewaypayments.com/">
         <request>
            <TransactionID>11260833</TransactionID>
            <Payment>
               <TotalAmount>1000</TotalAmount>
               <InvoiceNumber>Inv 4444</InvoiceNumber>
               <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
               <InvoiceReference>513456</InvoiceReference>
               <CurrencyCode>AUD</CurrencyCode>
            </Payment>
         </request>
      </CapturePayment>
   </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Payment' => [
        'TotalAmount' => 1000,
    ],
    'TransactionID' => 11260833,
];


$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::AUTHORISATION, $transaction);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);

Transaction transaction = new Transaction();
transaction.setPaymentDetails(paymentDetails);
transaction.setAuthTransactionID(11260833);

CreateTransactionResponse response = client.create(PaymentMethod.Authorisation, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

CaptureAuthorisationRequest capture = new CaptureAuthorisationRequest()
{
    TransactionID = 11260833,
    Payment = new Payment()
    {
        TotalAmount = 1000,
        CurrencyCode = "AUD",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceNumber = "Inv 21540",
        InvoiceReference = "513456",
    }
};

var response = await rapidClient.CaptureAuthorisation(capture);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.AUTHORISATION, {
    "Payment": {
        "TotalAmount": 1000,
    },
    "TransactionId": 11260833
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new
transaction.auth_transaction_id = 11260833

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::AUTHORISATION, transaction)
Field Name Field Type Max Length Data Type Description
TransactionId R 10 int The Transaction ID of the Authorisation you want to capture

Payment

This set of fields contains the details of the payment being processed.

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount to capture in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
Note: Only amounts up to the original authorisation can be captured. Capturing less than 85% of the authorised amount may result in a separate charge on the customer's card
InvoiceNumber O 64 string Your invoice number for this transaction
InvoiceDescription O 64 string A description of the payment that the customer is making
InvoiceReference O 50 string Your own reference number for this transaction
CurrencyCode O 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.g. Australian Dollars = AUD

Field types: R – Required, C – Conditionally Required, O – Optional

Response

Example response

{
    "ResponseCode": "399854",
    "ResponseMessage": "399854",
    "TransactionID": 11260840,
    "TransactionStatus": true,
    "Errors": null
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CapturePaymentResponse xmlns="https://api.ewaypayments.com/">
         <CapturePaymentResult>
            <ResponseCode>399854</ResponseCode>
            <ResponseMessage>399854</ResponseMessage>
            <TransactionID>11260840</TransactionID>
            <TransactionStatus>true</TransactionStatus>
         </CapturePaymentResult>
      </CapturePaymentResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available $response properties

if ($response->TransactionStatus) {
    echo 'Payment successful! ID: '.$response->TransactionID;
} else {
    if ($response->getErrors()) {
        foreach ($response->getErrors() as $error) {
            echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
        }
    } else {
        echo 'Sorry, your payment was declined';
    }
}

// See the JSON tab for all the available response properties

if (response.getTransactionStatus().isStatus()) {
    System.out.println("Payment successful! ID: " + response.getTransactionStatus().getTransactionID());
} else {
    if (!response.getErrors().isEmpty()) {
        for (String errorcode: response.getErrors()) {
            System.out.println("Error Messages: " + RapidSDK.userDisplayMessage(errorcode, "en"));
        }
    } else {
        System.out.println("Sorry, your payment failed");
    }
}

// See the JSON tab for all the available response properties

if ((bool)response.TransactionStatus)
{
    Console.WriteLine("Capture successful! ID: " + response.TransactionID);
}
else
{    
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
.then(function (response) {
    if (response.get('TransactionStatus')) {
        console.log('Payment successful! ID: ' + response.get('TransactionID'));
    } else {
        var errorCodes = response.get('ResponseMessage').split(', ');
        errorCodes.forEach(function(errorCode) {
            console.log("Response Message: " + rapid.getMessage(errorCode, "en"));
        });
    }
})
.catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available response properties

if response.errors.empty?
  if response.transaction_status.status?
    puts "Payment successful! ID: #{response.transaction_status.transaction_id}"
  else
    puts "Response Message: #{response.transaction_status.processing_details.response_message}"
  end
else
  response.errors.each { |e| puts "Response message: "+ EwayRapid::RapidClient.user_display_message(e) }
end

The response from Eway will contain details as to whether the Capture succeeded or failed.

Response Field Descriptions

Field Name Max Length Data Type Description
ResponseCode 512 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result of the action performed
TransactionStatus boolean A boolean value indicating whether or not the capture succeeded
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
Errors 255 string The error codes of any errors that occurred with the Capture, these can be looked up in the Response and Error Codes section.

Cancelling an Authorisation

Live endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/CancelAuthorisation

Sandbox endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/CancelAuthorisation

Request Field Descriptions

Example Cancel Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
          "TransactionId": 11260833
        }' \
    https://api.sandbox.ewaypayments.com/CancelAuthorisation
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <CancelAuthorisation xmlns="https://api.ewaypayments.com/">
         <request>
            <TransactionID>11260833</TransactionID>
         </request>
      </CancelAuthorisation>
   </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$response = $client->cancelTransaction(11260833);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Refund refund = new Refund();

RefundDetails refundDetails = new RefundDetails();
refundDetails.setOriginalTransactionID("11260833");
refund.setRefundDetails(refundDetails);

RefundResponse response = client.cancel(refund);
IRapidClient rapidClient = new RapidClient(httpClient);

CancelAuthorisationRequest cancel = new CancelAuthorisationRequest()
{
    TransactionID = 11260833
};

var response = await rapidClient.CancelAuthorisation(cancel);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.cancelTransaction("11260833")
.then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

refund = EwayRapid::Models::Refund.new

refund_details = EwayRapid::InternalModels::RefundDetails.new
refund_details.original_transaction_id = 11260833
refund.refund_details = refund_details

response = client.cancel(refund)

Field Name Field Type Max Length Data Type Description
TransactionId R 10 int The Transaction ID of the Authorisation you want to cancel

Response

Example response

{
    "ResponseCode": "720432",
    "ResponseMessage": "720432",
    "TransactionID": 11260941,
    "TransactionStatus": true,
    "Errors": null
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <CancelAuthorisationResponse xmlns="https://api.ewaypayments.com/">
         <CancelAuthorisationResult>
            <ResponseCode>720432</ResponseCode>
            <ResponseMessage>720432</ResponseMessage>
            <TransactionID>11260941</TransactionID>
            <TransactionStatus>true</TransactionStatus>
         </CancelAuthorisationResult>
      </CancelAuthorisationResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available $response properties

if ($response->TransactionStatus) {
    echo 'Cancel authorisation successful! ID: '.$response->TransactionID;
} else {
    if ($response->getErrors()) {
        foreach ($response->getErrors() as $error) {
            echo "Error: ".\Eway\Rapid::getMessage($error)."<br>";
        }
    } else {
        echo 'Sorry, your cancellation was declined';
    }
}

// See the JSON tab for all the available response properties

if (response.getTransactionStatus().isStatus()) {
    System.out.println("Cancel authorisation successful! ID: " + response.getTransactionStatus().getTransactionID());
} else {
    if (!response.getErrors().isEmpty()) {
        for (String errorcode: response.getErrors()) {
            System.out.println("Error Messages: " + RapidSDK.userDisplayMessage(errorcode, "en"));
        }
    } else {
        System.out.println("Sorry, your cancellation failed");
    }
}
// See the JSON tab for all the available response properties

if ((bool)response.TransactionStatus)
{
    Console.WriteLine("Capture successful! ID: " + response.TransactionID);
}
else
{    
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
.then(function (response) {
    if (response.get('TransactionStatus')) {
        console.log('Cancel authorisation successful! ID: ' + response.get('TransactionID'));
    } else {
        var errorCodes = response.get('ResponseMessage').split(', ');
        errorCodes.forEach(function(errorCode) {
            console.log("Response Message: " + rapid.getMessage(errorCode, "en"));
        });
    }
})
.catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available response properties

if response.errors.empty?
  if response.transaction_status.status?
    puts "Cancel authorisation successful! ID: #{response.transaction_status.transaction_id}"
  else
    puts "Response Message: #{response.transaction_status.processing_details.response_message}"
  end
else
  response.errors.each { |e| puts "Response message: "+ EwayRapid::RapidClient.user_display_message(e) }
end

The response from Eway will contain details as to whether the request to cancel to Authorisation succeeded or failed

Response Field Descriptions

Field Name Max Length Data Type Description
ResponseCode 512 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result of the action performed.
TransactionStatus boolean A boolean string indicating whether or not the cancel transaction succeeded
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
Errors 255 string The error codes of any errors that occurred with the cancellation, these can be looked up in the Response and Error Codes section.

Tokens

Capture your customers details once, and securely store them on Eway's PCI DSS compliant servers for any time they wish to make a purchase in the future.

Capturing and updating a customer's details can be done through any of the available Connection Methods by using the appropriate Method.

Tokens are also supported with Digital Wallets, so you can securely capture a customer's preferred payment method through their Digital Wallet and store that as a Token for future payments.

Create Token Customer with Direct Connection example

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "Title": "Mr.",
           "FirstName": "John",
           "LastName": "Smith",
           "Country": "au",
           "CardDetails": {
             "Name": "John Smith",
             "Number": "4444333322221111",
             "ExpiryMonth": "12",
             "ExpiryYear": "25",
             "CVN": "123"
           }
        },
        "Payment": {
           "TotalAmount": 0
        },
        "Method": "CreateTokenCustomer",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <Title>Mr.</Title>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <Country>au</Country>
                    <CardDetails>
                        <Number>4444333322221111</Number>
                        <Name>John Smith</Name>
                        <ExpiryMonth>12</ExpiryMonth>
                        <ExpiryYear>25</ExpiryYear>
                        <CVN>123</CVN>
                    </CardDetails>
                </Customer>
                <Payment>
                    <TotalAmount>0</TotalAmount>
                </Payment>
                <Method>CreateTokenCustomer</Method>
                <TransactionType>Purchase</TransactionType>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$customer = [
    'Title' => 'Mr.',
    'FirstName' => 'John',
    'LastName' => 'Smith',
    'Country' => 'au',
    'CardDetails' => [
        'Name' => 'John Smith',
        'Number' => '4444333322221111',
        'ExpiryMonth' => '12',
        'ExpiryYear' => '25',
        'CVN' => '123',
    ]
];

$response = $client->createCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Customer customer = new Customer();
customer.setTitle("Mr.");
customer.setFirstName("John");
customer.setLastName("Smith");

Address address = new Address();
address.setCountry("au");
customer.setAddress(address);

CardDetails cardDetails = new CardDetails();
cardDetails.setName("John Smith");
cardDetails.setNumber("4444333322221111");
cardDetails.setExpiryMonth("12");
cardDetails.setExpiryYear("25");
cardDetails.setCVN("123");
customer.setCardDetails(cardDetails);

CreateCustomerResponse response = client.create(PaymentMethod.Direct, customer);
IRapidClient rapidClient = new RapidClient(httpClient);

CustomerRequest customer = new CustomerRequest() {
    Customer =  new DirectTokenCustomer()
    {
        TokenCustomerID = 321321321, 
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org",
        CardDetails = new CardDetails()
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "11",
            ExpiryYear = "25",
            StartMonth = "01",
            StartYear = "13",
            IssueNumber = "01",
            CVN = "123"
        }
    } 
};

var response = await rapidClient.CreateCustomer(customer);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createCustomer(rapid.Enum.Method.DIRECT, {
   "Title": "Mr.",
   "FirstName": "John",
   "LastName": "Smith",
   "Country": "au",
   "CardDetails": {
     "Name": "John Smith",
     "Number": "4444333322221111",
     "ExpiryMonth": "12",
     "ExpiryYear": "25",
     "CVN": "123"
   }
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

customer = EwayRapid::Models::Customer.new
customer.title = 'Mr.'
customer.first_name = 'John'
customer.last_name = 'Smith'

address = EwayRapid::Models::Address.new
address.country = 'AU'
customer.address = address

card_details = EwayRapid::Models::CardDetails.new
card_details.name = 'John Smith'
card_details.number = '4444333322221111'
card_details.expiry_month = '05'
card_details.expiry_year = '25'
card_details.cvn = '123'
customer.card_details = card_details

response = client.create_customer(EwayRapid::Enums::PaymentMethod::DIRECT, customer)

Creating a Token Customer

To create a Token Customer, use the same process as submitting a transaction in any of the available Connection Methods with the following details:

Remember to store the Token Customer ID for subsequent charges and updates!

Creating and Charging a Token Customer in a Single Request

Creating and charging a token customer at the same time is possible when using Transparent Redirect, Responsive Shared Page or IFrame as your Connection Method. To do this, set the Method to TokenPayment and include the Payment section with the TotalAmount to be charged.

If you are using one of the Rapid SDKs, submit a regular transaction and set the SaveCustomer flag to true.

Charge Token Customer with Direct Connection example

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "TokenCustomerID": 917758625852
        },
        "Payment": {
           "TotalAmount": 1000
        },
        "Method": "ProcessPayment",
        "TransactionType": "Recurring"
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <TokenCustomerID>917758625852</TokenCustomerID>
                </Customer>
                <Payment>
                    <TotalAmount>1000</TotalAmount>
                </Payment>
                <Method>ProcessPayment</Method>
                <TransactionType>Recurring</TransactionType>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$transaction = [
    'Customer' => [
        'TokenCustomerID' => 917758625852,
    ],
    'Payment' => [
        'TotalAmount' => 1000,
    ],
    'TransactionType' => \Eway\Rapid\Enum\TransactionType::RECURRING,
];

$response = $client->createTransaction(\Eway\Rapid\Enum\ApiMethod::DIRECT, $transaction);
RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Transaction transaction = new Transaction();

Customer customer = new Customer();
customer.setTokenCustomerID("917758625852");
transaction.setCustomer(customer);

PaymentDetails paymentDetails = new PaymentDetails();
paymentDetails.setTotalAmount(1000);
transaction.setPaymentDetails(paymentDetails);

transaction.setTransactionType(TransactionType.Recurring);

CreateTransactionResponse response = client.create(PaymentMethod.Direct, transaction);
IRapidClient rapidClient = new RapidClient(httpClient);

DirectPaymentRequest transaction = new DirectPaymentRequest()
{
    Customer = new DirectTokenCustomer()
    {
        TokenCustomerID = 917758625852,
        CardDetails = new CardDetails
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "12",
            ExpiryYear = "25",
            CVN = "123"
        }
    },
    Payment = new Payment()
    {
        TotalAmount = 1000
    },
    TransactionType = TransactionTypes.Recurring
};

DirectPaymentResponse response = await rapidClient.CreateTransaction(transaction);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.createTransaction(rapid.Enum.Method.DIRECT, {
    "Customer": {
        "TokenCustomerID": 917758625852
    },
    "Payment": {
       "TotalAmount": 1000
    },
    "TransactionType": "Recurring"
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

transaction = EwayRapid::Models::Transaction.new

transaction.customer = EwayRapid::Models::Customer.new
transaction.customer.token_customer_id = '917758625852'

payment_details = EwayRapid::Models::PaymentDetails.new
payment_details.total_amount = 1000
transaction.payment_details = payment_details

transaction.transaction_type = EwayRapid::Enums::TransactionType::RECURRING

response = client.create_transaction(EwayRapid::Enums::PaymentMethod::DIRECT, transaction)

Charging a Token Customer

To charge an existing Token Customer, there are two ways depending on whether the customer is initiating the transaction:

To process the transaction, the following details should be set:

Tokens can also be used in a Pre-Auth transaction by setting the Method to Authorise.

Update Token Customer with Direct Connection example

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "TokenCustomerID": 917758625852,
           "Title": "Ms.",
           "FirstName": "Jane",
           "LastName": "Smith",
           "Country": "au",
           "CardDetails": {
             "Name": "Jane Smith",
             "Number": "4444333322221111",
             "ExpiryMonth": "12",
             "ExpiryYear": "25",
             "CVN": "123"
           }
        },
        "Payment": {
           "TotalAmount": 0
        },
        "Method": "UpdateTokenCustomer",
        "TransactionType": "Purchase"
        }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <TokenCustomerID>917758625852</TokenCustomerID>
                    <Title>Ms.</Title>
                    <FirstName>Jane</FirstName>
                    <LastName>Smith</LastName>
                    <Country>au</Country>
                    <CardDetails>
                        <Number>4444333322221111</Number>
                        <Name>Jane Smith</Name>
                        <ExpiryMonth>12</ExpiryMonth>
                        <ExpiryYear>25</ExpiryYear>
                        <CVN>123</CVN>
                    </CardDetails>
                </Customer>
                <Payment>
                    <TotalAmount>0</TotalAmount>
                </Payment>
                <Method>UpdateTokenCustomer</Method>
                <TransactionType>Purchase</TransactionType>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$customer = [
    'TokenCustomerID' => 917758625852,
    'Title' => 'Ms.',
    'FirstName' => 'Jane',
    'LastName' => 'Smith',
    'Country' => 'au',
    'CardDetails' => [
        'Name' => 'Jane Smith',
        'Number' => '4444333322221111',
        'ExpiryMonth' => '12',
        'ExpiryYear' => '25',
        'CVN' => '123',
    ]
];

$response = $client->updateCustomer(\Eway\Rapid\Enum\ApiMethod::DIRECT, $customer);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

Customer customer = new Customer();
customer.setTitle("Ms.");
customer.setFirstName("Jane");
customer.setLastName("Smith");
customer.setTokenCustomerID("917758625852");

Address address = new Address();
address.setCountry("au");
customer.setAddress(address);

CardDetails cardDetails = new CardDetails();
cardDetails.setName("Jane Smith");
cardDetails.setNumber("4444333322221111");
cardDetails.setExpiryMonth("12");
cardDetails.setExpiryYear("25");
cardDetails.setCVN("123");
customer.setCardDetails(cardDetails);

CreateCustomerResponse response = client.update(PaymentMethod.Direct, customer);
IRapidClient rapidClient = new RapidClient(httpClient);

CustomerRequest customer = new CustomerRequest{
    Customer = new DirectTokenCustomer() {
        TokenCustomerID = 321321321,
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org",
        CardDetails = new CardDetails()
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "11",
            ExpiryYear = "25",
            StartMonth = "01",
            StartYear = "13",
            IssueNumber = "01",
            CVN = "123"
        }
    }
};

var response = await rapidClient.UpdateCustomer(customer);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.updateCustomer(rapid.Enum.Method.DIRECT, {
    "TokenCustomerID": "917758625852",
    "Title": "Mr.",
    "FirstName": "John",
    "LastName": "Smith",
    "Country": "au",
    "CardDetails": {
     "Name": "John Smith",
     "Number": "4444333322221111",
     "ExpiryMonth": "12",
     "ExpiryYear": "25",
     "CVN": "123"
    }
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

customer = EwayRapid::Models::Customer.new
customer.token_customer_id = 917758625852
customer.title = 'Ms.'
customer.first_name = 'Jane'
customer.last_name = 'Smith'

address = EwayRapid::Models::Address.new
address.country = 'AU'
customer.address = address

card_details = EwayRapid::Models::CardDetails.new
card_details.name = 'Jane Smith'
card_details.number = '4444333322221111'
card_details.expiry_month = '05'
card_details.expiry_year = '25'
card_details.cvn = '123'
customer.card_details = card_details

response = client.update_customer(EwayRapid::Enums::PaymentMethod::DIRECT, customer)

Updating a Token Customer

To update a Token Customer, use the same process as submitting a transaction in any of the available Connection Methods using the following details:

Querying a Token Customer

This API call is used to retrieve the customer details and masked card details stored against a Token Customer in your Eway account.

Live endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.ewaypayments.com/Customer/{TokenCustomerID}
HTTP GET (XML) https://api.ewaypayments.com//Customer/?Filter_TokenCustomerID={TokenCustomerID}
HTTP POST (JSON) https://api.ewaypayments.com/DirectCustomerSearch.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (GET) https://api.sandbox.ewaypayments.com/Customer/{TokenCustomerID}
HTTP GET (XML) https://api.sandbox.ewaypayments.com/Customer/?Filter_TokenCustomerID={TokenCustomerID}
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/DirectCustomerSearch.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Request Field Descriptions

Example Token Customer Query request

curl --request GET \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    https://api.sandbox.ewaypayments.com/Customer/917758625852
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <DirectCustomerSearch xmlns="https://api.ewaypayments.com/">
         <request>
            <TokenCustomerID>917758625852</TokenCustomerID>
         </request>
      </DirectCustomerSearch>
   </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$response = $client->queryCustomer(917758625852);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

long tokenId = Long.parseLong("917758625852");
QueryCustomerResponse response = client.queryCustomer(tokenId);
IRapidClient rapidClient = new RapidClient(httpClient);

var response = await rapidClient.QueryCustomer("918268990356");
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.queryCustomer("917758625852")
.then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

response = client.query_customer('917758625852')
Field Name Field Type Max Length Data Type Description
TokenCustomerID R 16 string The Token Customer ID

Field Types: R – Required

Response Field Descriptions

Example Token Customer Query response

{
    "Customers": [{
        "CardDetails": {
            "Number": "444433XXXXXX1111",
            "Name": "Joel Smith",
            "ExpiryMonth": "12",
            "ExpiryYear": "25",
            "StartMonth": "",
            "StartYear": "",
            "IssueNumber": ""
        },
        "TokenCustomerID": 917758625852,
        "Reference": "",
        "Title": "Mr.",
        "FirstName": "Joel",
        "LastName": "Smith",
        "CompanyName": "",
        "JobDescription": "",
        "Street1": "",
        "Street2": null,
        "City": "",
        "State": "",
        "PostalCode": "",
        "Country": "au",
        "Email": "",
        "Phone": "",
        "Mobile": "",
        "Comments": "",
        "Fax": "",
        "Url": ""
    }],
    "Errors": null
}
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
   <soap:Body>
      <DirectCustomerSearchResponse xmlns="https://api.ewaypayments.com/">
         <DirectCustomerSearchResult>
            <Customers>
               <DirectTokenCustomer>
                  <TokenCustomerID>917758625852</TokenCustomerID>
                  <Reference/>
                  <Title>Mr.</Title>
                  <FirstName>Joel</FirstName>
                  <LastName>Smith</LastName>
                  <CompanyName/>
                  <JobDescription/>
                  <Street1/>
                  <City/>
                  <State/>
                  <PostalCode/>
                  <Country>au</Country>
                  <Email/>
                  <Phone/>
                  <Mobile/>
                  <Comments/>
                  <Fax/>
                  <Url/>
                  <CardDetails>
                     <Number>444433XXXXXX1111</Number>
                     <Name>Joel Smith</Name>
                     <ExpiryMonth>12</ExpiryMonth>
                     <ExpiryYear>25</ExpiryYear>
                     <StartMonth/>
                     <StartYear/>
                     <IssueNumber/>
                  </CardDetails>
               </DirectTokenCustomer>
            </Customers>
         </DirectCustomerSearchResult>
      </DirectCustomerSearchResponse>
   </soap:Body>
</soap:Envelope>
<?php

// See the JSON tab for all the available properties

$tokenCustomerID = $response->Customers[0]->TokenCustomerID;
$maskedCard = $response->Customers[0]->CardDetails->Number;
// See the JSON tab for all the available properties

String firstName = response.getFirstName();
String maskedCard = response.getCardDetail().getNumber();
// See the JSON tab for all the available properties

string firstName = response.Customer[0].FirstName;
string maskedCard = response.Customer[0].CardDetails.Number;
.then(function (response) {
    var customerid = response.get('Customers[0].TokenCustomerID');
    var maskedCard = response.get('Customers[0].CardDetails.Number');
}).catch(function(reason) {
    reason.getErrors().forEach(function(error) {
        console.log("Response Messages: " + rapid.getMessage(error, "en"));
    });
});
# See the JSON tab for all the available properties

token_customer_id = response.token_customer_id
masked_card = response.card_detail.number

Customers

This set of fields contains the details of the customer.

Field Name Max Length Data Type Description
TokenCustomerID 16 long A unqiue Eway-issued ID that represents the stored Token Customer
Reference 50 string Your reference for this customer
Title 5 string The customer's title
FirstName 50 string The customer's first name
LastName 50 string The customer's last name
CompanyName 50 string The customer's company name
JobDescription 50 string The customer's job description / title.
Street1 50 string The customer's street address - line 1
Street2 50 string The customer's street address - line 2
City 50 string The customer's city / town / suburb
State 50 string The customer's state / county
PostalCode 30 string The customer's post / zip code
Country† 2 string The customer's country. A two letter ISO 3166-1 alpha-2 code as defined in the ISO 3166 standard. For more information see: http://www.iso.org/iso/country_names_and_code_elements
Email 50 string The customer's email address
Phone 32 string The customer's phone number
Mobile 32 string The customer's mobile phone number
Comments 255 string Any comments you wish to add about the customer
Fax 32 string The customer's fax number
Url 512 string The customer's website

Card Details

Field Name Max Length Data Type Description
Name 50 string The cardholder's name
Number 50 int The masked card number
ExpiryMonth 2 int The month that the card expires
ExpiryYear 2 int The year that the card expires
StartMonth* 2 int The month that the card is valid from
StartYear* 2 int The year that the card is valid from
IssueNumber* int The card's issue number

*Applies to UK only

Eway Apple Pay

Apple Pay comes pre-integrated in the Eway Responsive Shared Page. Once Apple Pay has been enabled and onboarded in MyEway, no further development is required outside of handling the new Validation Codes that have been created for Apple Pay.

If using Transparent Redirect or Direct Connection, then an Apple Developer Account associated with either the Apple Developer Program or Apple Developer Enterprise Program is required.

Prerequisites

Apple Pay with Transparent Redirect

Step 1:

When using Apple Pay with Transparent Redirect, the first step of generating an AccessCode is the same as a normal payment through Transparent Redirect. An example basic JSON request to create an AccessCode is included below.

Basic Request

{
    "Payment": {
       "TotalAmount": 68800
    },
    "RedirectUrl": "http://www.eway.com.au",
    "Method": "ProcessPayment",
    "TransactionType": "Purchase"
}

https://api.sandbox.ewaypayments.com/AccessCodes

Example Response

{
    "AccessCode": "A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto",
    "Customer": {
        "CardNumber": "",
        "CardStartMonth": "",
        "CardStartYear": "",
        "CardIssueNumber": "",
        "CardName": "",
        "CardExpiryMonth": "",
        "CardExpiryYear": "",
        "IsActive": false,
        "TokenCustomerID": null,
        "Reference": "",
        "Title": "Mr.",
        "FirstName": "",
        "LastName": "",
        "CompanyName": "",
        "JobDescription": "",
        "Street1": "",
        "Street2": "",
        "City": "",
        "State": "",
        "PostalCode": "",
        "Country": "",
        "Email": "",
        "Phone": "",
        "Mobile": "",
        "Comments": "",
        "Fax": "",
        "Url": ""
    },
    "Payment": {
        "TotalAmount": 68800,
        "InvoiceNumber": "",
        "InvoiceDescription": "",
        "InvoiceReference": "",
        "CurrencyCode": "AUD"
    },
    "FormActionURL": "https://secure-au.sandbox.ewaypayments.com/AccessCode/A10012yIV2-MEEfkk7b7oYZqtulwNHv2dAFLv7T2guZEpjwBMHJoU-KxQihXVV10unFYbOUJ9Ob58oALLxn88_rzWDJhyq1-qW_hZ-xYjS3kdsCSNLtFHVESfDRVPWZqisLto",
    "CompleteCheckoutURL": null,
    "Errors": null
}

Step 2:

Present the customer with a Buy with Apple Pay buton to begin the Apple Pay workflow. Refer to Apple's Apple Pay on the Web documentation for details on how to integrate Apple Pay on the Web. Apple has a guide dedicated to Sandbox testing resources available here.

Step 3:

Once the customer has completed the Apple Pay on the Web workflow and you have obtained the Payment Token from Apple Pay, you must display an HTML form for the customer to submit, which will send the Apple Pay transaction to Eway to process.

This is the same process as submitting the card details as part of Step 2 of a normal card payment through Transparent Redirect, except instead of sending card details, you send the Apple Pay paymentData instead.

You do this by setting the EWAY_PAYMENTTYPE parameter in the form to ApplePay and adding a new parameter called APPLEPAY_NETWORKTOKEN which contains the paymentData JSON from the Payment Token.

An example of how to setup the HTML form is included below. The regular card fields that are used for Transparent Redirect are not required when processing Apple Pay transactions.

Example HTML form

<form method="POST" action="<<FormActionURL Goes Here>>" id="payment_form">
  <input type="hidden" name="EWAY_ACCESSCODE" value="<<AccessCode Goes Here>>" />
  <input type="hidden" name="EWAY_PAYMENTTYPE" value="ApplePay" />
  <input type="hidden" name="APPLEPAY_NETWORKTOKEN" value="<<Apple Pay paymentData Goes Here>>" />
  <input type="submit" value="Process" text="Process" />
</form>

Step 4

Once the customer has completed the transaction, they are redirected to the RedirectURL specified when creating the AccessCode, as per the usual Transparent Redirect workflow and you can request the results of the transaction by querying the AccessCode. This is the same as Step 3 of the Transparent Redirect workflow.

Below is an example response, along with the field definitions.

Example Response

{
    "AccessCode": "60CF38GiLDk3yzYwZ77wKG-SR2dtDdsvs4-mNkU-0pDUL2JczwU1BKv7_fiiP-1eFIQBIS-_IYkPNpq7is52ivHyYY8ja_ERyv9obORTgf_DtBXaKh-Bs11ETfu5iWj0xpYqE0SglcQe9eNrxXOYG5hiu7w==",
    "AuthorisationCode": "120167",
    "ResponseCode": "00",
    "ResponseMessage": "A2000",
    "InvoiceNumber": "Inv 21540",
    "InvoiceReference": "513456",
    "TotalAmount": 68800,
    "TransactionID": 30166161,
    "TransactionStatus": true,
    "TokenCustomerID": null,
    "BeagleScore": null,
    "Options": [
        {
            "Value": "Option1"
        },
        {
            "Value": "Option2"
        }
    ],
    "Verification": {
        "CVN": 0,
        "Address": 0,
        "Email": 0,
        "Mobile": 0,
        "Phone": 0
    },
    "BeagleVerification": {
        "Email": 0,
        "Phone": 0
    },
    "PaymentInstrument": {
        "ThreeDSecureAuth": {
            "Cryptogram": null,
            "ECI": null,
            "XID": null,
            "AuthStatus": null,
            "Version": null,
            "dsTransactionId": null
        },
        "PaymentType": "ApplePay"
    },
    "Customer": {
        "CardDetails": {
            "CardType": "VI",
            "Number": "483196XXXXXX5890",
            "Name": "VALUED CARDHOLDER",
            "ExpiryMonth": "12",
            "ExpiryYear": "23",
            "StartMonth": null,
            "StartYear": null,
            "IssueNumber": null
        },
        "TokenCustomerID": null,
        "Reference": null,
        "Title": null,
        "FirstName": null,
        "LastName": null,
        "CompanyName": null,
        "JobDescription": null,
        "Street1": null,
        "Street2": null,
        "City": null,
        "State": null,
        "PostalCode": null,
        "Country": null,
        "Email": null,
        "Phone": null,
        "Mobile": null,
        "Comments": null,
        "Fax": null,
        "Url": null
    },
    "Errors": null
}

Response Field Definitions

Field Name Max Length Data Type Description
AccessCode 512 string An echo of the AccessCode used in the request
AuthorisationCode 6 string The authorisation code for this transaction as returned by the bank
ResponseCode 2 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result if the action performed.
If a Fraud Essentials rule is triggered, this may contain multiple codes: eg. D4405, F7003
InvoiceNumber 64 string An echo of the merchant's invoice number for this transaction
InvoiceReference 64 string An echo of the merchant's reference number for this transaction
TotalAmount 10 int The amount that was authorised for this transaction
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
TransactionStatus 16 boolean A Boolean value that indicates whether the transaction was successful or not
TokenCustomerID 16 long An Eway-issued ID that represents the Token customer that was loaded or created for this transaction (if applicable)
BeagleScore 6 string A Fraud Lite score representing the estimated probability that the order is fraudulent. A value between 0.01 and 100.00 representing the likelihood that the transaction is fradulent, wih 0.01 being the lowest and 100.00 being the highest.
In the Sandbox environment the score will always be returned as -1 unless you have configured your Sandbox to fail for Risk Score, in which case the value will be 101.
This field is only returned when using Fraud Lite
Options N/A object An echo of the options collection passed in the CreateAccessCode request
Verification N/A object This set of fields is currently unused
BaegleVerification N/A object This will contain the results of the Fraud Verification identification checks that may have been performed
PaymentInstrument N/A object This set of fields contains the details of the payment instrument used for the transaction
Customer N/A object This set of fields contains the details of the customer making the payment
Errors 512 string A comma separated list of any error encountered. These can be looked up in the Response and Error Codes section.

Options

The Options collection passed in the original request will be echoed back in the response here.

Field Name Max Length Data Type Description
Value 255 string An echo of the option submitted for this transaction

Verification

These fields are currently unused

Field Name Max Length Data Type Description
CVN 10 string This field is not currently used
Address 10 string This field is not currently used
Email 10 string This field is not currently used
Mobile 10 string This field is not currently used
Phone 10 string This field is not currently used

BeagleVerification

This will contain the results of the Fraud Verification identification checks that may have been performed. These options are only active when using the Responsive Shared Page.

Field Name Max Length Data Type Description
Email 11 string The result of the email verification
Phone 11 string The result of the phone verification

PaymentInstrument

This set of fields contains the details of the payment instrument used for the transaction.

Field Name Max Length Data Type Description
ThreeDSecureAuth N/A object This set of fields contains the 3D Secure verification results
PaymentType 10 string The payment method used for the transaction.
eg. ApplePay

ThreeDSecureAuth

This set of fields contains the 3D Secure verification results.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator.
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0.
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0.

Customer

Field Name Max Length Data Type Description
CardDetails N/A object This set of fields contains the details of the card used for the payment
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

Card Details

The card details section is within the Customer section. It's important to note that Apple Pay does not provide the true name on the credit card, so the Name parameter will be returned as VALUED CARDHOLDER.

Field Name Max Length Data Type Description
Name 50 string An echo of the name of the card holder
Number 50 int A masked echo of the card number
ExpiryMonth 2 int An echo of the month that the card expires
ExpiryYear 2 int An echo of the year that the card expires
StartMonth* 2 int An echo of the month that the card is valid from
StartYear* 2 int An echo of the year that the card is valid from
IssueNumber* int An echo of the card's issue number

*Applies to UK only

Apple Pay with Direct Connection

When using Apple Pay with Direct Connection, you must first integrate Apple Pay on the Web and obtain the Payment Token from Apple Pay. Refer to Apple's Apple Pay on the Web documentation for details of how to integrate Apple Pay on the Web. Apple has a guide dedicated to testing resources available here.

Step 1:

Present the customer with a Buy with Apple Pay button to begin the Apple Pay workflow. Refer to Apple's Apple Pay on the Web documentation for details of how to integrate Apple Pay on the Web.

Step 2:

Once the customer has completed the Apple Pay workflow and you have obtained the Payment Token from Apple Pay, you must pass this to your server to submit to Eway through Direct Connection.

Note: For the Eway transaction, you are only required to pass the information contained within the paymentData object.

Example Apple Pay Payment Token

{
  "paymentData": {
    "data": "zBGPmoTaMeRRDHXofGSiafVz3TJW6UrXGhxWrETg9pdd2ASSAwMpQcxqJZ34kzRphxJ8onUfhzRrLdEEpA1kfhCfdWE0cc63F/C9vXOlr0DGZaXzZopETh0r9WzxDUW6OhgpwDpuD9mkCbdnHfNGN5edG3G/lFnsi/bQ6PNTE2MRTYhY+cKwvGFZjeYMTYQbidWhqET2+6xyBhipHiQJn3WiMTm40H15JCg3VumGoSg5w2dGtDF4ICsakWKJZ+9mI4ALepMZsSwmD+Cag+0jVjzKHEcgpJWHCRyCyavVEgdKzPBI3BgFQbTEjPv/7hWmBJ4Ml5XbgfrQ5N80epZfbsThwuSwsxSqvjGOHzxXSeFnNXomM8aqQOVyugWeCgwHU1rCEgkacBwo5RmOah8AYbHzQMqeCUKawlOWzdMpNWI=",
    "signature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID5DCCA4ugAwIBAgIIWdihvKr0480wCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTIxMDQyMDE5MzcwMFoXDTI2MDQxOTE5MzY1OVowYjEoMCYGA1UEAwwfZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtU0FOREJPWDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgjD9q8Oc914gLFDZm0US5jfiqQHdbLPgsc1LUmeY+M9OvegaJajCHkwz3c6OKpbC9q+hkwNFxOh6RCbOlRsSlaOCAhEwggINMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUI/JJxE+T5O8n5sT2KGw/orv9LkswRQYIKwYBBQUHAQEEOTA3MDUGCCsGAQUFBzABhilodHRwOi8vb2NzcC5hcHBsZS5jb20vb2NzcDA0LWFwcGxlYWljYTMwMjCCAR0GA1UdIASCARQwggEQMIIBDAYJKoZIhvdjZAUBMIH+MIHDBggrBgEFBQcCAjCBtgyBs1JlbGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxlIHN0YW5kYXJkIHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgY2VydGlmaWNhdGUgcG9saWN5IGFuZCBjZXJ0aWZpY2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMuMDYGCCsGAQUFBwIBFipodHRwOi8vd3d3LmFwcGxlLmNvbS9jZXJ0aWZpY2F0ZWF1dGhvcml0eS8wNAYDVR0fBC0wKzApoCegJYYjaHR0cDovL2NybC5hcHBsZS5jb20vYXBwbGVhaWNhMy5jcmwwHQYDVR0OBBYEFAIkMAua7u1GMZekplopnkJxghxFMA4GA1UdDwEB/wQEAwIHgDAPBgkqhkiG92NkBh0EAgUAMAoGCCqGSM49BAMCA0cAMEQCIHShsyTbQklDDdMnTFB0xICNmh9IDjqFxcE2JWYyX7yjAiBpNpBTq/ULWlL59gBNxYqtbFCn1ghoN5DgpzrQHkrZgTCCAu4wggJ1oAMCAQICCEltL786mNqXMAoGCCqGSM49BAMCMGcxGzAZBgNVBAMMEkFwcGxlIFJvb3QgQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE0MDUwNjIzNDYzMFoXDTI5MDUwNjIzNDYzMFowejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8BcRhBnXZIXVGl4lgQd26ICi7957rk3gjfxLk+EzVtVmWzWuItCXdg0iTnu6CP12F86Iy3a7ZnC+yOgphP9URaOB9zCB9DBGBggrBgEFBQcBAQQ6MDgwNgYIKwYBBQUHMAGGKmh0dHA6Ly9vY3NwLmFwcGxlLmNvbS9vY3NwMDQtYXBwbGVyb290Y2FnMzAdBgNVHQ4EFgQUI/JJxE+T5O8n5sT2KGw/orv9LkswDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS7sN6hWDOImqSKmd6+veuv2sskqzA3BgNVHR8EMDAuMCygKqAohiZodHRwOi8vY3JsLmFwcGxlLmNvbS9hcHBsZXJvb3RjYWczLmNybDAOBgNVHQ8BAf8EBAMCAQYwEAYKKoZIhvdjZAYCDgQCBQAwCgYIKoZIzj0EAwIDZwAwZAIwOs9yg1EWmbGG+zXDVspiv/QX7dkPdU2ijr7xnIFeQreJ+Jj3m1mfmNVBDY+d6cL+AjAyLdVEIbCjBXdsXfM4O5Bn/Rd8LCFtlk/GcmmCEm9U+Hp9G5nLmwmJIWEGmQ8Jkh0AADGCAYswggGHAgEBMIGGMHoxLjAsBgNVBAMMJUFwcGxlIEFwcGxpY2F0aW9uIEludGVncmF0aW9uIENBIC0gRzMxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUwIIWdihvKr0480wDQYJYIZIAWUDBAIBBQCggZUwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwOTI4MDM1NDA0WjAqBgkqhkiG9w0BCTQxHTAbMA0GCWCGSAFlAwQCAQUAoQoGCCqGSM49BAMCMC8GCSqGSIb3DQEJBDEiBCCyRwyMw/HM0ztWiW/mIMRM6GLqBZ7OA8EbpAupmATQkDAKBggqhkjOPQQDAgRGMEQCIDSo6JokCgZmNoF/EXp8zGKAB5Tp5eXuADhbxYxaYPKXAiAqu1ZlNVTrsFVSCoOeTIRHTdbEE2AqCF5tUpug4cTDKwAAAAAAAA==",
    "header": {
      "transactionId": "c3c72badf71ef9607542f955b82f35c72d615a3444f75d4b0cd59ad8b9b277dd",
      "publicKeyHash": "V5/MqckcWT6Giu+hgymVv6vUzTlg3Nhgt5P5t0lNb4s=",
      "applicationData": "76a9a9cb2d9811e8de56d8e7713601bfa6acda3d488b1cf03b9b115bc3ff12b4",
      "ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgEsrQro/YeW4ZJflH2aqtSQXI3ncBbTL7BH+mhWa5RpPM+oGlfNJT3D80sc9MijBBIRLk1rCCfVpOeuhpcEMpQ=="
    },
    "version": "EC_v1"
  },
  "paymentMethod": {
    "displayName": "Visa 0326",
    "network": "Visa",
    "type": "debit"
  },
  "transactionIdentifier": "C3C72BADF71EF9607542F955B82F35C72D615A3444F75D4B0CD59AD8B9B277DD"
}

Step 3:

To process the Apple Pay transaction through Direct Connection, you will first need to convert the paymentData JSON object into a String. This is then passed as the value for the Token parameter contained within the WalletDetails object.

Example Request

{
    "PaymentInstrument": {
        "PaymentType": "ApplePay",
        "WalletDetails": {
            "Token": "{\r\n    \"data\": \"zBGPmoTaMeRRDHXofGSiafVz3TJW6UrXGhxWrETg9pdd2ASSAwMpQcxqJZ34kzRphxJ8onUfhzRrLdEEpA1kfhCfdWE0cc63F/C9vXOlr0DGZaXzZopETh0r9WzxDUW6OhgpwDpuD9mkCbdnHfNGN5edG3G/lFnsi/bQ6PNTE2MRTYhY+cKwvGFZjeYMTYQbidWhqET2+6xyBhipHiQJn3WiMTm40H15JCg3VumGoSg5w2dGtDF4ICsakWKJZ+9mI4ALepMZsSwmD+Cag+0jVjzKHEcgpJWHCRyCyavVEgdKzPBI3BgFQbTEjPv/7hWmBJ4Ml5XbgfrQ5N80epZfbsThwuSwsxSqvjGOHzxXSeFnNXomM8aqQOVyugWeCgwHU1rCEgkacBwo5RmOah8AYbHzQMqeCUKawlOWzdMpNWI=\",\r\n    \"signature\": \"MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID5DCCA4ugAwIBAgIIWdihvKr0480wCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTIxMDQyMDE5MzcwMFoXDTI2MDQxOTE5MzY1OVowYjEoMCYGA1UEAwwfZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtU0FOREJPWDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgjD9q8Oc914gLFDZm0US5jfiqQHdbLPgsc1LUmeY+M9OvegaJajCHkwz3c6OKpbC9q+hkwNFxOh6RCbOlRsSlaOCAhEwggINMAwGA1UdEwEB/wQCMAAwHwYDVR0jBBgwFoAUI/JJxE+T5O8n5sT2KGw/orv9LkswRQYIKwYBBQUHAQEEOTA3MDUGCCsGAQUFBzABhilodHRwOi8vb2NzcC5hcHBsZS5jb20vb2NzcDA0LWFwcGxlYWljYTMwMjCCAR0GA1UdIASCARQwggEQMIIBDAYJKoZIhvdjZAUBMIH+MIHDBggrBgEFBQcCAjCBtgyBs1JlbGlhbmNlIG9uIHRoaXMgY2VydGlmaWNhdGUgYnkgYW55IHBhcnR5IGFzc3VtZXMgYWNjZXB0YW5jZSBvZiB0aGUgdGhlbiBhcHBsaWNhYmxlIHN0YW5kYXJkIHRlcm1zIGFuZCBjb25kaXRpb25zIG9mIHVzZSwgY2VydGlmaWNhdGUgcG9saWN5IGFuZCBjZXJ0aWZpY2F0aW9uIHByYWN0aWNlIHN0YXRlbWVudHMuMDYGCCsGAQUFBwIBFipodHRwOi8vd3d3LmFwcGxlLmNvbS9jZXJ0aWZpY2F0ZWF1dGhvcml0eS8wNAYDVR0fBC0wKzApoCegJYYjaHR0cDovL2NybC5hcHBsZS5jb20vYXBwbGVhaWNhMy5jcmwwHQYDVR0OBBYEFAIkMAua7u1GMZekplopnkJxghxFMA4GA1UdDwEB/wQEAwIHgDAPBgkqhkiG92NkBh0EAgUAMAoGCCqGSM49BAMCA0cAMEQCIHShsyTbQklDDdMnTFB0xICNmh9IDjqFxcE2JWYyX7yjAiBpNpBTq/ULWlL59gBNxYqtbFCn1ghoN5DgpzrQHkrZgTCCAu4wggJ1oAMCAQICCEltL786mNqXMAoGCCqGSM49BAMCMGcxGzAZBgNVBAMMEkFwcGxlIFJvb3QgQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE0MDUwNjIzNDYzMFoXDTI5MDUwNjIzNDYzMFowejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8BcRhBnXZIXVGl4lgQd26ICi7957rk3gjfxLk+EzVtVmWzWuItCXdg0iTnu6CP12F86Iy3a7ZnC+yOgphP9URaOB9zCB9DBGBggrBgEFBQcBAQQ6MDgwNgYIKwYBBQUHMAGGKmh0dHA6Ly9vY3NwLmFwcGxlLmNvbS9vY3NwMDQtYXBwbGVyb290Y2FnMzAdBgNVHQ4EFgQUI/JJxE+T5O8n5sT2KGw/orv9LkswDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBS7sN6hWDOImqSKmd6+veuv2sskqzA3BgNVHR8EMDAuMCygKqAohiZodHRwOi8vY3JsLmFwcGxlLmNvbS9hcHBsZXJvb3RjYWczLmNybDAOBgNVHQ8BAf8EBAMCAQYwEAYKKoZIhvdjZAYCDgQCBQAwCgYIKoZIzj0EAwIDZwAwZAIwOs9yg1EWmbGG+zXDVspiv/QX7dkPdU2ijr7xnIFeQreJ+Jj3m1mfmNVBDY+d6cL+AjAyLdVEIbCjBXdsXfM4O5Bn/Rd8LCFtlk/GcmmCEm9U+Hp9G5nLmwmJIWEGmQ8Jkh0AADGCAYswggGHAgEBMIGGMHoxLjAsBgNVBAMMJUFwcGxlIEFwcGxpY2F0aW9uIEludGVncmF0aW9uIENBIC0gRzMxJjAkBgNVBAsMHUFwcGxlIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MRMwEQYDVQQKDApBcHBsZSBJbmMuMQswCQYDVQQGEwJVUwIIWdihvKr0480wDQYJYIZIAWUDBAIBBQCggZUwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMjEwOTI4MDM1NDA0WjAqBgkqhkiG9w0BCTQxHTAbMA0GCWCGSAFlAwQCAQUAoQoGCCqGSM49BAMCMC8GCSqGSIb3DQEJBDEiBCCyRwyMw/HM0ztWiW/mIMRM6GLqBZ7OA8EbpAupmATQkDAKBggqhkjOPQQDAgRGMEQCIDSo6JokCgZmNoF/EXp8zGKAB5Tp5eXuADhbxYxaYPKXAiAqu1ZlNVTrsFVSCoOeTIRHTdbEE2AqCF5tUpug4cTDKwAAAAAAAA==\",\r\n    \"header\": {\r\n      \"transactionId\": \"c3c72badf71ef9607542f955b82f35c72d615a3444f75d4b0cd59ad8b9b277dd\",\r\n      \"publicKeyHash\": \"V5/MqckcWT6Giu+hgymVv6vUzTlg3Nhgt5P5t0lNb4s=\",\r\n      \"applicationData\": \"76a9a9cb2d9811e8de56d8e7713601bfa6acda3d488b1cf03b9b115bc3ff12b4\",\r\n      \"ephemeralPublicKey\": \"MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEgEsrQro/YeW4ZJflH2aqtSQXI3ncBbTL7BH+mhWa5RpPM+oGlfNJT3D80sc9MijBBIRLk1rCCfVpOeuhpcEMpQ==\"\r\n    },\r\n    \"version\": \"EC_v1\"\r\n  }"
        }
    },
    "Payment": {
        "TotalAmount": 19990,
        "CurrencyCode": "AUD"
    },
    "Method": "ProcessPayment",
    "TransactionType": "Purchase"
}

https://api.sandbox.ewaypayments.com/Transaction

Request Parameters

All available request fields under Direct Connection are supported. Refer to Direct Connection for the full list of supported fields.

Field Name Field Type Max Length Data Type Description
PaymentInstrument R N/A object This set of fields contains the details of the instrument being used to process the payment
Payment R N/A object This set of fields contains the details of the payment being processed
Method R 20 string The action to perform with this request. See Methods for more information.
One of ProcessPayment, CreateTokenCustomer, UpdateTokenCustomer, TokenPayment, Authorise
TransactionType R 20 enum Thetype of transaction you are performing.
One of: Purchase, MOTO or Recurring

Field types: R – Required, O – Optional

PaymentInstrument

Field Name Field Type Max Length Data Type Description
PaymentType R string For Apple Pay transactions this must be set to ApplePay
WalletDetails R N/A object The object containing the details of the Digital Wallet

Field types: R – Required, O – Optional

WalletDetails

Field Name Field Type Max Length Data Type Description
Token R N/A string The stringified paymentData object received from Apple Pay.

Field types: R – Required, O – Optional

Payment

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount of the transaction in the lowest denomination for the currency. For Apple Pay, this must be equal to the amount sent to Apple when interfacing with Apple Pay on the Web
CurrencyCode O 3 string The ISO 4217 3 character code that represents the urrency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.. Australian Dollars = AUD

Field types: R – Required, O – Optional

Response Handling

Version 47 of the Rapid API introduces new fields in the transaction response to help you identify the payment type, as well as the type of card used during the payment.

Below is a breakdown of the parameters returned in the response.

Example Response


{
    "AuthorisationCode": "091098",
    "ResponseCode": "00",
    "ResponseMessage": "A2000",
    "TransactionID": 30164983,
    "TransactionStatus": true,
    "TransactionType": "Purchase",
    "BeagleScore": null,
    "Verification": {
        "CVN": 0,
        "Address": 0,
        "Email": 0,
        "Mobile": 0,
        "Phone": 0
    },
    "Customer": {
        "CardDetails": {
            "CardType": "UNKNOWN",
            "Number": "",
            "Name": null,
            "ExpiryMonth": null,
            "ExpiryYear": null,
            "StartMonth": null,
            "StartYear": null,
            "IssueNumber": null
        },
        "TokenCustomerID": null,
        "Reference": "",
        "Title": "Mr.",
        "FirstName": "",
        "LastName": "",
        "CompanyName": "",
        "JobDescription": "",
        "Street1": "",
        "Street2": "",
        "City": "",
        "State": "",
        "PostalCode": "",
        "Country": "",
        "Email": "",
        "Phone": "",
        "Mobile": "",
        "Comments": "",
        "Fax": "",
        "Url": ""
    },
    "Payment": {
        "TotalAmount": 19990,
        "InvoiceNumber": "",
        "InvoiceDescription": "",
        "InvoiceReference": "",
        "CurrencyCode": "AUD",
        "TransactionType": null
    },
    "PaymentInstrument": {
        "ThreeDSecureAuth": {
            "Cryptogram": null,
            "ECI": null,
            "XID": null,
            "AuthStatus": null,
            "Version": null,
            "dsTransactionId": null
        },
        "PaymentType": "ApplePay"
    },
    "Errors": null
}

Response Fields Descriptions

Field Name Max Length Data Type Description
AuthorisationCode 6 string The authorisation code for this transaction returned from the bank
ResponseCode 2 string The two digit response code returned from the bank
ResponseMessage 512 string One or more Response Messages that describes the result of the action performed
TransactionID 10 int A unique identifier that represents the transaction in Eway's system
TransactionStatus 5 boolean A Boolean value that indicates whether the transaction was successful or not
TransactionType 9 enum The transaction type that this transaction was processed as.
One of: Purchase, MOTO, or Recurring
BeagleScore 6 string A Fraud Lite score representing the estimated probability that the order is fraudulent. A value between 0.01 and 100.00 representing the likelihood that the transaction is fradulent, wih 0.01 being the lowest and 100.00 being the highest.
In the Sandbox environment the score will always be returned as -1 unless you have configured your Sandbox to fail for Risk Score, in which case the value will be 101.
This field is only returned when using Fraud Lite
Verification N/A object This set of fields is currently unused
Customer N/A object This set of fields contains the details of the customer making the payment
Payment N/A object This set of fields contains the details of the payment
PaymentInstrument N/A object This set of fields contains the details of the payment instrument used for the transaction
Errors 512 string A comma separated list of any errors encountered

Verification

These fields are not currently used.

Field Name Max Length Data Type Description
CVN 10 string Not currently used
Address 10 string Not currently used
Email 10 string Not currently used
Mobile 10 string Not currently used
Phone 10 string Not currently used

Customer

Field Name Max Length Data Type Description
CardDetails N/A object This set of fields contains the details of the card used for the payment
TokenCustomerID 16 long An Eway issued ID that represents the Token customer to be loaded for this action
Reference 50 string An echo of your reference for this customer
Title 5 string An echo of the customer's title
FirstName 50 string An echo of the customer's first name
LastName 50 string An echo of the customer's last name
CompanyName 50 string An echo of the customer's company name
JobDescription 50 string An echo of the customer's job description / title
Street1 50 string An echo of the customer's street address - line 1
Street2 50 string An echo of the customer's street address - line 2
City 50 string An echo of the customer's city / town / suburb
State 50 string An echo of the customer's state / county
PostalCode 30 string An echo of the customer's post / zip code
Country 2 string An echo of the customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Email 50 string An echo of the customer's email address
Phone 32 string An echo of the customer's phone number
Mobile 32 string An echo of the customer's mobile phone number
Comments 255 string An echo of any comments
Fax 32 string An echo of the customer's fax number
Url 512 string An echo of the customer's website

Card Details

The card details section is within the Customer section. With Apple Pay, Eway does not receive the actual cardholder's name from Apple, so the Name field will return with a value of VALUED CARDHOLDER.

Field Name Max Length Data Type Description
CardType 2 string The type of card used to process the payment.
  • ALL - all cards
  • VI - Visa
  • MC - Mastercard
  • AX - AMEX
  • DC - Diners Club
  • JC - JCB
  • MD - Maestro UK
  • MI - Maestro International
  • SO - Solo
  • LA - Laser
  • DS - Discover
Number 50 int A masked echo of the card number
Name 50 string An echo of the name of the card holder
ExpiryMonth 2 int An echo of the month that the card expires
ExpiryYear 2 int An echo of the year that the card expires
StartMonth* 2 int An echo of the month that the card is valid from
StartYear* 2 int An echo of the year that the card is valid from
IssueNumber* int An echo of the card's issue number

*Applies to UK only

Payment

This set of fields contains the details of the payment that was processed.

Field Name Max Length Data Type Description
TotalAmount 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
InvoiceNumber 64 string An echo of your invoice number for this transaction
InvoiceDescription 64 string An echo of the purchase that the customer is making
InvoiceReference 50 string An echo of your reference number for this transaction
CurrencyCode 3 string The ISO 4217 3 character code that represents the currency that this transaction was processed in.
TransactionType 9 string Currently unused. Refer to the TransactionType returned under the Transaction response.

PaymentInstrument

This set of fields contains the details of the payment instrument used for the transaction.

Field Name Max Length Data Type Description
ThreeDSecureAuth N/A object This set of fields contains the 3D Secure verification results
PaymentType 10 string The payment method used for the transaction.
eg. ApplePay

ThreeDSecureAuth

This set of fields contains the 3D Secure verification results.

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator.
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0.
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0.

Click to Pay

Click to Pay is an evolution of Visa Checkout, so you may see references to Visa Checkout mentioned in this document

Click to Pay (formerly Visa Checkout and Secure Remote Commerce) is an online secure wallet solution provided by the card schemes that enables customers to make one-click payments at participating merchants. By integrating Click to Pay, you will be able to offer your customers a secure and frictionless checkout experience by simply presenting them with a 'Click to Pay' button.

Click to Pay is pre-integrated into the Responsive Shared Page, simply activate Click to Pay through your MyEway portal.

Both Transparent Redirect and Direct Connection can process Click to Pay transactions through the steps outlined below.

Using Eway will take a lot of the hard work out of a Click to Pay implementation as our API will handle the decoding and decryption, as well as various calls to the Click to Pay API's to obtain card data securely, and then update the schemes with the transaction results.

You will only need to implement the JavaScript portions of Click to Pay on your website and then pass the Click to Pay CallID and/or the encrypted payload through to our API instead of Credit Card information.

For terms specific to Click to Pay please refer to the Visa Checkout JavaScript Integration Guide v2.5 (or later). Familiarity with this documentation is assumed.

Prerequisites

  1. Click to Pay has been activated via your MyEway portal. You can find the steps to do so here.
  2. You have obtained your unique Click to Pay API Key from the Click to Pay Settings page in MyEway. This will be used to configure the Visa JS Library.

Click to Pay with Transparent Redirect

Example payment success JavaScript function that sets the hidden fields using jQuery.

<script type="text/javascript">
V.on("payment.success", function(payment) {
    //Change Json payment obj to string
    var str = JSON.stringify(payment);
    //Save full encrypted response and callid on page for later use
    str = encodeURIComponent(str);
    $('#VISA_CHECKOUT_RESPONSE').val(str);
    $('#VISA_CHECKOUT_CALLID').val(payment["callid"]);
    //Form is now ready to post to Rapid.
});
</script>

When using Transparent Redirect, your website will need to create and load the Click to Pay Lightbox, then include the data returned from the Lightbox in the request to our API. Eway then decodes the credit card and uses it to process the transaction.
To achieve this, you will need to implement a Click-to-Pay Payment button as outlined in the Visa Checkout Specs.
Note: Set the apiKey property in the V.init call to the Eway Supplied Visa Checkout API Key. (See page 2-17 of the Visa Specs).

Below is a general overview of the workflow:

  1. Generate an AccessCode as per the normal workflow for Transaction Redirect.

  2. Present the customer with a Click to Pay button.

  3. Present the customer with a form to submit, as per Step 2 of Transparent Redirect. Rather than showing them the credit card fields, you will need set the EWAY_PAYMENTYPE to VisaCheckout and add the following hidden fields to the payment form:

Field Name Field Type Description
VISA_CHECKOUT_CALLID R The Visa Checkout Call ID obtained from Click to Pay.
EWAY_PAYMENTTYPE R Identifies the payment method being used for the payment. For Click to Pay, this must have a value of VisaCheckout.
VISA_CHECKOUT_EVENTTYPE O Identifies the action being completed. Must be set to Capture when processing a payment, or Cancel if you no longer want to proceed with the payment.
VISA_CHECKOUT_RESPONSE C The response from the Click to Pay lightbox in JSON format.
Required if no VISA_CHECKOUT_CALLID is supplied.

Field types: R – Required, C - Conditionally Required, O – Optional

As per the Visa API Specs in the V.on("payment.success" event, set the hidden fields to values returned from the Visa Checkout SDK. (see example on the right)

  1. The customer submits the form to Eway though a client side form post as per Step 2 of Transparent Redirect.

  2. Eway then processes the transaction and completes the following actions:

    • Decode the full CC from the VISA_CHECKOUT_RESPONSE, or calling the Click to Pay API to get it.
    • Update the Click to Pay payment with the final invoice details.
    • Update the Eway transaction with any address information from the card scheme.
    • Process the payment.
    • Call the Click to Pay API to update Click to Pay with the transaction result.
    • Redirect the customer's browser to your RedirectURL, as specified when creating the AccessCode.
  3. Your website site then calls GetAccessCodeResult as per Step 3 of Transparent Redirect, to obtain the result of the transaction and any cardholder address information that was obtained from Visa.

Click to Pay with Direct Connection

Example payment success JavaScript function that sets the hidden fields using jQuery.

<script type="text/javascript">
V.on("payment.success", function(payment) {
    //Change Json payment obj to string
    var str = JSON.stringify(payment);
    //Save full encrypted response and callid on page for later use
    str = encodeURIComponent(str);
    $('#VISA_CHECKOUT_RESPONSE').val(str);
    $('#VISA_CHECKOUT_CALLID').val(payment["callid"]);
    //Form is now ready to post to Rapid.
});
</script>

Basic payment with Click-to-Pay

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
      "Payment": {
        "TotalAmount": 100,
      },
      "Method": "ProcessPayment",
      "TransactionType": "Purchase",
      "SecuredCardData": "VCOCallID:123456"
    }' \
    https://api.sandbox.ewaypayments.com/Transaction
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectPayment xmlns="https://api.ewaypayments.com/">
            <request>
                <Payment>
                    <TotalAmount>100</TotalAmount>
                </Payment>
                <Method>ProcessPayment</Method>
                <TransactionType>Purchase</TransactionType>
                <SecuredCardData>VCOCallID:123456</SecuredCardData>
            </request>
        </DirectPayment>
    </soap:Body>
</soap:Envelope>

When using Direct Connection, your website will need to create and load the Click to Pay Lightbox, then include the data returned from the Lightbox in the request to our API. Eway then decodes the credit card and uses it to process the transaction.
To achieve this, you will need to implement a Click-to-Pay Payment button as outlined in the Visa Checkout Specs.

Below is a general overview of the workflow:

  1. Implement a Click-to-Pay Payment button as outlined in the Visa documentation. Set the apiKey property in the V.init call to the Eway Supplied Visa Checkout API Key mentioned above. (See page 2-17 of the Visa Specs).

  2. As per the Visa API Specs in the V.on("payment.success" event, store the CallID and/or Payload returned from the Visa Checkout SDK. (see the example in the section above for doing this with jQuery).

  3. Call back to your own server from the browser including the CallID and/or Encrypted Payload.

  4. Submit a Direct Connection API call to Eway and pass the CallID in the SecuredCardData field. The SecuredCardData must be formatted as follows VCOCallID:<CallID> Where 'CallID' is the Visa Checkout CallID (see example on the right).
    Note: No card data must be submitted in this request.
    For more information around the supported request parameters for Direct Connection, see the Direct Connection section of the documentation.

  5. Eway then processes the transaction and completes the following actions:

    • Call the Click to Pay API to get the full credit card details.
    • Update the Click to Pay payment with the final invoice details.
    • Update the Eway transaction with any address information from the card scheme.
    • Process the payment.
    • Call the Click to Pay API to update Click to Pay with the transaction result. *
  6. The Direct Connection API response then includes the transaction results.

Using Click to Pay to Create a Token Customer

Visa Checkout CallIDs can be used with the API's CreateTokenCustomer method to securely store the customer's details as a Token in Eway, but care must be taken to ensure that Visa's systems are correctly updated with transaction results. When mixing Token creation and transactions with a single CallID be sure to perform steps on your server in the following order.

  1. Show the Visa Lightbox to obtain a CallID.

  2. Submit a Direct Connection API request to create a Token Customer using the Visa Checkout CallID (as described above).

  3. Submit a Direct Connection API request to process a transaction ensuring that the TokenCustomerID from Step 2 is NOT used, and the Visa Checkout CallID is used instead.

  4. If it's anticipated that there will be a long period of time between creating the Token Customer and processing the corresponding transaction, then the CallID should be retained in your system.

  5. Second and subsequent transactions for Token customers created using Visa Checkout CallIDs should be processed against the Token ID as normal (without using a CallID).

It's important that only one transaction be processed with each CallID, and that any additional Token creation is completed before any transactions are processed.

3D Secure 2.0

3D Secure 2.0 ("3DS 2.0") comes pre-integrated in the Transparent Redirect, Responsive Shared Page and Iframe connection methods of the Rapid API. Once 3DS 2.0 has been enabled on your Eway account, no further development is required outside of handling the new Validation Codes that have been created for 3DS 2.0.

If you are using Direct Connection or Secure Fields/Secure Panel then you will need to implement Eway's 3D Secure MPI ("Merchant Plug-In) as detailed below.

Eway's 3D Secure MPI allows consumers to authenticate themselves with their card issuer through 3DS 2.0 when completing online transactions. It provides an additional security layer that helps prevent unauthorized transactions and stop fraud. As part of the 3DS 2.0 process flow, the customer will be redirected to an external page to complete the Verification step, and may be prompted to enter a one time code, which will be sent to them by their card issuing bank. If you would like to use your own page to complete the verification and reduce customer friction during the checkout, you can include our 3DS Javascript SDK and pass in the AccessCode that you obtain from the response in the Enrolment step. Details on our 3DS Javascript SDK are included under step 2 of this process.

Since card data is passed via the server, one of the following must be used to ensure compliance with card scheme regulations:

In the eWAY Sandbox, PCI compliance can be enabled via the Sandbox Settings page.

3D Secure 2.0 Enrolment example

curl --request POST \
--user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
--header 'Content-Type: application/json' \
--data '{
    "Customer": {
        "CardDetails": {
            "Name": "John Smith",
            "Number": "4444333322221111",
            "ExpiryMonth": "01",
            "ExpiryYear": "2023",
            "CVN": "123"
        },
        "FirstName": "John",
        "LastName": "Smith",
        "Street1": "Level 5",
        "Street2": "369 Queen Street",
        "City": "Sydney",
        "State": "NSW",
        "Country": "au",
        "PostalCode": "2000",
        "Phone": "098890986",
        "Email": "demo@example.org"
    },
    "Payment": {
        "TotalAmount": 25,
        "CurrencyCode": "AUD"
    },
    "RedirectUrl": "http://www.eway.com.au"
}'
https://api.sandbox.ewaypayments.com/3dsenrol


// below code is for enroll 3ds 
IRapidClient rapidClient = new RapidClient(httpClient);

EnrolDirectThreeDSecureRequest request = new EnrolDirectThreeDSecureRequest{
    Customer = new DirectTokenCustomer()
    {
        TokenCustomerID = 321321321, 
        Reference = "A12345",
        Title = "Mr.",
        FirstName = "John",
        LastName = "Smith",
        CompanyName = "Demo Shop 123",
        JobDescription = "C# Developer",
        Phone = "09 889 0986",
        Mobile = "09 889 6542",
        Url = "http://www.ewaypayments.com",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Comments = "",
        Fax = "",
        Email = "demo@example.org",
        CardDetails = new CardDetails()
        {
            Name = "John Smith",
            Number = "4444333322221111",
            ExpiryMonth = "11",
            ExpiryYear = "25",
            StartMonth = "01",
            StartYear = "13",
            IssueNumber = "01",
            CVN = "123"
        }
    },
    ShippingAddress = new ShippingAddress()
    {
        FirstName = "John",
        LastName = "Smith",
        Phone = "09 889 0986",
        Street1 = "Level 5",
        Street2 = "369 Queen Street",
        City = "Sydney",
        State = "NSW",
        Country = "au",
        PostalCode = "2000",
        Mobile = "09 889 6542",
        Email = "demo@example.org",
        ShippingMethod = "NextDay"
    },
    Items = new[]
    {
        new LineItem()
        {
            SKU = "12345678901234567890",
            Description = "Item Description 1",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        },
        new LineItem()
        {
            SKU = "123456789012",
            Description = "Item Description 2",
            Quantity = 1,
            UnitCost = 400,
            Tax = 100,
            Total = 500
        }
    }.ToList(),
    Payment = new Payment()
    {
        TotalAmount = 1000,
        InvoiceNumber = "Inv 21540",
        InvoiceDescription = "Individual Invoice Description",
        InvoiceReference = "513456",
        CurrencyCode = "AUD"
    },
    RedirectUrl = "http://www.ewaypayments.com",
    SecuredCardData = "44DD7jYYyRgaQnVibOAsYbbFIYmSXbS6hmTxosAhG6CK1biw=",
};

var response = await rapidClient.EnrolDirectThreeDSecure(request);

3DS 2.0 Enrolment

The enrolment process generates the 3DS transaction.

The first step is to collect the card details and submit them to the 3DS 2.0 Enrolment endpoint of Rapid to begin the 3DS 2.0 process. If successful, the enrolment process will generate the 3DS transaction and return the Default3dsUrl and AccessCode in the response.

3DS 2.0 Enrolment Live Endpoints

Type Gateway URL
REST (POST) https://api.ewaypayments.com/3dsenrol

3DS 2.0 Enrolment Sandbox Endpoints

Type Gateway URL
REST (POST) https://api.sandbox.ewaypayments.com/3dsenrol

Request Field Descriptions

Field Name Field Type Max Length Data Type Description
Customer R N/A object This set of fields contains the details of the customer making the payment.
Payment R N/A object This set of fields contains the details of the payment which is going to be processed.

Field Types: R – Required, O – Optional, C – Conditionally Required

Customer

This set of fields contains the details of the merchant's customer.

Field Name Field Type Max Length Data Type Description
TokenCustomerID C 16 long An Eway-issued ID that represents the Token customer to be loaded for this action.
*Not required when submitting CardDetails or SecuredCardData
CardDetails C N/A object The card details section is within the Customer section
*Not required when submitting TokenCustomerID or SecuredCardData
SecuredCardData O 500 string Card data ID, used for Secure Fields
FirstName R 50 string The customer's first name
LastName R 50 string The customer's last name
Street1 C 50 string The customer's street address
*Not required for 3DS 2.0 when providing digital goods
Street2 C 50 string The customer's street address
*Not required for 3DS 2.0 when providing digital goods
City C 50 string The customer's city / town / suburb
*Not required for 3DS 2.0 when providing digital goods
State C 50 string The customer's state / county
*Not required for 3DS 2.0 when providing digital goods
PostalCode C 30 string The customer's post / zip code
Not required for 3DS 2.0 when providing digital goods*
Required when the customer’s billing country is US or CA
Country C 2 string The customer's country. This will be the two letter ISO 3166-1 alpha-2 code.
e.g. Australia = au
Not required for 3DS 2.0 when providing digital goods*
Required when the customer’s billing country is US or CA
Email R 50 string The customer's email address
Phone R 32 string The customer's phone number
RedirectUrl C 512 string The URL to redirect the customer to after they complete the 3DS 2.0 verification
*Not required when using the 3DS Javascript SDK

Field Types: R – Required, O – Optional, C – Conditionally Required

Card Details

The card details section is within the Customer section and is used to pass the customer's card details for the transaction.

Field Name Field Type Max Length Data Type Description
Name C 50 string The name of the card holder
Number C 50 int The card number that is to be processed for this transaction. This should be the encrypted value if using Client Side Encryption.
*Not required if passing TokenCustomerID or SecuredCardData
ExpiryMonth C 2 int The month that the card expires.
*Not required if passing TokenCustomerID or SecuredCardData
ExpiryYear C 2 int The year that the card expires.
*Not required if passing TokenCustomerID or SecuredCardData
CVN C 4 int The Card Verification Number. This should be the encrypted value if using Client Side Encryption. (Required if the TransactionTye is Purchase)
*Not required if passing TokenCustomerID or SecuredCardData

Field Types: R – Required, O – Optional, C – Conditionally Required

Payment

This set of fields contains the details of the payment being processed.

Field Name Field Type Max Length Data Type Description
TotalAmount R 10 int The amount of the transaction in the lowest denomination for the currency.
Example:
[1] For AUD, NZD, USD etc. These currencies have a decimal part: a $27.00 AUD transaction would have a TotalAmount = '2700'
[2] For VND, JPY, KRW etc. These currencies DO NOT have a decimal part: a 27 VND transaction would have TotalAmount = '27'
Reference Currency list - ISO 4127 Standard
CurrencyCode O 3 string The ISO 4217 3 character code that represents the currency that this transaction is to be processed in. If no value for this field is provided, the merchant's default currency is used. This should be in uppercase.
e.g. Australian Dollars = AUD

Field types: R – Required, C – Conditionally Required, O – Optional

Response

The 3D Secure 2.0 Enrolment response will contain a unique Default3dsUrl and AccessCode. To initiate the next step and authenticate the customer, you must either redirect them to the Default3dsUrl or pass the two values you have obtained to our 3DS Javascript SDK to complete the verification. Both these options are detailed under the 3D Secure Verification step below.

Example 3D Secure 2.0 Enrolment Response


{
    "Default3dsUrl": "https://api.sandbox.ewaypayments.com/3dsecure/75593848?AccessCode=44DD76JCBUSOCQo7YkWHxe5bBgfD2zxow_ylTYIxWxzjavmXsTt3QBuf8Wew6kcy4uo5RooAywCcIaYL_nRidwmp5BW3MHotKSPNX68KM4XVm6XgyUcjwmHUevvRIsGgxJ7UW",
    "AccessCode": "44DD76JCBUSOCQo7YkWHxe5bBgfD2zxow_ylTYIxWxzjavmXsTt3QBuf8Wew6kcy4uo5RooAywCcIaYL_nRidwmp5BW3MHotKSPNX68KM4XVm6XgyUcjwmHUevvRIsGgxJ7UW",
    "Errors": null
}


// response for enrol 3DS
IRapidClient rapidClient = new RapidClient(httpClient);
if (response.Errors != null)
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
else
{

    Console.WriteLine("AccessCode is : " + response.AccessCode);
}

Response Fields Descriptions

Field Name Max Length Data Type Description
Default3dsUrl 512 string The URL that allows the card holder to authenticate themselves with the card issuing bank
AccessCode 512 string A unique access code that is used to identify the transaction with Eway's Rapid API.
Errors 512 string A comma separated list of any error encountered. These can be looked up in the Response Codes section.

3D Secure 2.0 Verification example

curl --request POST 'https://api.sandbox.ewaypayments.com/3dsverify' \
--user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
--header 'Content-Type: application/json' \
--data-raw '{
    "AccessCode": "44DD76JCBUSOCQo7YkWHxe5bBgfD2zxow_ylTYIxWxzjavmXsTt3QBuf8Wew6kcy4uo5RooAywCcIaYL_nRidwmp5BW3MHotKSPNX68KM4XVm6XgyUcjwmHUevvRIsGgxJ7UW"
}'


// below code is for verify 3ds request
IRapidClient rapidClient = new RapidClient(httpClient);

VerifyDirectThreeDSecureRequest request =  new VerifyDirectThreeDSecureRequest
{
    AccessCode = "60CF3m7VY0PrvsphCIHKOaP9-rsLfvLtEH1kM2tiZTDmaUuh6fWLxo63V_L-z80IcBdt7UHRR-0eZC4I5Ooqq5aZE6SP5FaDvbsaE1ucUmMFP4PTfug_1ld9lEkLAL_sE__F0"
};

var response = await rapidClient.VerifyDirectThreeDSecure(request);

3DS 2.0 Verification

In the response to the enrolment request you will receive a Default3dsUrl to redirect the customer to, where they will be verified through the 3D Secure program and prompted for the one time password issued by their bank, if required.
If you would prefer to use your own page for the 3DS 2.0 verification rather than redirecting the customer off-site, you can do so by using Eway’s 3DS Javascript SDK and passing in the AccessCode contained in the response you received during the 3DS 2.0 Enrolment step.

3DS Javascript SDK example

<script type="text/javascript" src="<Replace with either the Live or Sandbox URL for the SDK>"></script>
Cerberus.run({ accessCode: <AccessCode from the Enrolment step>,
    onComplete: function() {
    window.location.replace(<Your Result Page URL>)
});


Live Javascript SDK

https://static.assets.eway.io/cerberus/6.6.2.54470/assets/sdk/cerberus.bundle.js

Sandbox Javascript SDK

https://static.assets.eway.io/cerberus/6.6.2.54470/assets/sdk/cerberus-sandbox.bundle.js


After the verification has been completed and the customer has been redirected to your specified RedirectUrl, you will need to obtain the verification results from 3DS 2.0. To do so, initiate an API call to the 3DS 2.0 Verification endpoint, passing through the AccessCode obtained from the enrolment step.

3DS 2.0 Verification Live Endpoints

Type Gateway URL
REST (POST) https://api.ewaypayments.com/3dsverify

3DS 2.0 Verification Sandbox Endpoints

Type Gateway URL
REST (POST) https://api.sandbox.ewaypayments.com/3dsverify

Request Field Descriptions

Field Name Field Type Max Length Data Type Description
AccessCode R 512 string The unique access code for the transaction that was generated as part of the Enrolment step.

Field types: R – Required, C – Conditionally Required, O – Optional

Example 3D Secure 2.0 Verification Response


{
    "AccessCode": "44DD76JCBUSOCQo7YkWHxe5bBgfD2zxow_ylTYIxWxzjavmXsTt3QBuf8Wew6kcy4uo5RooAywCcIaYL_nRidwmp5BW3MHotKSPNX68KM4XVm6XgyUcjwmHUevvRIsGgxJ7UW",
    "Enrolled": true,
    "ThreeDSecureAuth": {
        "Cryptogram": "2FVngpfh1sZWuSkUWedPTUfbRZVe",
        "ECI": "05",
        "XID": "2FVngpfh1sZWuSkUWedPTUfbRZVe",
        "AuthStatus": "Y",
        "Version": "2.1.0",
        "dsTransactionId": "34898df8-aeaf-4cc1-9200-b18c88b52522"
    },
    "Errors": null
}


// response for verify 3DS
IRapidClient rapidClient = new RapidClient(httpClient);
if (response.Errors != null)
{
    List<string> errorList = new List<string>();
    errorList = response.Errors.Split(',').ToList();
    var request = new CodeLookupRequest
    {
        Language = "en",
        ErrorCodes = errorList
    };
    var errorResponse = await rapidClient.APICodeLookup(request);
    foreach (ErrorCodeDetails codeDetails in errorResponse.CodeDetails)
    {
        Console.WriteLine("Response code: " + codeDetails.ErrorCode);
        Console.WriteLine("Response message: " + codeDetails.DisplayMessage);
    }
}
else
{
    if ((bool)response.TransactionStatus)
    {
        Console.WriteLine("3DS 2.0 ID is: " + response.ThreeDSecureAuth.dsTransactionId);
    }
}

Response

In the 3DS 2.0 Verification response you will receive values relating to the version of 3D Secure the transaction was verified through, along with the results of the verification.

Response Fields Descriptions

Field Name Max Length Data Type Description
AccessCode 512 string The unique access code that is used to identify the transaction with Eway’s Rapid API.
Enrolled 5 boolean A boolean value that indicates whether the card is enrolled 3D Secure or not.
ThreeDSecureAuth N/A object The 3DS authentication result. This will be null if Enrolled is false.
Errors 512 string A comma separated list of any error encountered. These can be looked up in the Response Codes section.

ThreeDSecureAuth

Field Name Max Length Data Type Description
Cryptogram 256 string The card holder authentication value
ECI 2 string The Electronic Commerce Indicator.
XID 28 string The Transaction identifier resulting from authentication processing through 3D Secure 1.0.
AuthStatus 1 string The result of the 3D Secure authentication. This value will be Y or A
Version 5 string The version of 3D Secure that the card holder was verified through. e.g. 1.0.0 or 2.0.1
dsTransactionId 28 string The Transaction Id for 3D Secure 2.0.

Direct Connection with 3D Secure 2.0 example

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '    {
        "Customer": {
            "CardDetails": {
                "Name": "John Smith",
                "Number": "4444333322221111",
                "ExpiryMonth": "12",
                "ExpiryYear": "25",
                "CVN": "123"
            },
            "FirstName": "John",
            "LastName": "Smith",
            "Street1": "Level 5",
            "Street2": "369 Queen Street",
            "City": "Sydney",
            "State": "NSW",
            "Country": "au",
            "PostalCode": "2000",
            "Phone": "098890986",
            "Email": "demo@example.org"
        },
        "PaymentInstrument": {
            "ThreeDSecureAuth": {
                "Cryptogram": "AgAAAAAA4n1uzQPRaATeQAAAAAA=",
                "ECI": "05",
                "XID": "AAAAAAAA4n1uzQPRaATeQAAAAAA=",
                "AuthStatus": "Y",
                "dsTransactionId": "AAAAAAAA4n1uzQPRaATeQAAAAAA=",
                "Version": "2.1.0"
            }
        },
        "Payment": {
            "TotalAmount": 1000
        },
        "Method": "ProcessPayment",
        "TransactionType": "Purchase"
    }' \
    https://api.sandbox.ewaypayments.com/Transaction


Processing the Payment

Once the 3D Secure 2.0 verification results have been obtained, you can submit them alongside the transaction details to Eway for processing through the Direct Connection method. The 3D Secure 2.0 verification results are submitted in the PaymentInstrument object in the request. For complete details around the parameters and flow for Direct Connection, please refer to the dedicated section of the documentation.

Client Side Encryption

Eway's Client Side Encryption securely encrypts sensitive credit card information in the customer's browser so that a non-PCI compliant merchant can accept the form data on their system and then process the payment directly with Eway using Direct Connection.

This allows you to handle the front end of the payment process completely and then process the payment in your back end. Customers have a uniform payment experience on your website creating confidence and improving sales.

Client Side Encryption is not a function supported by the Eway SDKs as they are for server side use and Client Side Encryption needs to occur in the user's browser. The exception to this are the Android and iOS Mobile SDKs which provide encryption functions.

How it works

Asymmetric encryption is used to encrypt the sensitive data using a public key from an RSA public/private key pair. The data is then only able to be decrypted by Eway's servers using the stored private key. The public key (the Client Side Encryption Key in MyEway) is made available to you for encryption, however the private key is retained by Eway so that only Eway is able to decrypt sensitive data.

In this way you can simply encrypt the sensitive data in the customer's browser, then pass it through to your server and make the Direct Connection request to Eway.

Implementation

1. Get the Client Side Encryption Key

First, get a copy of the Client Side Encryption Key from your Live or Sandbox MyEway account:

2. Encrypt the Card Data

The client side encryption script can be used in one of three ways:

Automatic Encryption

Example form

<html>

 <head>
   <title>Eway Payment Form</title>
 </head>

 <body>
   <form action="/createTransaction" method="POST" data-eway-encrypt-key="<MERCHANT CLIENT SIDE ENCRYPTION KEY STRING>">
    <label>Card Name</label>
     <input type="text" name="EWAY_CARDNAME" />
     <label>Card Number</label>
     <input type="text" data-eway-encrypt-name="EWAY_CARDNUMBER" />
     <label>CVV</label>
     <input type="text" data-eway-encrypt-name="EWAY_CARDCVN" />
     <input type="submit" id="submit" />
   </form>
   <script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"></script>
 </body>

</html>

1. Add the attribute data-eway-encrypt-key to the <form> tag and set it’s value as your Client Side Encryption Key.

<form data-eway-encrypt-key="<Client Side Encryption Key>">

2. Each form control to be encrypted must then have the attribute data-eway-encrypt-name and the control name you wish it to have.

<input type="text" data-eway-encrypt-name="EWAY_CARDNUMBER" />

<input type="text" data-eway-encrypt-name="EWAY_CARDCVN" />

3. After the form, include the eCrypt.js file:

</form> <script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"></script>

That’s all there is to it! Now when the form is submitted the eCrypt code will intercept the submission, encrypt the values with the data-eway-encrypt-name attribute, and submit the form.

Notes:

Encrypt Function

AJAX example
This example uses the jQuery AJAX function to submit form elements, encrypting the required fields before submission.

<html>

 <head>
   <title>eWAY Payment Form</title>
   <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
 </head>

 <body>
   <div id="info"></div>
   <form data-eway-encrypt-key="<MERCHANT CLIENT SIDE ENCRYPTION KEY STRING>">
    <label>Card Name</label>
     <input type="text" id="card_name" />
     <label>Card Number</label>
     <input type="text" id="card_number" />
     <label>CVV</label>
     <input type="text" id="card_cvn" />
     <input type="button" id="submit" value="Make Payment" />
   </form>
   <script src="https://secure.ewaypayments.com/scripts/eCrypt.min.js"></script>

   <script type="text/javascript">
     $(document).ready(function() {
       $('#submit').click(function(event) {
         $.ajax({
           url: 'ajax.php',
           type: 'POST',
           data: {
             card_name: $('#card_name').val(),
             card_number: eCrypt.encryptValue($('#card_number').val()),
             card_cvn: eCrypt.encryptValue($('#card_cvn').val())
           },
           success: function(data) {
             $('#info').html(data.response);
           }
         });
       });
     });
   </script>

 </body>

</html>

If the form does not use the submit function (such as when being submitted via AJAX) or there are other JavaScript overriding submit functions, an encrypt function can be used to encrypt the values. This function accepts a value to be encrypted and, optionally, the key to encrypt it with and returns the encrypted value. The encrypted values can then be passed with any other fields back to the server to complete the transaction.

The encrypt function is called in the following way:

eCrypt.encryptValue(value, key);

Parameters

Returns

The encrypted value

Debugging

To help investigate any errors encountered with the eCrypt JavaScript, there is also a non-minified version available for debugging:

<script src="https://secure.ewaypayments.com/scripts/eCrypt.js"></script>

Note: We recommend using the minified version for production deployments.

Encryption Service

This Rapid service can be used to encrypt sensitive data in scenarios where JavaScript can't be used (such as a mobile app) - it should not be used on a web server environment unless it is PCI compliant. Since this service is called from the client's device, the authentication method differs from the usual Rapid authentication method. This service is built into Eway's Android and iOS Mobile SDKs.

Live endpoint

Type Gateway URL
REST (POST) https://api.ewaypayments.com/encrypt

Sandbox endpoint

Type Gateway URL
REST (POST) https://api.sandbox.ewaypayments.com/encrypt

Authentication

Requests to the Encryption Service API need to be authenticated using basic authentication. This uses the "Pay Now Button Public API Key" which can be found in the same place as a user's Rapid API key:

The "Pay Now Button Public API Key" is sent in the Basic Authentication HTTP header in the username field, most frameworks and libraries provide a way to set these. No password is required.

If the Public API key is incorrect or missing, a normal HTTP responses (401) is used to indicate the authentication issues.

Request Field Descriptions

Basic Request

curl --request POST \
    --user XXX-XXXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX: \
    --header 'Content-Type: application/json' \
    --data '{
            "Method": "eCrypt",
            "Items": [
                {
                    "Name": "card",
                    "Value": "4444333322221111"
                },
                {
                    "Name": "CVN",
                    "Value": "123"
                }
            ]
        }' \
    https://api.sandbox.ewaypayments.com/encrypt
As this is a client side service, it is only available via REST
Field Name Field Type Data Type Description
Method R string The encryption method to use. This must be set to eCrypt
Items R array List of encryption items to encrypt

Items

This set of fields contains the details of the items to be encrypted.

Field Name Field Type Data Type Description
Name R string The name for the value. These are returned with the encrypted results
Value R string The value to be encrypted

Field types: R – Required, C – Conditionally Required, O – Optional

Response

Example response

{
    "Method": 1,
    "Items": [
        {
            "Name": "card",
            "Value": "eCrypted:Zw4URQ1LMm6RgXNbIVM1dlqcO15VkcURG/T1AOFnJ0hqXuxhbvB+aWoDNyU5Uvu26th3EZXntMMVWeYwJK2CauUJuTEhfxfSrQI2K0TqokHAbl1qK6I+xGjJBq+A8VRfwR2k8oiDFWHJko4Hz8vn3cG7UK+dqQR0YBXag2MHjEU6QUcA=="
        },
        {
            "Name": "CVN",
            "Value": "eCrypted:dat/Sm1dQY8vqEKP16tHbO178NEh1lSZvnI3kLeCk6G76EIx9Hn0xnZyuFnF6F1UHsuU74RZNbILi9I49IpdGETR/cmQnncYX85JPBWgFKxvqf2n9ae5iOC3E+QExGirbXWq3kUg6ivbUBKvQR4IL24g=="
        }
    ],
    "Errors": null
}

Example error response

{
   "Method": 2,
   "Items": [],
   "Errors": "V6160"
}

The response from Eway will contain the encrypted fields

Response Field Descriptions

Field Name Data Type Description
Method string The encryption method used
Items array List of encrypted items
Errors string The error codes of any errors that occurred with the encryption, these can be looked up in the Response and Error Codes section.

Items

This set of fields contains the details of the items that were encrypted.

Field Name Data Type Description
Name string The name for the encrypted value, the same as in the request
Value string The encrypted value

Refunds

Full and partial refunds can be processed for any transaction in Eway.

Live endpoints

Type Gateway URL
SDK "Production"
SOAP https://api.ewaypayments.com/soap.asmx
SOAP WSDL https://api.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.ewaypayments.com/Transaction/{TransactionID}/Refund
HTTP POST (XML) https://api.ewaypayments.com/DirectRefund.xml
HTTP POST (JSON) https://api.ewaypayments.com/DirectRefund.json
RPC (XML) https://api.ewaypayments.com/xml-rpc
RPC (JSON) https://api.ewaypayments.com/json-rpc

Sandbox endpoints

Type Gateway URL
SDK "Sandbox"
SOAP https://api.sandbox.ewaypayments.com/soap.asmx
SOAP WSDL https://api.sandbox.ewaypayments.com/soap.asmx?WSDL
REST (POST) https://api.sandbox.ewaypayments.com/Transaction/{TransactionID}/Refund
HTTP POST (XML) https://api.sandbox.ewaypayments.com/DirectRefund.xml
HTTP POST (JSON) https://api.sandbox.ewaypayments.com/DirectRefund.json
RPC (XML) https://api.sandbox.ewaypayments.com/xml-rpc
RPC (JSON) https://api.sandbox.ewaypayments.com/json-rpc

Request Field Descriptions

Basic Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Refund": {
           "TotalAmount": 10
        }
        }' \
    https://api.sandbox.ewaypayments.com/Transaction/11259550/Refund
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectRefund xmlns="https://api.ewaypayments.com/">
            <request>
                <Refund>
                    <TotalAmount>10</TotalAmount>
                    <TransactionID>11259550</TransactionID>
                </Refund>
            </request>
        </DirectRefund>
    </soap:Body>
</soap:Envelope>
<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$refund = [
    'Refund' => [
        'TransactionID' => 11259550,
        'TotalAmount' => 10
    ],
];

$response = $client->refund($refund);

RapidClient client = RapidSDK.newRapidClient(apiKey, password, rapidEndpoint);

RefundDetails refundDetails = new RefundDetails();
refundDetails.setOriginalTransactionID("11259550");
refundDetails.setTotalAmount(10);

Refund refund = new Refund();
refund.setRefundDetails(refundDetails);

RefundResponse response = client.refund(refund);
IRapidClient rapidClient = new RapidClient(httpClient);

DirectRefundRequest request = new DirectRefundRequest{
    Refund = new Refund(){
        TotalAmount = 100,
        TransactionID = "11259550"
    },
};

var response = await rapidClient.Refund(request.Refund.TransactionID, request);
var client = rapid.createClient(apiKey, password, rapidEndpoint);

client.refund({
    "Refund": {
       "TotalAmount": 10,
       "TransactionID": 11259550
    }
}).then(function (response) {

});
client = EwayRapid::RapidClient.new(api_key, password, endpoint)

refund = EwayRapid::Models::Refund.new
refund_details = EwayRapid::InternalModels::RefundDetails.new
refund_details.total_amount = 10
refund_details.original_transaction_id = 11259550
refund.refund_details = refund_details

response = client.refund(refund)

Complete Request

curl --request POST \
    --user 60CF3Ce97nRS1Z1Wp5m9kMmzHHEh8Rkuj31QCtVxjPWGYA9FymyqsK0Enm1P6mHJf0THbR:API-P4ss \
    --header 'Content-Type: application/json' \
    --data '{
        "Customer": {
           "Reference": "A12345",
           "Title": "Mr.",
           "FirstName": "John",
           "LastName": "Smith",
           "CompanyName": "Demo Shop 123",
           "JobDescription": "Developer",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "PostalCode": "2000",
           "Country": "au",
           "Phone": "09 889 0986",
           "Mobile": "09 889 6542",
           "Email": "demo@example.org",
           "Url": "http://www.ewaypayments.com",
            "CardDetails": {
             "ExpiryMonth": "12",
             "ExpiryYear": "25"
           }
        },
        "ShippingAddress": {
           "ShippingMethod": "NextDay",
           "FirstName": "John",
           "LastName": "Smith",
           "Street1": "Level 5",
           "Street2": "369 Queen Street",
           "City": "Sydney",
           "State": "NSW",
           "Country": "au",
           "PostalCode": "2000",
           "Phone": "09 889 0986"
        },
        "Items": [
         {
           "SKU": "12345678901234567890",
           "Description": "Item Description 1",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         },
         {
           "SKU": "123456789012",
           "Description": "Item Description 2",
           "Quantity": 1,
           "UnitCost": 400,
           "Tax": 100,
           "Total": 500
         }
        ],
        "Options": [
         {
           "Value": "Option1"
         },
         {
           "Value": "Option2"
         }
        ],
        "Refund": {
           "TotalAmount": 10,
           "InvoiceNumber": "Inv 21540",
           "InvoiceDescription": "Individual Invoice Description",
           "InvoiceReference": "513456",
           "CurrencyCode": "AUD"
        },
        "DeviceID": "D1234",
        "CustomerIP": "127.0.0.1",
        }' \
    https://api.sandbox.ewaypayments.com/Transaction/11259550/Refund
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
    <soap:Body>
        <DirectRefund xmlns="https://api.ewaypayments.com/">
            <request>
                <Customer>
                    <Reference>A12345</Reference>
                    <Title>Mr.</Title>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <CompanyName>Demo Shop 123</CompanyName>
                    <JobDescription>Developer</JobDescription>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Mobile>0289712345</Mobile>
                    <Comments>Customer comments</Comments>
                    <Fax>0289712345</Fax>
                    <Url>http://www.ewaypayments.com</Url>
                    <CardDetails>
                        <ExpiryMonth>12</ExpiryMonth>
                        <ExpiryYear>25</ExpiryYear>
                    </CardDetails>
                </Customer>
                <ShippingAddress>
                    <ShippingMethod>NextDay</ShippingMethod>
                    <FirstName>John</FirstName>
                    <LastName>Smith</LastName>
                    <Street1>Level 5</Street1>
                    <Street2>369 Queen Street</Street2>
                    <City>Sydney</City>
                    <State>NSW</State>
                    <PostalCode>2000</PostalCode>
                    <Country>au</Country>
                    <Email>demo@example.org</Email>
                    <Phone>0289712345</Phone>
                    <Fax>0289712345</Fax>
                </ShippingAddress>
                <Items>
                    <LineItem>
                        <SKU>12345678901234567890</SKU>
                        <Description>Item Description 1</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                    <LineItem>
                        <SKU>123456789012</SKU>
                        <Description>Item Description 2</Description>
                        <Quantity>1</Quantity>
                        <UnitCost>400</UnitCost>
                        <Tax>100</Tax>
                        <Total>500</Total>
                    </LineItem>
                </Items>
                <Options>
                    <Option>
                        <Value>Option1</Value>
                    </Option>
                    <Option>
                        <Value>Option2</Value>
                    </Option>
                </Options>
                <Refund>
                    <TotalAmount>100</TotalAmount>
                    <InvoiceNumber>Inv 21540</InvoiceNumber>
                    <InvoiceDescription>Individual Invoice Description</InvoiceDescription>
                    <InvoiceReference>Individual Invoice Description</InvoiceReference>
                    <CurrencyCode>AUD</CurrencyCode>
                    <TransactionID>11259550</TransactionID>
                </Refund>
                <CustomerIP>127.0.0.1</CustomerIP>
                <DeviceID>D1234</DeviceID>
            </request>
        </DirectRefund>
    </soap:Body>
</soap:Envelope>

<?php

$client = \Eway\Rapid::createClient($apiKey, $apiPassword, $apiEndpoint);

$refund = [
    'Customer' => [
        'Reference' => 'A12345',
        'Title' => 'Mr.',
        'FirstName' => 'John',
        'LastName' => 'Smith',
        'CompanyName' => 'Demo Shop 123',
        'JobDescription' => 'Developer',
        'Street1' => 'Level 5',
        'Street2'