NAV
cURL php .NET Ruby Python

Introduction

The API uses REST with request and response payloads formatted as JSON. This is the draft document and is subject to change.

Supported Payment Options

Payment Option Supported Country (ISO Code) Processing Currency
AliPay CN ¥ CNY
BrazilPay BR R$ Brazil Real
Bancontact (MisterCash) BE € Euro
CashU EG, JO, SA, AE $ USD
Credit Card US $ USD
EPS AT € Euro
GiroPay DE € Euro
IDEAL NL € Euro
mCoinz BH, EG, JO, KW, LB, OM, AE $ USD
PaySafe Card AR, AU, AT, BE, BG, CA, HR, HU, CY, CZ, DK, FI, FR, DE, GB*, GI, GR, IE, IT, LI, LV, LT, LU, MT, MX, NL, NO, PE, PL, PT, RO, SK, SI, ES, SE, CH, TR, UY, US € Euro
POLI AU, NZ AUD $, NZD $
Przelewy24 PL € Euro
QIWI RU ‎₽ RUB
SafetyPay AT, CO, CR, DE, ES, MX, NI, NL, PA, PE € Euro
SEPA AT, BE, BG, HR, CY, CZ, DK, EE, FI, FR, DE, GI, GR, HU, IS, IE, IT, LV, LI, LT, LU, MC, MT, NL, NO, PL, PT, RO, SK, SI, SM, ES, SE, CH, GB* € Euro
SOFORT Überweisung DE, AT, CH, BE, FR, NL, GB*, IT, ES, PL, HU, SK, CZ € Euro
Teleingreso ES € Euro
TenPay CN ¥ CNY
TrustPay BG, CZ, EE, FI, HU, LT, LV, RO, SL, SK € Euro
UnionPay CN ¥ CNY
Verkkopankki FI € Euro

Supported Currencies

Transactions can be submitted in the processing currency listed above for each payment option, or any of the currencies listed below. If not submitted in the processing currency, the submitted amount will be converted at the time of transaction.

Currency Code Symbol
Australia Dollar AUD $
New Zaeland Dollar NZD $
Brazil BRL R$
Euro EUR
United Kingdom Pound GBP £
Gibraltar Pound GIP £
Croatia Kuna HRK kn
Hungary Forint HUF Ft
Iceland Krona ISK kr
Norway Krone NOK kr
Poland Zloty PLN
Romania New Leu RON lei
Sweden Krona SEK kr
US Dollar USD $
Chinese Yuan Renminbi CNY ¥
Lithuanian Litas LTL Lt

Authentication

Authentication to the API occurs via HTTP Basic Auth. Provide your API key as the basic auth username. You do not need to provide a password.

The API defines Public and Secret keys.

Test and live keys are supported for an easy switch from test to live mode. The test key works in the exact same way as the live key but doesn’t do live transactions.

Keys are defined per website. You can manage your keys in your Merchant Tool.

Error Types Description
invalid_parameter_error Invalid request errors arise when your request has invalid parameters.
api_error API errors cover any other type of problem (e.g. a temporary problem with servers) and should turn up only very infrequently.
payment_error All errors related to invalid payment data, velocity control, fraud prevention.

Pagination

curl https://api.alternativepayments.com/api/transactions/?limit=<LIMIT>&offset=<OFFSET> \
-u <WEBSITE_SECRET_KEY>:

The above command returns JSON structured like this:

{
  "transactions": [
    {
      "id": "trn_345812d991",
      "mode": "Test",
      "status": "Created",
      "customer": {
        "id": "cus_a8e955b73cbd45348",
        "mode": "Test",
        "firstName": "Jonathan",
        "lastName": "Scott",
        "email": "ligula.consectetuer.rhoncus@Fusce.com",
        "country": "DE",
        "created": "2016-02-25T08:51:37.823Z"
      },
      "payment": {
        "id": "pay_b1f063633853412eb",
        "mode": "Test",
        "customerId": "cus_a8e955b73cbd45348",
        "paymentOption": "SEPA",
        "holder": "Jonathan Scott",
        "created": "2016-02-25T08:51:37.743Z"
      },
      "amount": 2499,
      "currency": "EUR",
      "merchantPassThruData": "7716902",
      "created": "2016-02-25T08:51:37.823Z"
    },
    {
      "id": "trn_ed77df2dcf",
      "mode": "Test",
      "status": "Created",
      "customer": {
        "id": "cus_4b08ee7682cb4afd8",
        "mode": "Test",
        "firstName": "ralf",
        "lastName": "Wright",
        "email": "eu@Namnullamagna.com",
        "country": "DE",
        "created": "2016-02-25T08:51:37.103Z"
      },
      "payment": {
        "id": "pay_37636b775d474cd4a",
        "mode": "Test",
        "customerId": "cus_4b08ee7682cb4afd8",
        "paymentOption": "SEPA",
        "holder": "ralf Wright",
        "created": "2016-02-25T08:51:37.073Z"
      },
      "amount": 2900,
      "currency": "EUR",
      "merchantPassThruData": "7718021",
      "created": "2016-02-25T08:51:37.103Z"
    }
  ],
  "pagination": {
    "offset": 10,
    "limit": 2,
    "count": 2504
  }
}

Some responses can have large collections of data. We support pagination using offset and limit parameters.

By default, when you search for something, we will return all the matching records. However, you can use a parameter called limit to tell the API how many records you want to return all at once.

GET https://api.alternativepayments.com/api/transactions?limit=5

To get all the records you need to use another parameter along with limit called offset. This parameter tells the API where to start returning records from the entire set of results. If you don’t include this parameter, the default is to start at record number 0 and then return the number of records specified with the ‘limit’ parameter.

GET https://api.alternativepayments.com/api/transactions?limit=5&offset=10

In API response, you will receive information about count, offset and count (for total record count).

Example:

"pagination": { "offset": 10, "limit": 5, "count": 2504 }

Webhooks

Sample data in JSON

{
  "id": "evt_5139d34fa67e4651ae2b5f",
  "type": "transaction.approved",
  "resourceName": "Transaction",
  "resource": {
    "id": "trn_23fc4cf",
    "mode": "Live",
    "status": "Pending",
    "customer": {
      "id": "cus_711e8c0f4f7b4893a",
      "mode": "Live",
      "firstName": "John",
      "lastName": "Doe",
      "email": "john@doe.com",
      "created": "2015-04-07T12:09:58.423Z"
    },
    "payment": {
      "id": "pay_20443651fcdf40228",
      "mode": "Live",
      "paymentOption": "SEPA",
      "customerId": "cus_711e8c0f4f7b4893a",
      "iban": "DE71XXXXX3330",
      "bic": "INGDDEFFXXX",
      "holder": "John Doe",
      "created": "2015-04-07T12:09:58.42Z"
    },
    "amount": 578,
    "currency": "EUR",
    "created": "2015-04-07T12:09:58.527Z"
  },
  "created": "2015-04-07T13:54:05.8961484Z"
}

With webhooks, we give you the possibility to react automatically to certain events which happen within our system. A webhook is basically a URL where we send an HTTP POST request to, every time one of the events attached to that webhook is triggered.

Event Code Description
transaction.pending The transaction has been created in the system and is awaiting an action.
transaction.approved A transaction that has been accepted by an acquirer.
transaction.funded A transaction that has been accepted by an acquirer and has passed the System defined settlement guidelines.
transaction.declined A status indicating that a transaction has been rejected prior to receiving an approved status.
transaction.chargeback A status received from the acquirer indicating a reversal of funds that was initiated by the consumer for a transaction.
transaction.isf A status indicating that there were insufficient funds in the consumer’s account to settle a transaction.
transaction.invalid A generic status received from the acquirer indicating that funds were unable to be transferred.
void.succeeded A status indicating that the transaction was nullified by the system prior to being approved.
void.declined Void of the transaction is declined.
refund.pending Refund of the transaction is processed by the System, but not yet refunded.
refund.succeeded A status indicating that funds were reversed for a transaction, and the amount or a portion of this amount was returned back to the consumer.
refund.declined Refund of the transaction is declined.
preauth.approved Preauthorization has been approved, the amount can be captured.
preauth.voided Preauthorization has been voided, the amount can not be captured.
preauth.declined Preauthorization has been declined, the amount can not be captured.

To confirm transaction status, you can use Retrieve a transaction API call.

Test mode

The live and test environments each have a different API key pair. Both Live and Test APIs use the same API endpoint and both environments work in the same way, with some exceptions: in Test mode statuses of the transactions are automatically changed to Funded after a short delay, and blacklist/velocity controls are ignored.

For payment options with redirections, in Test mode customer will be redirected to simulator page that can be used to simulate real bank hosted pages.

Which IBAN and BIC numbers to use when testing SEPA?

For SEPA we provide test IBAN/BIC numbers, so you can simulate different return responses. Also, these test IBAN codes skip IBAN validation. They are valid for Test mode only!

Test IBAN codes

IBAN code Transaction return response
DEST1000200030004000500 transaction is valid
DEST1001XXX00XINVALID transaction is invalid
DEST2002XXX00XISF Insufficient Funds - ISF
DEST3003XXX00XCHGBACK chargeback

Transaction

Attributes

Parameter Type Description Requirement
customer Customer object Customer object Optional, either Customer or customerId is required
customerId string Customer identifier Optional, either Customer or customerId is required
payment Payment object Payment object Optional, either Payment or token is required
token string Payment token Optional, either Payment or token is required
amount integer The used amount (calculated in cents) Required
currency string ISO 4217 formatted currency code Required
merchantPassThruData string Merchant’s identification Optional *Originating URL is required to be passed if you are an IPSP or service provider
merchantTransactionId string The unique identifier for a payment provided by the merchant Optional
description string Description Optional
ipAddress string Customer’s IP address Required
returnUrl string URL that customer is redirected to after the successful payment Required for payment options with redirection
cancelUrl string URL that customer is redirected to on aborted payment Required for payment options with redirection

Creating a Transaction

Every single payment request in the API will generate a Transaction. Each Transaction is uniquely identified by Transaction ID. To obtain details about a Transaction you need to make a separate GET request.

Using Payment Object

When creating a transaction, you can either send full payment object body each time transaction is made, or you can create payment object once and then reuse it when creating new transactions. Unlike token (can be used only once), payment object can be re used multiple times.

Creating Payment Object
curl https://api.alternativepayments.com/api/payments -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
"holder": "John Doe",
"paymentOption":"SEPA",
"iban":"AT85XXXXX0817"
}'

The above command returns JSON structured like this:

{
  "id": "pay_4c03abe649914b1a9",
  "mode": "Live",
  "paymentOption": "SEPA",
  "holder": "Jothn Smitht",
  "iban": "AT85XXXXX0817",
  "bic": "SPAEAT2SXXX",
  "created": "2016-09-09T03:40:32.7497062Z"
}

To create paymentObject, using Secret API key you must submit required payment object parameters. Required parameters for payment object vary depending on payment option used.

In response, paymentObject id will be sent.  

 

 

 

 

 

 

 

 

 

 

 

Creating transaction using Payment Object
curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "currency": "EUR",
  "amount": 500,
  "ipaddress": "123.456.789.10",
  "paymentid":"pay_56ba8feffe2142dfb",
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_d12209838b",
  "mode": "Live",
  "status": "Pending",
  "customer": {
    "id": "cus_de0636cef44540a4a",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-17T05:17:58.0438821Z"
  },
  "payment": {
    "id": "pay_917a86ff369e4f8a9",
    "mode": "Live",
    "paymentOption": "SEPA",
    "holder": "John Doe",
    "iban": "DE85XXXXX0817",
    "bic": "SPAEAT2SXXX",
    "created": "2016-03-17T05:17:58.0108663Z"
  },
  "amount": 500,
  "currency": "EUR",
  "created": "2016-03-17T05:17:58.0388728Z"
}

Once payment object has been created, you can create the transaction using generated "paymentid". So, you don’t need to send, for example, in the case of SEPA, holder, paymentOption or iban parameters.

Alipay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "CN"
  },
  "payment": {
    "paymentOption": "alipay",
   "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "CN",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "alipay",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string alipay Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Bancontact (MisterCash)

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "BE"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "mistercash",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("BE");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("mistercash");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "BE";

var payment = new Payment();
payment.paymentOption = "mistercash";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'BE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'mistercash',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='BE'
    )

    payment = Payment(
        paymentOption='mistercash',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "BE",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "mistercash",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string bancontact Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

BrazilPay Bank Transfer

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "Roberto",
    "lastName": "Doe",
    "email": "Roberto@Doe.com",
    "address": "Av Max Teixeira",
    "address2": "1040",
    "city": "Manaus",
    "zip": "69050-240",
    "country": "BR",
    "state": "AM",
    "birthDate": "02/05/1974",
    "phone": "+55AA7xxxxxxx",
  },
  "payment": {
    "paymentOption": "BrazilPayBankTransfer",
    "holder": "Roberto Doe",
    "documentId": "924.521.873-24",
    "bankCode": "hsbc",
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "123.456.789.10",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setFirstName("Roberto");
$customer->setLastName("Doe");
$customer->setEmail("Roberto@Doe.com");
$customer->setaddress("Av Max Teixeira");
$customer->setaddress2("1040");
$customer->setcity("Manaus");
$customer->setzip("69050-240");
$customer->setcountry("BR");
$customer->setstate("AM");
$customer->setBirthDate("02/05/1974");
$customer->setphone("+55AA7xxxxxxx");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("BrazilPayBoleto");
$payment->setHolder("Roberto Doe");
$payment->setDocumentId("924.521.873-24");
$payment->setbankCode("hsbc");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
 AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.FirstName = "Roberto";
customer.LastName = "Doe";
customer.Email = "Roberto@Doe.com";
customer.address = "Av Max Teixeira";
customer.address2 = "1040";
customer.city = "Manaus";
customer.zip = "69050-240";
customer.country = "BR";
customer.state = "AM";
customer.BirthDate = "02/05/1974";
customer.phone = "+55AA7xxxxxxx";

var payment = new Payment();
payment.paymentOption = "BrazilPayBankTransfer";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.DocumentId = "924.521.873-24";
payment.bankCode =  "hsbc";

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
    customer = ApRubySdk::Customer.new(
        'firstName' => 'Roberto',
        'lastName' => 'Doe',
        'email' => 'roberto@doe.com',
        'address' => '"Av Max Teixeira',
        'address2' => '1040',
        'city' => 'Manaus',
        'zip' => '69050-240',
        'country' => 'BR',
        'state' => 'AM',
        'birthDate' => '02/05/1974',
        'phone' => '+5572222312'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'BrazilPayBankTransfer',
        'holder' => 'Roberto Doe',
        'documentId' => '924.521.873-24',
        'bankCode' => 'hsbc'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 4500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
    customer = Customer(
        firstName='Roberto',
        lastName='Doe',
        email='roberto@doe.com',
        address='Av Max Teixeira',
        address2='1040',
        city='Manaus',
        zip='69050-240',
        country='BR',
        state='AM',
        birthDate='02/05/1974',
        phone='+5572222312'
    )

    payment = Payment(
        paymentOption='BrazilPayBankTransfer',
        holder='Roberto Doe',
        documentId='924.521.873-24',
        bankCode='hsbc'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 4500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_e28e2e57ab",
  "mode": "Live",
  "status": "Pending",
  "customer": {
    "id": "cus_a39f89674ea840ce8",
    "mode": "Live",
    "firstName": "Roberto",
    "lastName": "Doe",
    "email": "roberto@doe.com",
    "address": "Av Max Teixeira",
    "address2": "1040",
    "city": "Manaus",
    "zip": "69050-240",
    "country": "BR",
    "state": "AM",
    "phone": "+38132423423",
    "birthDate": "02/05/1974",
    "created": "2016-03-25T13:57:50.5420268Z"
  },
  "payment": {
    "id": "pay_9ce54df4423e4b228",
    "mode": "Live",
    "paymentOption": "BrazilPayBankTransfer",
    "holder": "Roberto Doe",
    "created": "2016-03-25T13:57:50.4484266Z",
    "bankCode": "hsbc",
    "documentId": "924.521.873-24"
  },
  "amount": 1700,
  "currency": "EUR",
  "ipaddress": "123.456.789.10",
  "merchantPassThruData": "stevs9aara12",
  "created": "2016-03-25T13:57:50.5420268Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "https:url.com//efredirect/?hash=56f540069"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string brazilpaybanktransfer Mandatory
holder string Customer’s First and Last Name Mandatory
DocumentId string Customer’s Document Id Mandatory
bankCode string Customer’s Bank Code Mandatory

Bank Codes

bankCode Bank name
banrisul Banrisul
bradesco Bradesco
bancodobrasil Banco do Brasil
hsbc HSBC Bank
itau Itaú

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Mandatory
address2 string Customer’s address - Street Number Mandatory
city string Customer’s city Mandatory
zip string Customer’s city Postal Code Mandatory
state string Customer’s state - 2 letter code Mandatory
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Mandatory
phone string Customer’s phone Number Mandatory

BrazilPay Boleto Bancário

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "Roberto",
    "lastName": "Doe",
    "email": "Roberto@Doe.com",
    "address": "Av Max Teixeira",
    "address2": "1040",
    "city": "Manaus",
    "zip": "69050-240",
    "country": "BR",
    "state": "AM",
    "birthDate": "02/05/1974",
    "phone": "+55AA7xxxxxxx",
  },
  "payment": {
    "paymentOption": "BrazilPayBoleto",
    "holder": "RobertoDoe",
    "documentId": "924.521.873-24",
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "123.456.789.10",
    "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setFirstName("Roberto");
$customer->setLastName("Doe");
$customer->setEmail("Roberto@Doe.com");
$customer->setaddress("Av Max Teixeira");
$customer->setaddress2("1040");
$customer->setcity("Manaus");
$customer->setzip("69050-240");
$customer->setcountry("BR");
$customer->setstate("AM");
$customer->setBirthDate("02/05/1974");
$customer->setphone("+55AA7xxxxxxx");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("BrazilPayBoleto");
$payment->setHolder("Roberto Doe");
$payment->setDocumentId("924.521.873-24");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.FirstName = "Roberto";
customer.LastName = "Doe";
customer.Email = "Roberto@Doe.com";
customer.address = "Av Max Teixeira";
customer.address2 = "1040";
customer.city = "Manaus";
customer.zip = "69050-240";
customer.country = "BR";
customer.state = "AM";
customer.BirthDate = "02/05/1974";
customer.phone = "+55AA7xxxxxxx";

var payment = new Payment();
payment.paymentOption = "BrazilPayBoleto";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.DocumentId = "924.521.873-24";

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.Amount = 100;
transaction.Currency = "EUR";

customer = ApRubySdk::Customer.new(
        'firstName' => 'Roberto',
        'lastName' => 'Doe',
        'email' => 'robero@doe.com',
        'address' => 'Av Max Teixeira',
        'address2' => '1040',
        'city' => 'Manaus',
        'zip' => '69050-240',
        'country' => 'BR',
        'state' => 'AM',
        'birthDate' => '13/05/1979',
        'phone' => '+5572222312'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'BrazilPayBoleto',
        'holder' => 'Roberto Doe',
        'documentId' => '924.521.873-24'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 4500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
    customer = Customer(
        firstName='Roberto',
        lastName='Doe',
        email='roberto@doe.com',
        address='Av Max Teixeira',
        address2='1040',
        city='Manaus',
        zip='69050-240',
        country='BR',
        state='AM',
        birthDate='02/05/1974',
        phone='+5572222312'
    )

    payment = Payment(
        paymentOption='BrazilPayBoleto',
        holder='Roberto Doe',
        documentId='924.521.873-24'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 4500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_43baf0cf75",
  "mode": "Live",
  "status": "Pending",
  "customer": {
    "id": "cus_cacc9d89ee674e44b",
    "mode": "Live",
    "firstName": "Roberto",
    "lastName": "Doe",
    "email": "roberto@doe.com",
    "address": "Av Max Teixeira",
    "address2": "1040",
    "city": "Manaus",
    "zip": "69050-240",
    "country": "BR",
    "state": "AM",
    "phone": "+38132423423",
    "birthDate": "02/05/1974",
    "created": "2016-03-25T14:00:38.0421808Z"
  },
  "payment": {
    "id": "pay_abcaa1351f5c45fe8",
    "mode": "Live",
    "paymentOption": "BrazilPayBoleto",
    "holder": "Jose Doe",
    "created": "2016-03-25T14:00:37.9641807Z",
    "documentId": "924.521.873-24"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "stevs9aara12",
  "created": "2016-03-25T14:00:38.0421808Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "https://sandbox.url.com/print/?hash=56f1bbf021c8a40"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string brazilpayboleto Mandatory
holder string Customer’s First and Last Name Mandatory
DocumentId string Customer’s Document Id Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Mandatory
address2 string Customer’s address - Street Number Mandatory
city string Customer’s city Mandatory
zip string Customer’s city Postal Code Mandatory
state string Customer’s state - 2 letter code Mandatory
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Mandatory
phone string Customer’s phone Number Mandatory

BrazilPay Charge Card

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "Roberto",
    "lastName": "Doe",
    "email": "Roberto@Doe.com",
    "address": "Av Max Teixeira",
    "address2": "1040",
    "city": "Manaus",
    "zip": "69050-240",
    "country": "BR",
    "state": "AM",
    "birthDate": "02/05/1974",
    "phone": "+55AA7xxxxxxx",
  },
  "payment": {
      "PaymentOption":"BrazilPayChargeCard",
      "Holder":"Habib Burgiba",
      "DocumentId":"851.453.477-03",
      "CreditCardType":"visa",
      "CreditCardNumber":"4111111111111111",
      "CVV2":"123",
      "ExpirationMonth":12,
      "ExpirationYear":2017
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "123.456.789.10",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_e28e2e57ab",
  "mode": "Live",
  "status": "Pending",
  "customer": {
    "id": "cus_a39f89674ea840ce8",
    "mode": "Live",
    "firstName": "Roberto",
    "lastName": "Doe",
    "email": "roberto@doe.com",
    "address": "Av Max Teixeira",
    "address2": "1040",
    "city": "Manaus",
    "zip": "69050-240",
    "country": "BR",
    "state": "AM",
    "phone": "+38132423423",
    "birthDate": "02/05/1974",
    "created": "2016-03-25T13:57:50.5420268Z"
  },
  "payment": {
    "id": "pay_f2c13c00da8d42adb",
    "mode": "Test",
    "paymentOption": "BrazilPayChargeCard",
    "holder": "Habib Burgiba",
    "created": "2017-02-09T10:01:13.5785715Z",
    "creditCardType": "visa",
    "creditCardNumber": "XXXXXXXXXXX1111",
    "ipAddress": "89.216.124.9"
  },
  "amount": 1700,
  "currency": "EUR",
  "ipaddress": "123.456.789.10",
  "created": "2016-03-25T13:57:50.5420268Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "https:url.com//efredirect/?hash=56f540069"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string brazilpaychargecard Mandatory
holder string Customer’s First and Last Name Mandatory
DocumentId string Customer’s Document Id Mandatory
bankCode string Customer’s Bank Code Mandatory

Bank Codes

bankCode Bank name
banrisul Banrisul
bradesco Bradesco
bancodobrasil Banco do Brasil
hsbc HSBC Bank
itau Itaú

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Mandatory
address2 string Customer’s address - Street Number Mandatory
city string Customer’s city Mandatory
zip string Customer’s city Postal Code Mandatory
state string Customer’s state - 2 letter code Mandatory
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Mandatory
phone string Customer’s phone Number Mandatory

CashU

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "EG"
  },
  "payment": {
    "paymentOption": "cashu",
   "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "EG",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "cashu",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string cashu Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Credit Card

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
   "customer":{
      "firstName":"John",
      "lastName":"Doe",
      "email":"john@doe.com",
      "country":"US"
   },
   "payment":{
    "paymentOption":"CreditCard",
   "holder":"John Doe",
   "creditCardNumber":"4111111111111111",
   "CVV2":"222",
   "creditCardType":"visa",
   "expirationYear":"2019",
   "expirationMonth":"12"
   },
   "amount":1500,
   "currency":"EUR",
   "ipaddress": "89.216.124.9"
}'

   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='US'
    )

    payment = Payment(
        paymentOption='CreditCard',
        holder='John Doe',
        creditCardNumber='4111111111111111',
        CVV2='222',
        creditCardType='visa',
        expirationYear='2019',
        expirationMonth='12'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_f7cb2b6631",
  "mode": "Test",
  "status": "Funded",
  "customer": {
    "id": "cus_ecaec09a0776434ea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "US",
    "created": "2016-05-19T08:18:51.1610893Z"
  },
  "payment": {
    "id": "pay_b8bc6359ef1b4e4da",
    "mode": "Test",
    "paymentOption": "CreditCard",
    "holder": "John Doe",
    "created": "2016-05-19T08:18:51.1298382Z",
    "creditCardNumber": "XXXXXXXXXXX1111",
    "creditCardType":"visa",
    "expirationMonth": 12,
    "expirationYear": 2019
  },
  "amount": 1500,
  "currency": "EUR",
  "created": "2016-05-19T08:18:51.1610893Z"
}

You can also use preauthorization prior to executing the transaction. For this, please see Preauthorization

If you’re accepting credit cards, tokenization must be used to be PCI compliant.

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string creditcard Mandatory
holder string Customer’s First and Last Name Mandatory
creditCardNumber string Customer’s CC number Mandatory
CVV2 integer Credit Card CVV2 number Mandatory
expirationYear integer Expiry year of the credit card Mandatory
expirationMonth integer Expiry month of the credit card Mandatory
creditCardType string Type of credit card Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

DirectPay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "89.216.124.9",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "directpay",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("directpay");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "DE";

var payment = new Payment();
payment.paymentOption = "directpay";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'DE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'directpay',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 100,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='DE'
    )

    payment = Payment(
        paymentOption='directpay',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 100,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "directpay",
    "holder": "John Doe",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

DirectPay is credit transfer payment method made at the initiative of the consumer, and the payment is “pushed” to the bank account of the merchant. Bank transfers are the most common form of cashless consumer payments in most countries within the European Union and Asia–Pacific. It is not suitable for subscriptions or recurring payments since the consumer must initiate each payment.

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string directpay Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

DirectPayMax

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "89.216.124.9",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "directpaymax",
     "bankCode": "POSTBANK"
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("directpaymax");
$payment->setHolder("John Doe");
$payment->setbankCode("POSTBANK");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "DE";

var payment = new Payment();
payment.paymentOption = "directpaymax";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.bankCode =  "POSTBANK";

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'DE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'directpaymax',
        'bankCode' => 'POSTBANK',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 100,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
    customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='DE'
    )

    payment = Payment(
        paymentOption='directpaymax',
        bankCode='POSTBANK',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 100,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "directpaymax",
    "bankCode": "POSTBANK",
    "holder": "John Doe",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

DirectPayMax provides a fast, easy to use and trusted method for consumers to make payments directly from their bank account. DirectPayMax There is no need for consumers to sign up, register, use a credit card or to provide additional personal information. They simply select their bank upon checkout and enter their common online banking information during a secure session to finalize their transaction.

EPS

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "payment": {
    "paymentOption": "eps",
    "bic": "TESTDETT421",
    "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'

$customer = new \AlternativePayments\Model\Customer();
$customer->setFirstName("John");
$customer->setLastName("Doe");
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("eps");
$payment->setHolder("John Doe");
$payment->setBIC("TESTDETT421");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = \AlternativePayments\Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.FirstName = "John";
customer.LastName = "Doe";
customer.Email = "john@doe.com";
customer.country = "DE";

var payment = new Payment();
payment.paymentOption = "eps";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.bic = "TESTDETT421";

var redirect = new RedirectUrls();
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'DE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'eps',
        'holder' => 'John Doe',
        'bic' => 'TESTDETT421'

    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
    customer = Customer(
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='DE'
    )

    payment = Payment(
        paymentOption='eps',
        holder='John Doe',
        bic='TESTDETT421'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34688",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ecea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "eps",
    "holder": "John Doe",
    "bic": "TESTDETT421",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 23,
  "currency": "EUR",
  "merchantPassThruData": "order_242444",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string eps Mandatory
holder string Customer’s First and Last Name Mandatory
BIC integer Customer’s BIC Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Giropay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "payment": {
    "paymentOption": "Giropay",
    "bic": "TESTDETT421",
    "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'

$customer = new \AlternativePayments\Model\Customer();
$customer->setFirstName("John");
$customer->setLastName("Doe");
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("Giropay");
$payment->setHolder("John Doe");
$payment->setBIC("TESTDETT421");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = \AlternativePayments\Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.FirstName = "John";
customer.LastName = "Doe";
customer.Email = "john@doe.com";
customer.country = "DE";

var payment = new Payment();
payment.paymentOption = "Giropay";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.bic = "TESTDETT421";

var redirect = new RedirectUrls();
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'DE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'Giropay',
        'holder' => 'John Doe',
        'bic' => 'TESTDETT421'

    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
    customer = Customer(
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='DE'
    )

    payment = Payment(
        paymentOption='Giropay',
        holder='John Doe',
        bic='TESTDETT421'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34688",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ecea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "Giropay",
    "holder": "John Doe",
    "bic": "TESTDETT421",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 23,
  "currency": "EUR",
  "merchantPassThruData": "order_242444",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string giropay Mandatory
holder string Customer’s First and Last Name Mandatory
BIC integer Customer’s BIC Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

iDEAL

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "NL"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "ideal",
    "bankCode": "ABN_AMRO"
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("BE");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("ideal");
$payment->setbankCode("ABN_AMRO");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "NL";

var payment = new Payment();
payment.paymentOption = "ideal";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.bankCode =  "ABN_AMRO";

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'NL'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'ideal',
        'holder' => 'John Doe',
        'bankCode' => 'ABN_AMRO'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='NL'
    )

    payment = Payment(
        paymentOption='ideal',
        holder='John Doe',
        bankCode='ABN_AMRO'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

        return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "NL",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "ideal",
    "holder": "Piet Saar",
    "bankCode": "ABN_AMRO",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string ideal Mandatory
holder string Customer’s First and Last Name Mandatory
bankCode string Customer’s Bank Code Mandatory
bankCode Bank name
ABN_AMRO ABN Amro
ASN_BANK ASN Bank
ING ING
KNAB_BANK Knab Bank
RABOBANK Rabobank
SNS_REGIO_BANK SNS Regio Bank
SNS_BANK SNS Bank
TRIODOS_BANK Triodos Bank
VAN_LANSCHOT_BANKIERS Van Lanschot Bankiers

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

mCoinz

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "SA"
  },
  "payment": {
    "paymentOption": "mcoinz",
   "holder": "John Doe",
   "PinCode":"CEEXXXXXXXXXC7"
  },
  "amount": 100,
  "currency": "USD",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "SA",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "mcoinz",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string mcoinz Mandatory
holder string Customer’s First and Last Name Mandatory
PinCode string mCoinz vaucher pincode Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

PaySafe Card

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "payment": {
    "paymentOption": "paysafe",
   "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "paysafe",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string paysafecard Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

POLi

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "AU"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "poli",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("AU");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("poli");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "AU";

var payment = new Payment();
payment.paymentOption = "poli";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'AU'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'poli',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='AU'
    )

    payment = Payment(
        paymentOption='poli',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "AU",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "poli",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string poli Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Przelewy24

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "PL"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "przelewy24",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("PL");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("przelewy24");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "PL";

var payment = new Payment();
payment.paymentOption = "przelewy24";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'PL'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'przelewy24',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='PL'
    )

    payment = Payment(
        paymentOption='przelewy24',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "PL",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "przelewy24",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string przelewy24 Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

QIWI

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "RU",
  "phone":"+7855555555555"
  },
  "payment": {
    "paymentOption": "qiwi",
   "holder": "John Doe"
  },
  "amount": 15000,
  "currency": "RUB",
  "ipaddress": "89.123.55.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34648",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "RU",
    "phone":"+7855555555555",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "qiwi",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 15000,
  "currency": "RUB",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string qiwi Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
country string Customer’s country - ISO1 country Code Mandatory
phone string Customer’s phone Number Mandatory

SafetyPay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "NL"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "SafetyPay",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("NL");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("SafetyPay");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "NL";

var payment = new Payment();
payment.paymentOption = "SafetyPay";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'NL'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'safetypay',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='NL'
    )

    payment = Payment(
        paymentOption='safetypay',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "NL",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "safetypay",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string safetypay Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

SEPA

You must specify 'SEPA’ as a parameter for 'paymentOption’.

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "SEPA",
    "iban": "DE71XXXXX3330"
  },
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("SEPA");
$payment->setHolder("John Doe");
$payment->setIBAN("DE71XXXXX3330");


$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "DE";

var payment = new Payment();
payment.paymentOption = "SEPA";
payment.IBAN = "DE71XXXXX3330";
payment.Holder = customer.FirstName + " " + customer.LastName;

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.Amount = 100;
transaction.Currency = "EUR";
customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'DE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'SEPA',
        'holder' => 'John Doe',
        'iban' => 'DE71XXXXX3330'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR'
    )
    customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='DE'
    )

    payment = Payment(
        paymentOption='SEPA',
        holder='John Doe',
        iban='BE88271080782541'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'merchantPassThruData': 'test_sepa_123',
        'iPAddress': '127.0.0.1'
    })

The above command returns JSON structured like this:

{
  "id": "trn_d12209838b",
  "mode": "Live",
  "status": "Pending",
  "customer": {
    "id": "cus_de0636cef44540a4a",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-17T05:17:58.0438821Z"
  },
  "payment": {
    "id": "pay_917a86ff369e4f8a9",
    "mode": "Live",
    "paymentOption": "SEPA",
    "holder": "John Doe",
    "iban": "DE85XXXXX0817",
    "bic": "SPAEAT2SXXX",
    "created": "2016-03-17T05:17:58.0108663Z"
  },
  "amount": 500,
  "ipaddress": "123.456.789.10",
  "currency": "EUR",
  "created": "2016-03-17T05:17:58.0388728Z"
}

ATTRIBUTES (for recurring payments)

Parameter Type Description Requirement
isRecurring string Set if the transaction is recurring or not. Must be true for recurring payments Mandatory for recurring transactions
initialTransactionId string transaction id of the first transaction in a series of recurring transactions Mandatory for transaction that is part of a series of recurring transactions

NOTE: If the transaction is sent without isRecurring and initialTransactionId parameters, it will be processed as a one-time transaction. For recurring transactions, you must use those parameters.

The initial transaction that is first in a series of recurring transactions must be sent with isRecurring set to true. For all subsequent transactions in the recurring series, you must use initialTransactionId of the first transaction that is part of that series.

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string sepa Mandatory
holder string Customer’s First and Last Name Mandatory
iban string customer’s IBAN code Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

PHONE VERIFICATION OBJECT

To create the transaction, phoneVerification object must be sent, together with all other required objects.

For a detailed explanation how creating of the transaction with SMS verification works, find out more in section Phone Verification.

Phone verification is mandatory on SEPA, but can be disabled on a case by case basis. To request disabling SMS verification, please contact us.

Parameter Type Description Requirement
token string generated token Mandatory
pin integer pin code received by SMS Mandatory

SOFORT Überweisung

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "payment": {
    "paymentOption": "sofortuberweisung",
   "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "sofortuberweisung",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string sofortuberweisung Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

TrustPay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "EE"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "TrustPay",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("EE");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("TrustPay");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "EE";

var payment = new Payment();
payment.paymentOption = "TrustPay";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'EE'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'TrustPay',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='EE'
    )

    payment = Payment(
        paymentOption='TrustPay',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "EE",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "TrustPay",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string trustpay Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Teleingreso

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "ES"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "teleingreso",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("ES");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("teleingreso");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "ES";

var payment = new Payment();
payment.paymentOption = "teleingreso";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'ES'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'teleingreso',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='ES'
    )

    payment = Payment(
        paymentOption='teleingreso',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "ES",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "teleingreso",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string teleingreso Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

TenPay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "CN"
  },
  "payment": {
    "paymentOption": "TenPay",
   "holder": "John Doe"
  },
  "amount": 300,
  "currency": "CNY",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "CN",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "TenPay",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 300,
  "currency": "CNY",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.alternativepayments.com/Redirect/TenPay/trn_2624d24gfg88"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string tenpay Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

UnionPay

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "CN"
  },
  "payment": {
    "paymentOption": "unionpay",
   "holder": "John Doe"
  },
  "amount": 100,
  "currency": "EUR",
  "ipaddress": "89.216.124.9",
  "redirectUrls": {
    "ReturnUrl":"http://plugins.alternativepayments.com/message/success.html",
    "CancelUrl":"http://plugins.alternativepayments.com/message/failure.html"
  }
}'

The above command returns JSON structured like this:

{
  "id": "trn_2bbcd34628",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_b9c6a32127724ffea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "CN",
    "created": "2016-03-25T14:04:41.7643102Z"
  },
  "payment": {
    "id": "pay_f633ab65f86b4dac8",
    "mode": "Test",
    "paymentOption": "UnionPay",
    "holder": "John Doe",
    "created": "2016-03-25T14:04:41.6863101Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2016-03-25T14:04:41.7643102Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "89.216.124.9",
  "redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string unionpay Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Verkkopankki

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "FI"
  },
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "123.456.789.10",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "verkkopankki",
  },
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  }
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("FI");
$customer->setFirstName("John");
$customer->setLastName("Doe");

$payment = new \AlternativePayments\Model\Payment();
$payment->setpaymentOption("verkkopankki");
$payment->setHolder("John Doe");

$redirect = new \AlternativePayments\Model\RedirectUrls();
$redirect->setReturnUrl("http://plugins.alternativepayments.com/message/success.html");
$redirect->setCancelUrl("http://plugins.alternativepayments.com/message/failure.html");

$transaction = new \AlternativePayments\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
AlternativePayments.ApiUrl = _apiUrl;

var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "FI";

var payment = new Payment();
payment.paymentOption = "verkkopankki";
payment.Holder = customer.FirstName + " " + customer.LastName;

var redirect = new RedirectUrls();
redirect.ReturnUrl = "http://plugins.alternativepayments.com/message/success.html"
redirect.CancelUrl = "http://plugins.alternativepayments.com/message/failure.html"

var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 250;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";

The above command returns JSON structured like this:

 customer = ApRubySdk::Customer.new(
        'firstName' => 'John',
        'lastName' => 'Doe',
        'email' => 'john@doe.com',
        'country' => 'FI'
    )

    payment = ApRubySdk::Payment.new(
        'paymentOption' => 'verkkopankki',
        'holder' => 'John Doe'
    )

    redirectUrls = ApRubySdk::RedirectUrls.new(
        'returnUrl' => 'http://plugins.alternativepayments.com/message/success.html',
        'cancelUrl' => 'http://plugins.alternativepayments.com/message/failure.html'
    )

    @transaction = ApRubySdk::Transaction.create(
        'customer' => customer,
        'payment' => payment,
        'amount' => 500,
        'currency' => 'EUR',
        'redirectUrls' => redirectUrls
    )
   customer = Customer(
        id='cus_bd838e3611d34d598',
        firstName='John',
        lastName='Doe',
        email='john@doe.com',
        country='FI'
    )

    payment = Payment(
        paymentOption='verkkopankki',
        holder='John Doe'
    )

    redirectUrls = RedirectUrls(
        returnUrl='http://plugins.alternativepayments.com/message/success.html',
        cancelUrl='http://plugins.alternativepayments.com/message/failure.html'
    )

    return Transaction.create({
        'customer': customer,
        'payment': payment,
        'amount': 500,
        'currency': 'EUR',
        'iPAddress': '127.0.0.1',
        'redirectUrls': redirectUrls
    })

The above command returns JSON structured like this:

{
  "id": "trn_1a5f5e0c97",
  "mode": "Test",
  "status": "Pending",
  "customer": {
    "id": "cus_bf682a6c051145a09",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "FI",
    "created": "2016-03-25T13:51:04.8497785Z"
  },
  "payment": {
    "id": "pay_ffd25121f84e4d249",
    "mode": "Test",
    "paymentOption": "verkkopankki",
    "holder": "Piet Saar",
    "created": "2016-03-25T13:51:04.7717784Z"
  },
  "amount": 1700,
  "currency": "EUR",
  "merchantPassThruData": "Order #1234958",
  "created": "2016-03-25T13:51:04.8497785Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "ipaddress": "123.456.789.10",
  "redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string verkkopankki Mandatory
holder string Customer’s First and Last Name Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Retrieve a Transaction

 curl https://api.alternativepayments.com/api/transactions/{transactionId} \
 -u <WEBSITE_SECRET_KEY>:
$res = Transaction :: get("trn_543256467");
AlternativePayments.ApiUrl = _apiUrl;
var id = "trn_543256467";
var result = AlternativePayments.Get(id).Result;
  def index
    if params[:transaction_id]
      @transaction = ApRubySdk::Transaction.retrieve(params[:transaction_id])
    end
  end
transaction = Transaction.retrieve(transaction_id)

The above command returns JSON structured like this:

{
    "id": "trn_5032300",
    "mode": "Live",
    "status": "Pending",
    "customer": {
        "id": "cus_8bfb7b0f7f9843458",
        "mode": "Live",
        "firstName": "Jane",
        "lastName": "Doe",
        "email": "jane@doe.com",
        "created": "2015-06-23T07:39:40.57Z"
    },
    "payment": {
        "id": "pay_7f1dcd13f19c4963a",
        "mode": "Live",
        "customerId": "cus_8bfb7b0f7f9843458",
        "holder": "John Doe",
        "created": "2015-06-23T07:39:40.517Z"
    },
    "amount": 100,
    "created": "2015-06-23T07:39:40.57Z"
}

Retrieves the details of a transaction using the identifier of the transaction (transaction id).

ATTRIBUTES

Parameter Type Description
id string Unique identifier of the transaction
REQUEST

GET https://api.alternativepayments.com/api/transactions/{id}

RESPONSE ATTRIBUTES
Parameter Type Description
id string Unique identifier for this transaction
mode Enum (Test, Live) Indication if the transaction was created using Test or Live keys
status Enum Identifies transaction status
amount integer Transaction amount
created string UTC creation date
customer customer object Customer Object
payment payment object Payment Object

List Transactions

 curl https://api.alternativepayments.com/api/transactions/ -u <WEBSITE_SECRET_KEY>:
$res = Transaction :: getAll();
AlternativePayments.ApiUrl = _apiUrl;
var result = AlternativePayments.GetAll().Result;
  def transactions
    @transactions = ApRubySdk::Transaction.all
  end

The above command returns JSON structured like this:

{
  "transactions": [
    {
      "id": "trn_2bbcd34688",
      "mode": "Test",
      "status": "Pending",
      "customer": {
        "id": "cus_b9c6a32127724ecea",
        "mode": "Test",
        "firstName": "John",
        "lastName": "Doe",
        "email": "john@doe.com",
        "country": "DE",
        "created": "2016-03-25T14:04:41.763Z"
      },
      "payment": {
        "id": "pay_f633ab65f86b4dac8",
        "mode": "Test",
        "customerId": "cus_b9c6a32127724ecea",
        "paymentOption": "giropay",
        "holder": "John Doe",
        "created": "2016-03-25T14:04:41.687Z"
      },
      "amount": 23,
      "currency": "EUR",
      "merchantPassThruData": "order_242444",
      "created": "2016-03-25T14:04:41.763Z",
      "redirectUrl": "http://cichents.com/Tn.aspx?transaction_id=trn_2bbcd34688"
    },
    {
      "id": "trn_1a5f5e0c97",
      "mode": "Test",
      "status": "Pending",
      "customer": {
        "id": "cus_bf682a6c051145a09",
        "mode": "Test",
        "firstName": "John",
        "lastName": "Doe",
        "email": "john@doe.com",
        "country": "BE",
        "created": "2016-03-25T13:51:04.85Z"
      },
      "payment": {
        "id": "pay_ffd25121f84e4d249",
        "mode": "Test",
        "customerId": "cus_bf682a6c051145a09",
        "paymentOption": "MisterCash",
        "holder": "Piet Saar",
        "created": "2016-03-25T13:51:04.773Z"
      },
      "amount": 1700,
      "currency": "EUR",
      "merchantPassThruData": "ideal",
      "created": "2016-03-25T13:51:04.85Z",
      "redirectUrl": "http://ce.io/ion.aspx?ion_id=trn_1a5f5e0c97"
    }
  ]

Returns a list of transactions created for the particular website.

REQUEST

GET https://api.alternativepayments.com/api/transactions/

List transaction

RESPONSE ATTRIBUTES

Parameter Type Description
id string Unique identifier for transaction
mode Enum (Test, Live) Indication if the transaction was created using Test or Live keys
status Enum Identifies transaction status
customer customer object Customer object
payment payment object Payment Object
amount integer Transaction amount
currency string ISO 4217 formatted currency code
created string UTC creation date

The above command returns JSON structured like this:

{
    "transactions": [
        {
            "id": "trn_4e8dc68",
            "mode": "Live",
            "status": "Refunded",
            "customer": {
                "id": "cus_004259ff7622456fb",
                "mode": "Live",
                "firstName": "Jane",
                "lastName": "Doe",
                "email": "jane@doe.com",
                "country": "DE",
                "created": "2015-06-22T13:35:38.467Z"
            },
            "payment": {
                "id": "pay_1ea32718e5664ae3b",
                "mode": "Live",
                "customerId": "cus_004259ff7622456fb",
                "paymentOption": "SEPA",
                "holder": "John Doe",
                "created": "2015-06-22T13:35:38.423Z"
            },
            "amount": 100,
            "currency": "EUR",
            "created": "2015-06-22T13:35:38.467Z"
        },
        {
            "id": "trn_cc7e03d",
            "mode": "Live",
            "status": "Refunded",
            "customer": {
                "id": "cus_4130397035104ca38",
                "mode": "Live",
                "firstName": "Jane",
                "lastName": "Doe",
                "email": "jane@doe.com",
                "country": "DE",
                "created": "2015-06-22T13:39:10.547Z"
            },
            "payment": {
                "id": "pay_1c45c65d5be24054a",
                "mode": "Live",
                "customerId": "cus_4130397035104ca38",
                "paymentOption": "SEPA",
                "holder": "John Doe",
                "created": "2015-06-22T13:39:10.493Z"
            },
            "amount": 100,
            "currency": "USD",
            "created": "2015-06-22T13:39:10.547Z"
        },
        {
            "id": "trn_5032300",
            "mode": "Live",
            "status": "Pending",
            "customer": {
                "id": "cus_8bfb7b0f7f9843458",
                "mode": "Live",
                "firstName": "Jane",
                "lastName": "Doe",
                "email": "jane@doe.com",
                "country": "DE",
                "created": "2015-06-23T07:39:40.57Z"
            },
            "payment": {
                "id": "pay_7f1dcd13f19c4963a",
                "mode": "Live",
                "customerId": "cus_8bfb7b0f7f9843458",
                "paymentOption": "SEPA",
                "holder": "Jane Doe",
                "created": "2015-06-23T07:39:40.517Z"
            },
            "amount": 100,
            "currency": "USD",
            "created": "2015-06-23T07:39:40.57Z"
        }
    ]
}

Refund a Transaction

curl https://api.alternativepayments.com/api/transactions/{transactionId}/refunds \
-u <WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
    "reason": "FRAUD"
}'
$obj = new \AlternativePayments\Model\RefundTransaction();
$obj->setReason(ReturnReason::UNSATISFIED_CUSTOMER);
$res = Refund :: post($obj, "trn_543256467");

var refund - new RefundTransaction(){

   Reason = "unsatisfied customer"
};

var result = AlternativePayments.Post<RefundTransaction>(refund, "Parent_code");
  def create
    refund = ApRubySdk::Transaction.refund(ApRubySdk::RefundReason::FRAUD, params[:transaction_id])

    flash[:notice] = refund.to_json
    redirect_to new_refund_url
  end
refund = Transaction.refund(RefundReason.FRAUD, transaction_id);

The above command returns JSON structured like this:

{
    "id": "ref_f811756",
    "mode": "Live",
    "amount": 89.77,
    "currency": "EUR",
    "reason": "FRAUD",
    "originalTransactionId": "trn_00dc520",
    "originalTransaction": {
        "id": "trn_00dc520",
        "mode": "Live",
        "status": "Refunded",
        "customer": {
            "id": "cus_0635336b935f4d14b",
            "mode": "Live",
            "firstName": "Jane",
            "lastName": "Doe",
            "email": "jane@doe.com",
            "country": "DE",
            "created": "2015-06-22T12:07:18.323Z"
        },
        "payment": {
            "id": "pay_55e66facd4874733a",
            "mode": "Live",
            "customerId": "cus_0635336b935f4d14b",
            "paymentOption": "SEPA",
            "holder": "John Doe",
            "created": "2015-06-22T12:07:17.71Z"
        },
        "amount": 100,
        "currency": "USD",
        "created": "2015-06-22T12:07:18.32Z"
    },
    "created": "2015-06-23T12:46:10.9169922Z",
    "status": "Approved"
}

Refunds a transaction that has been created previously.

ATTRIBUTES

Parameter Type Description
reason string Reason for refund, from pre defined list

REQUEST

POST https://api.alternativepayments.com/api/transactions/{transactionId}/refunds

Retrieve a Refund

curl https://api.alternativepayments.com/api/transactions/{transactionId}/refunds/{refundId} \
-u <WEBSITE_SECRET_KEY>:
$res = Refund :: get("trn_d70bcef", "trn_543256467");
var result = AlternativePayments.Get<Refund>(code, parentCode).Result;
  def index
    if params[:refund_id] && params[:transaction_id]
      @refund = ApRubySdk::Transaction.retrieve_refund(params[:refund_id], params[:transaction_id])
    end
  end

The above command returns JSON structured like this:

{
    "id": "ref_f811756",
    "mode": "Live",
    "amount": 89.77,
    "currency": "EUR",
    "originalTransactionId": "trn_00dc520",
    "originalTransaction": {
        "id": "trn_00dc520",
        "mode": "Live",
        "status": "Refunded",
        "customer": {
            "id": "cus_0635336b935f4d14b",
            "mode": "Live",
            "firstName": "Jane",
            "lastName": "Doe",
            "email": "jane@doe.com",
            "country": "DE",
            "created": "2015-06-22T12:07:18.323Z"
        },
        "payment": {
            "id": "pay_55e66facd4874733a",
            "mode": "Live",
            "customerId": "cus_0635336b935f4d14b",
            "paymentOption": "SEPA",
            "holder": "John Doe",
            "created": "2015-06-22T12:07:17.71Z"
        },
        "amount": 100,
        "currency": "USD",
        "created": "2015-06-22T12:07:18.32Z"
    },
    "created": "2015-06-23T12:46:10.917Z",
    "status": "Approved"
}

Retrieves the details of an existing refund.

REQUEST

GET https://api.alternativepayments.com/api/{transactionId}/refunds/{refundId}

List Refunds

curl https://api.alternativepayments.com/api/{transactionId}/refunds/{refundId} \
-u <WEBSITE_SECRET_KEY>:
$res = Refund :: getAll("trn_543256467");
var result = AlternativePayments.GetAll<Refund>(parentCode).Result;
  def index
    if params[:refund_id] && params[:transaction_id]
      @refund = ApRubySdk::Transaction.retrieve_refund(params[:refund_id], params[:transaction_id])
    end
  end
refund = Transaction.retrieve_refund(refund_id, transaction_id)

The above command returns JSON structured like this:

{
  "refundTransactions": [
{
    "id": "ref_f811756",
    "mode": "Live",
    "amount": 89.77,
    "currency": "EUR",
    "originalTransactionId": "trn_00dc520",
    "originalTransaction": {
        "id": "trn_00dc520",
        "mode": "Live",
        "status": "Refunded",
        "customer": {
            "id": "cus_0635336b935f4d14b",
            "mode": "Live",
            "firstName": "Jane",
            "lastName": "Doe",
            "email": "jane@doe.com",
            "country": "DE",
            "created": "2015-06-22T12:07:18.323Z"
        },
        "payment": {
            "id": "pay_55e66facd4874733a",
            "mode": "Live",
            "customerId": "cus_0635336b935f4d14b",
            "paymentOption": "SEPA",
            "holder": "John Doe",
            "created": "2015-06-22T12:07:17.71Z"
        },
        "amount": 100,
        "currency": "USD",
        "created": "2015-06-22T12:07:18.32Z"
    },
    "created": "2015-06-23T12:46:10.917Z",
    "status": "Approved"
}
  ]
}

Retrieve all refunds for individual transaction.

Retrieves the details of an existing refund.

REQUEST

GET https://api.alternativepayments.com/api/transactions/{transactionId}/refunds

Void a Transaction

curl https://api.alternativepayments.com/api/transactions/{transactionId}/voids \
-u <WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
    "reason": "FRAUD"
}'

$obj = new \AlternativePayments\Model\VoidTransaction();
$obj->setReason(ReturnReason::UNSATISFIED_CUSTOMER);
$res = Void :: post($obj, "trn_543256467");
var void - new VoidTransaction(){

   Reason = "unsatisfied customer"
};

var result = AlternativePayments.Post<VoidTransaction>(void, "Parent_code");
 def create
    void = ApRubySdk::Transaction.void(ApRubySdk::RefundReason::FRAUD, params[:transaction_id])

    flash[:notice] = void.to_json
    redirect_to new_void_url
  end
 void = Transaction.void(RefundReason.FRAUD, transaction_id);

The above command returns JSON structured like this:

{
    "id": "void_0a3f6b2",
    "mode": "Live",
    "amount": 4000,
    "currency": "EUR",
    "reason": "FRAUD",
    "originalTransactionId": "trn_41f1487",
    "originalTransaction": {
        "id": "trn_41f1487",
        "mode": "Live",
        "status": "Voided",
        "amount": 4000,
        "currency": "EUR",
        "created": "2015-06-24T11:46:35.303Z"
    },
    "created": "2015-06-24T11:47:30.6806641Z",
    "status": "Approved"
}

Void created transaction.

ATTRIBUTES

Parameter Type Description
reason string Reason for void, from pre defined list

REQUEST

POST https://api.alternativepayments.com/api/transactions/{transactionId}/voids

Retrieve a Void

curl https://api.alternativepayments.com/api/transactions/{transactionId}/voids/{voidId} \
-u <WEBSITE_SECRET_KEY>:
$res = Void :: get("trn_f09f256", "trn_543256467"); //class, void transaction if, parent transaction id
var result = AlternativePayments.Get<VoidTransaction>(code, parentCode).Result;
  def index
    if params[:void_id] && params[:transaction_id]
      @void = ApRubySdk::Transaction.retrieve_void(params[:void_id], params[:transaction_id])
    end
  end
void = Transaction.retrieve_void(void_id, transaction_id)

The above command returns JSON structured like this:

{
    "id": "void_0a3f6b2",
    "mode": "Live",
    "amount": 4000,
    "currency": "EUR",
    "originalTransactionId": "trn_41f1487",
    "originalTransaction": {
        "id": "trn_41f1487",
        "mode": "Live",
        "status": "Voided",
        "customer": {
            "id": "cus_7f0724f3b1d745d49",
            "mode": "Live",
            "firstName": "Jane",
            "lastName": "Doe",
            "email": "jane@doe.com",
            "country": "DE",
            "created": "2015-06-24T11:46:35.303Z"
        },
        "payment": {
            "id": "pay_13f3beaf091b43308",
            "mode": "Live",
            "customerId": "cus_7f0724f3b1d745d49",
            "paymentOption": "SEPA",
            "holder": "John Doe",
            "created": "2015-06-24T11:46:35.267Z"
        },
        "amount": 4000,
        "currency": "EUR",
        "created": "2015-06-24T11:46:35.303Z"
    },
    "created": "2015-06-24T11:47:30.68Z",
    "status": "Approved"
}          

Retrieves the details of an existing void.

ATTRIBUTES

Parameter Type Description
transactionId string Original transaction id

REQUEST

GET https://api.alternativepayments.com/api/transactions/{transactionId}/voids/{voidId}

Phone Verification

SMS verification is a fraud control tool to help prevent fraudulent payments. Customers (consumers) need to enter a PIN number they receive on their mobile to complete the transaction. SMS verification is mandatory on SEPA but can be disabled on a case by case basis.

Please note that no SMS is sent when using a test API key. To proceed past PIN entry field to complete test enter the test PIN number 1234.

To request disabling SMS verification, please contact us.

It is necessary to use internationally-standardized format for all phone numbers, and it includes all the relevant information to route SMS messages globally. For example, in Germany, and many other countries internationally, local dialing requires the addition of a '0’ in front of the subscriber number. However, to use standardized formatting, this '0’ must be removed. A number such as 017 5555 5555 in the Germany would be formatted as +491755555555.

If you choose to integrate our API on your checkout page, we advise splitting the mobile number into two fields, country prefix, and mobile number. Check if the mobile number entered begins with 0. If the customer enters a mobile number that begins with 0, drop the 0. Append country prefix to the mobile number based on customer’s selection.

Here is an example of the best practice for requesting a mobile number from the consumer:

Country selector

When the customer clicks the country selector, show a list of countries containing the flag, country name, and country prefix. Sorting A-Z is good, but it is recommended to show the most popular countries A-Z first, then a divider, then all other countries A-Z. The initially selected country should be the one that you get the most international traffic from, however, you can use any country you wish. We suggest not using the United States as the initially selected country, as most SEPA customers will not be in the US.

Country selector

Here is a list of popular countries, however you can edit as desired:
Austria
Belgium
France
Germany
Greece
Ireland
Italy
Netherlands
Spain
Sweden
Switzerland
United Kingdom
United States of America

To help with the integration here are some helpful downloads:
- Zip file of all country flags
- CSV file or JSON file of country codes and their country prefixes.

If you need further assistance, please do no hesitate to contact us.

Check if Verification is turned on

curl https://api.alternativepayments.com/api/websites/{publicKey}/paymentoptions/{paymentOption} \
-u <WEBSITE_SECRET_KEY>:


The above command returns JSON structured like this:

{
    "id": "web_6547gfhu67yrru43",
    "mode": "Test",
    "hasSmsVerification": true,
    "url": "http://www.mywebshop.com"
}

In response you will get hasSmsVerification parameter. If the value is true, SMS verification is active on the business case.

Send PIN by SMS

curl https://api.alternativepayments.com/api/phoneverification \
  -H "Content-Type:application/json" -X POST -d '
{
    "key":"pk_live_cyelxxxxxxxxddddddddBQuFeAGDDNG",
    "phone":"+15555555555"
}'


The above command returns JSON structured like this:

{
  "mode": "Live",
  "key": "pk_live_cyelxxxxxxxxddddddddBQuFeAGDDNG",
  "type": "SMS",
  "phone": "1555555555555",
  "token": "8b340ecdfc63ccccccc1fe59310",
  "created": "2016-05-26T00:25:55.6886656Z"
}

Before creating the transaction, API must send PIN code by SMS to customer’s phone. Customer will then receive pin code. You must send public key in the request using key parameter.

Create transaction using token and pin

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "currency": "EUR",
  "amount": 100,
  "ipaddress": "89.216.124.9",
  "payment": {
    "holder": "John Doe",
    "paymentOption": "SEPA",
    "iban": "DE71XXXXX3330"
  },
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "phoneverification":{
    "token":"8b340ecdfc63ccccccc1fe59310",
    "pin":"6010"
}'



The above command returns JSON structured like this:

{
  "id": "trn_d12209838b",
  "mode": "Live",
  "status": "Pending",
  "customer": {
    "id": "cus_de0636cef44540a4a",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-03-17T05:17:58.0438821Z"
  },
  "payment": {
    "id": "pay_917a86ff369e4f8a9",
    "mode": "Live",
    "paymentOption": "SEPA",
    "holder": "John Doe",
    "iban": "DE85XXXXX0817",
    "created": "2016-03-17T05:17:58.0108663Z"
  },
  "amount": 500,
  "currency": "EUR",
  "created": "2016-03-17T05:17:58.0388728Z",
  "phoneverification":{
    "token":"8b340ecdfc63ccccccc1fe59310",
    "pin":"6010"
  }
}

To create the transaction, phoneVerification object must be sent, together with all other required objects.

ATTRIBUTES

Parameter Type Description
token string generated token
pin integer pin code received by SMS

List Voids

curl https://api.alternativepayments.com/api/transactions/{transactionId}/voids \
-u <WEBSITE_SECRET_KEY>:
$res = Void :: getAll("trn_543256467");
var result = AlternativePayments.GetAll<VoidTransaction>(parentCode).Result;
def voids
    if params[:transaction_id]
      @voids = ApRubySdk::Transaction.voids(params[:transaction_id])
    end
  end

The above command returns JSON structured like this:

{
    "voidTransactions": [
        {
            "id": "void_0a3f6b2",
            "mode": "Live",
            "amount": 4000,
            "currency": "EUR",
            "reason": "Fraud",
            "originalTransactionId": "trn_41f1487",
            "originalTransaction": {
                "id": "trn_41f1487",
                "mode": "Live",
                "status": "Voided",
                "customer": {
                    "id": "cus_7f0724f3b1d745d49",
                    "mode": "Live",
                    "firstName": "Jane",
                    "lastName": "Doe",
                    "email": "jane@doe.com",
                    "country": "DE",
                    "created": "2015-06-24T11:46:35.303Z"
                },
                "payment": {
                    "id": "pay_13f3beaf091b43308",
                    "mode": "Live",
                    "customerId": "cus_7f0724f3b1d745d49",
                    "paymentOption": "SEPA",
                    "holder": "Johny Smithy",
                    "created": "2015-06-24T11:46:35.267Z"
                },
                "amount": 4000,
                "currency": "EUR",
                "created": "2015-06-24T11:46:35.303Z"
            },
            "created": "2015-06-24T11:47:30.68Z",
            "status": "Approved"
        }
    ]
}

Retrieves a list of all voids for an existing transaction.

ATTRIBUTES

Parameter Type Description
transactionId string Original transaction id

REQUEST

GET https://api.alternativepayments.com/api/transactions/{transactionId}/voids

Plans and Subscriptions

A subscription is defined as the association of a customer with a plan. It is used for recurring billing.

Create Plan

curl https://api.alternativepayments.com/api/plans -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "name": "Gold Unlimited",
  "description": "Monthly subscription to Gold Plan - 1 year",
  "amount": 1000,
  "currency": "EUR",
  "IntervalUnit": "Month",
  "IntervalCount": 1,
  "billingCycles": 12,
  "isConversionRateFixed": true,
  "ipAddress": "91.218.229.20",
  "trialPeriod": 7
}'

The above command returns JSON structured like this:

{
  "id": "pln_7021187813bb",
  "mode": "Live",
  "name": "Gold Unlimited",
  "description": "Monthly subscription to Gold Plan - 1 year",
  "amount": 1000,
  "currency": "EUR",
  "intervalUnit": "Month",
  "intervalCount": 1,
  "billingCycles": 12,
  "trialPeriod": 7,
  "isConversionRateFixed": true,
  "ipAddress": "91.218.229.20"
}

A subscription plan contains the pricing information for different products or features. Plan can be reused by assigning different customers and/or payment data.

ATTRIBUTES

Parameter Type Description Requirement
name string User-friendly label for the plan Mandatory
description string User-friendly description (verbose). Mandatory
amount integer what the customer will be charged per subscription per interval Mandatory
currency string Currency in which customer will be charged in Optional
intervalUnit integer the billing period for the plan, which can range from a single day to a year. The intervalUnit options are: day, week, month, or year. Mandatory
intervalCount integer Number which defines when the charge will be created, based on selected period. Mandatory
billingCycles integer Number of times plan is to be executed and recurring transaction created. Mandatory
trialPeriod integer Trial period in days before the first transaction is created. Optional
isConversionRateFixed boolean Option to set if transaction will be charged in original (fixed) exchange rate, or each time transaction is created it will be recalculated using current exchange rate: true or false Optional
ipAddress string IP Address Mandatory

Deactivate a Plan

curl https://api.alternativepayments.com/api/plans/pln_7021187813bb -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X DELETE -d '
{
 "cancelSubscriptions":false
}'

The above command returns JSON structured like this:

{
  "id": "pln_7021187813bb",
  "mode": "Live",
  "name": "Gold Unlimited",
  "description": "Monthly subscription to Gold Plan - 1 year",
  "amount": 1000,
  "currency": "EUR",
  "intervalUnit": "Month",
  "intervalCount": 1,
  "billingCycles": 12,
  "trialPeriod": 7,
  "isConversionRateFixed": true,
   "status": "Inactive",
  "created": "2016-12-01T09:42:25.207Z",
  "cancelSubscriptions": false
}

You can deactivate a plan, with an option to either cancel all associated subscriptions or leaving all associated subscription to be active until they expire. You need to pass "cancelSubscriptions" parameter.

ATTRIBUTES

Parameter Type Description Requirement
cancelSubscriptions boolean Option to either cancel all associated subscriptions or not. Can be true or false Mandatory

Update a Plan

curl https://api.alternativepayments.com/api/plans/pln_7021187813bb -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X PUT -d '
{
      "name": "Gold One Year",
      "description": "Monthly subscription to Gold One Year Plan - for one year!"
}'

The above command returns JSON structured like this:

{
  "id": "pln_7021187813bb",
  "mode": "Live",
  "name": "Gold One Year",
  "description": "Monthly subscription to Gold One Year Plan - for one year!",
  "amount": 1000,
  "currency": "EUR",
  "intervalUnit": "Month",
  "intervalCount": 1,
  "isConversionRateFixed": true,
  "created": "2016-12-01T12:56:35.09Z",
  "cancelSubscriptions": false
}

You can edit existing plan, but you can only edit name and description. If you want to edit, for example, amount, you must create a new plan and subscribe your customers to it.

ATTRIBUTES

Parameter Type Description Requirement
name string User-friendly label for the plan Optional
description string User-friendly description (verbose) Optional

Retreive a Plan

curl https://api.alternativepayments.com/api/plans/pln_7021187813bb -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X GET -d '
'

The above command returns JSON structured like this:

{
  "id": "pln_7021187813bb",
  "mode": "Live",
  "name": "Gold One Year",
  "description": "Monthly subscription to Gold One Year Plan - for one year!",
  "amount": 1000,
  "currency": "EUR",
  "intervalUnit": "Month",
  "intervalCount": 1,
  "isConversionRateFixed": true,
  "created": "2016-12-01T12:56:35.09Z",
  "ipAddress": "91.218.229.20"
}

You can edit existing plan, but you can only edit name and description. If you want to edit, for example, amount, you must create a new plan and subscribe your customers to it.

ATTRIBUTES

Parameter Type Description Requirement
name string User-friendly label for the plan Optional
description string User-friendly description (verbose) Optional

Create Subscription

curl https://api.alternativepayments.com/api/subscriptions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "payment": {
    "holder": "John Doe",
    "paymentOption": "SEPA",
    "iban": "NL02XXXXX9585"
  },
  "customer": {
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE"
  },
  "planId": "pln_7021187813bb",
  "ipAddress": "91.218.229.20",
  "quantity": 2
}'

The above command returns JSON structured like this:

{
  "id": "sbs_e71bbe5375af",
  "mode": "Live",
  "planId": "pln_7021187813bb",
  "customerId": "cus_5210f6ee95c445f5a",
  "customer": {
    "id": "cus_5210f6ee95c445f5a",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "created": "2016-12-01T10:40:34.258387Z"
  },
  "payment": {
    "id": "pay_7c3a29e41fba4171a",
    "mode": "Live",
    "paymentOption": "SEPA",
    "holder": "John Doe",
    "iban": "NL02XXXXX9585",
    "bic": "ABNANL2AXXX",
    "created": "2016-12-01T10:40:34.2243803Z"
  },
  "amount": 0,
  "isConversionRateFixed": false,
  "quantity": 2,
  "currentBillingCycle": 0,
  "ipAddress": "91.218.229.20",
  "status": "Trial",
  "created": "2016-12-01T10:40:34.3693928Z"
}

After creating a plan and collecting customer’s data, next step is to subscribe customers to plans.

ATTRIBUTES

Parameter Type Description Requirement
planId string id of the plan we are subscribing customer to Mandatory
quantity integer support multiple payment amounts, to adjust the amount to be billed. Mandatory
payment object object What the customer will be charged per subscription per interval Mandatory
customer object object Currency in which customer will be charged in Optional
ipAddress string IP Address Mandatory

Retrieve a Subscription

curl https://api.alternativepayments.com/api/subscriptions/sbs_b9a2ba8b8285 -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X GET -d '
'

The above command returns JSON structured like this:

{
  "id": "sbs_b9a2ba8b8285",
  "mode": "Live",
  "planId": "pln_e06119d1c5ab",
  "plan": {
    "id": "pln_e06119d1c5ab",
    "mode": "Live",
    "name": "Gold Unlimited",
    "description": "Monthly subscription to Gold Plan - 1 year",
    "amount": 1000,
    "currency": "EUR",
    "intervalUnit": "Month",
    "intervalCount": 1,
    "billingCycles": 12,
    "trialPeriod": 7,
    "isConversionRateFixed": true,
    "status": "Active",
    "ipAddress": "91.218.229.20",
    "created": "2016-12-01T13:25:53.797Z",
    "cancelSubscriptions": false
  },
  "customerId": "cus_f2043b2a4d7f4da99",
  "customer": {
    "id": "cus_f2043b2a4d7f4da99",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "created": "2016-12-01T13:26:03.363Z"
  },
  "paymentId": "pay_aa33d2cd1aaa49528",
  "payment": {
    "id": "pay_aa33d2cd1aaa49528",
    "mode": "Live",
    "holder": "John Doe",
    "created": "2016-12-01T13:26:03.34Z"
  },
  "amount": 2000,
  "currency": "EUR",
  "isConversionRateFixed": true,
  "quantity": 2,
  "trialEndDate": "2016-12-08T13:26:03.417Z",
  "nextRecurringDate": "2016-12-08T13:26:03.417Z",
  "currentBillingCycle": 0,
  "ipAddress": "91.218.229.20",
  "status": "Trial",
  "created": "2016-12-01T13:26:03.417Z"
}

You can edit existing plan, but you can only edit name and description. If you want to edit, for example, amount, you must create a new plan and subscribe your customers to it.

ATTRIBUTES

Parameter Type Description Requirement
name string User-friendly label for the plan Optional
description string User-friendly description (verbose) Optional

Hosted Page

You can create a transaction using our hosted page. When the transaction is created, you will receive redirect URL in redirectUrl, on which your customer should be redirected and where payment option can be selected to complete the payment.

Create Transaction

curl https://api.alternativepayments.com/api/transactions/hosted -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
   "Customer":{
    "FirstName":"John",
    "LastName":"Doe",
    "Email":"john@doe.com",
    "Country":"NL"
   },
   "Amount":200,
   "Currency":"EUR",
   "ipAddress":"192.168.0.1",
   "RedirectUrls":{
       "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
       "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
    }
}'

The above command returns JSON structured like this:

{
  "id": "trn_6a013b5221a7",
  "mode": "Live",
  "status": "Created",
  "customer": {
    "id": "cus_aacd0143efd349dd9",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "NL",
    "created": "2017-04-03T14:18:24.1812715Z"
  },
  "amount": 200,
  "currency": "EUR",
  "created": "2017-04-03T14:18:24.2332783Z",
  "redirectUrls": {
    "returnUrl": "http://plugins.alternativepayments.com/message/success.html",
    "cancelUrl": "http://plugins.alternativepayments.com/message/failure.html"
  },
  "redirectUrl": "https://checkout.alternativepayments.com/payment?id=8bf6dcxxxxxxxxxxxx8bdbb2",
  "ipAddress": "192.168.0.1"
}

To create a transaction using hosted page option you must send required parameters, which also include price, amount, customer’s email and customer’s country. They can’t be changed later on the hosted page.

ATTRIBUTES

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Sender’s First Name Mandatory
lastName string Sender’s Last Name Mandatory
email string Sender’s Email Mandatory
country string Sender’s country - ISO1 country Code Mandatory
Parameter Type Description Requirement
amount integer The used amount (calculated in cents) Mandatory
currency string ISO 4217 formatted currency code Mandatory
ipAddress string Customer’s IP address Mandatory
returnUrl string url that customer is redirected to after successful payment Mandatory
cancelUrl string url that customer is redirected to on aborted payment Mandatory

Transfer

Transfer is transaction that credits recipient’s account and is initiated by the Merchant.*

Create Transfer

curl https://api.alternativepayments.com/api/transfers -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
 "currency": "EUR",
 "amount": 100,
 "ipaddress": "192.168.0.1",
 "recipient": {
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@doe.com",
  "country": "DE",
  "payment": {
   "holder": "John Doe",
   "paymentOption": "SEPA",
   "iban": "BE88XXXXX2541"
  }
 },
 "sender": {
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane@doe.com",
  "country": "DE",
 }
}'

The above command returns JSON structured like this:

{
  "id": "tsf_f7614deaf8f6",
  "mode": "Live",
  "status": "Approved",
  "recipient": {
    "id": "cus_a8b90e060ec34544b",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "DE",
    "payment": {
      "id": "pay_781860822f034b1d9",
      "mode": "Live",
      "paymentOption": "SEPA",
      "holder": "John Doe",
      "iban": "BE88XXXXX2541",
      "bic": "GEBABEBBXXX",
      "created": "2017-03-27T11:18:16.3857116Z",
      "ipAddress": "192.168.0.1"
    },
    "created": "2017-03-27T11:18:16.4177116Z"
  },
  "sender": {
    "mode": "Live",
    "firstName": "Jane",
    "lastName": "Doe",
    "email": "jane@doe.com",
    "country": "DE",
    "created": "0001-01-01T00:00:00Z"
  },
  "amount": 100,
  "currency": "EUR",
  "created": "2017-03-27T11:18:16.4157111Z",
  "ipAddress": "192.168.0.1"
}

To create a transfer you must send recipient and sender objects. Recipient’s account will be credited for set amount, but if you want to debit Sender’s account, you must make separate debit transaction API call.

ATTRIBUTES

SENDER OBJECT

Parameter Type Description Requirement
firstName string Sender’s First Name Mandatory
lastName string Sender’s Last Name Mandatory
email string Sender’s Email Mandatory
country string Sender’s country - ISO1 country Code Mandatory

You must send sender’s object which represents information of the transaction sender. This will not automatically create a debit transaction, you must make that transaction separately.

RECIPIENT OBJECT

Parameter Type Description Requirement
firstName string Recipient’s First Name Mandatory
lastName string Recipient’s Last Name Mandatory
country string Recipient’s country - ISO1 country Code Mandatory
payment Payment object Payment object Mandatory

PAYMENT OBJECT ( to be sent in Recipient object)

Parameter Type Description Requirement
paymentOption string Payment Option Mandatory
holder string Recipient’s First and Last Name Mandatory
iban string Recipient’s IBAN code Mandatory

Preauthorization

Create preauthorization

curl https://api.alternativepayments.com/api/preauthorizations -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
   "customer":{
      "firstName":"John",
      "lastName":"Doe",
      "email":"john@doe.com",
      "country":"US"
   },
   "payment":{
    "paymentOption":"creditcard",
   "holder":"John Doe",
   "creditCardNumber":"4111111111111111",
   "creditCardType":"visa",
   "CVV2":"222",
   "expirationYear":"2019",
   "expirationMonth":"12"
   },
   "amount":1500,
   "currency":"EUR"
}'

The above command returns JSON structured like this:

{
  "id": "preauth_ee146f5315",
  "mode": "Test",
  "status": "Approved",
  "customer": {
    "id": "cus_67c05d47ed624db9b",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "US",
    "created": "2016-05-19T08:20:47.771416Z"
  },
  "payment": {
    "id": "pay_d893e7074c6441349",
    "mode": "Test",
    "paymentOption": "creditcard",
    "creditCardType":"visa",
    "holder": "John Doe",
    "created": "2016-05-19T08:20:47.7549104Z",
    "creditCardNumber": "XXXXXXXXXXX1111",
    "expirationMonth": 12,
    "expirationYear": 2019
  },
  "amount": 1500,
  "currency": "EUR",
  "created": "2016-05-19T08:20:47.7679118Z"
}

For payment options that support this (like Credit Card), you can reserve the amount from the client’s credit card, and later execute sale transaction itself. First, you will need to create pre-auth transaction, and after receiving transaction.approved event from that pre-auth transaction, capture the full amount of that pre-authorized transaction.

PAYMENT OBJECT

Parameter Type Description Requirement
paymentOption string Payment Option Mandatory
holder string Customer’s First and Last Name Mandatory
creditCardNumber string Customer’s CC number Mandatory
CVV2 integer Credit Card CVV2 number Mandatory
expirationYear integer Expiry year of the credit card Mandatory
expirationMonth integer Expiry month of the credit card Mandatory
creditCardType string Type of credit card Mandatory

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Capturing preauthorization


curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
   "customer":{
      "firstName":"John",
      "lastName":"Doe",
      "email":"john@doe.com",
      "country":"US"
   },
   "Preauthorization": "preauth_ee146f5315",
   "amount":1500,
   "currency":"EUR"
}'

The above command returns JSON structured like this:

{
  "id": "trn_f7cb2b6631",
  "mode": "Test",
  "status": "Funded",
  "customer": {
    "id": "cus_ecaec09a0776434ea",
    "mode": "Test",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "US",
    "created": "2016-05-19T08:18:51.1610893Z"
  },
  "payment": {
    "id": "pay_b8bc6359ef1b4e4da",
    "mode": "Test",
    "paymentOption": "creditcard",
    "holder": "John Doe",
    "created": "2016-05-19T08:18:51.1298382Z",
    "creditCardNumber": "XXXXXXXXXXX1111",
    "expirationMonth": 12,
    "expirationYear": 2019
  },
  "amount": 1500,
  "currency": "EUR",
  "created": "2016-05-19T08:18:51.1610893Z",
  "preauthorization": "preauth_ee146f5315"
}

When a preauthorization transaction is made, you must use its id to capture amount previously reserved. For preauthorization transaction, you will receive transaction.approved event to indicate when the amount can be captured.

CUSTOMER OBJECT

Parameter Type Description Requirement
firstName string Customer’s First Name Mandatory
lastName string Customer’s Last Name Mandatory
email string Customer’s Email Mandatory
address string Customer’s address - Street Name Optional
address2 string Customer’s address - Street Number Optional
city string Customer’s city Optional
zip string Customer’s city Postal Code Optional
state string Customer’s state - 2 letter code Optional
country string Customer’s country - ISO1 country Code Mandatory
birthday date Customer’s birthday - MM/DD/YYYY Optional
phone string Customer’s phone Number Optional

Tokens

If you want to process transactions or collect personally identifiable information without having to store locally sensitive data on your server, you can use the tokenization process. If you’re accepting credit cards, tokenization must be used to be PCI compliant.

You can create tokens using your Public API key. They should not be stored, and they can not be reused. To re-use payment information, please see Payment Object section.

Create Token

curl https://api.alternativepayments.com/api/tokens -u \
<WEBSITE_PUBLIC_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "paymentOption":"CreditCard",
  "holder":"John Doe",
  "creditCardNumber":"4111111111111111",
  "CVV2":"222",
  "creditCardType":"visa",
  "expirationYear":"2019",
  "expirationMonth":"12"
   }'

The above command returns JSON structured like this:

{
  "token": "VCtKKZza00g/3JjExts6S72GrVDxPfYG",
  "created": "2016-09-12T07:35:39.7618727Z"
}

Creates a single use token that wraps the details of a payment information, and can be used only once.

Parameter Type Description Requirement
paymentOption string Payment Option Mandatory
holder string Customer’s First and Last Name Mandatory
CC number, cvv2, IBAN, etc. string payment/bank information - depending on paymentOption Mandatory

Create transaction

curl https://api.alternativepayments.com/api/transactions -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
   "customer":{
      "firstName":"John",
      "lastName":"Doe",
      "email":"john@doe.com",
      "country":"US"
   },
   "amount":1500,
   "currency":"EUR",
   "ipaddress": "89.216.124.9",
   "token": "VCtKKZza00g/3JjExts6S72GrVDxPfYG"
}'

The above command returns JSON structured like this:

{
  "id": "trn_b0d0c2716215",
  "mode": "Live",
  "status": "Funded",
  "customer": {
    "id": "cus_fec53db887ef402ba",
    "mode": "Live",
    "firstName": "John",
    "lastName": "Doe",
    "email": "john@doe.com",
    "country": "US",
    "created": "2016-09-11T23:35:24.4821996Z"
  },
  "payment": {
    "id": "pay_56510f9a22634ae08",
    "mode": "Live",
    "paymentOption": "Credit Card",
    "holder": "John Doe",
    "created": "2016-09-11T23:35:24.3981701Z",
    "creditCardType": "visa",
    "creditCardNumber": "XXXXXXXXXXX1111",
    "expirationMonth": 12,
    "expirationYear": 2019,
    "cvV2": "222"
  },
  "amount": 1500,
  "currency": "EUR",
  "created": "2016-09-11T23:35:24.445176Z",
  "token": "VCtKKZza00g/3JjExts6S72GrVDxPfYG",
  "ipAddress": "89.216.124.9"
}

To create a transaction using a token, you must send customer object, amount, currency and token that was received.

Parameter Type Description Requirement
customer Customer object Customer object Mandatory
holder string Customer’s First and Last Name Mandatory
currency string ISO 4217 formatted currency code Mandatory
amount integer The used amount (calculated in cents) Mandatory
token string Payment token Mandatory

Customers

Create a Customer

curl https://api.alternativepayments.com/api/customers -u \
<WEBSITE_SECRET_KEY>:  -H "Content-Type:application/json" -X POST -d '
{
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@doe.com",
  "address": "Rutledge Ave 409",
  "city": "Folsom",
  "zip": "19033",
  "country": "US",
  "state":"PA",
  "phone": "55555555555"
}'
$customer = new \AlternativePayments\Model\Customer();
$customer->setEmail("testsdfsd@gmail.com");
$customer->setcountry("DE");
$customer->setFirstName("Steve");
$customer->setLastName("McManaman");
$customer->setIp("192.168.100.100");
$res = Customer :: post($customer);
AlternativePayments.ApiUrl = _apiUrl;

Customer c = new Customer()
{
    FirstName = "Tname1",
    LastName = "Lname1",
    Email = "mymail1@email.com",
    Ip = "127.0.0.1",
    state = "DE"
};

var result = AlternativePayments.Post<Customer>(c).Result;

The above command returns JSON structured like this:

{
  "id": "cus_bd838e3611d34d598",
  "mode": "Live",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@doe.com",
  "address": "Rutledge Ave 409",
  "city": "Folsom",
  "zip": "19033",
  "country": "US",
  "state": "PA",
  "phone": "55555555555",
  "created": "2016-03-24T15:19:10.7800694Z"
}

Customers can be created individually by you or they will be automatically generated with the transaction if there is no customer ID transmitted.

ATTRIBUTES

Parameter Type Description
firstName string First name
lastName string Last name
email string Email
address string (optional) address
city string (optional) city
zip string (optional) city ZIP code
country string (optional) country
state string (optional) state
phone string (optional) phone number

Retrieve a Customer

Retrieves the details of an existing customer.


curl https://api.alternativepayments.com/api/customers/{id} \
-u <WEBSITE_SECRET_KEY>:
$res = Customer :: get("cus_123456aaa");
AlternativePayments.ApiUrl = _apiUrl;

var result = AlternativePayments.Get<Customer>("cus_nonprofitaaa").Result;

The above command returns JSON structured like this:

{
  "id": "cus_bd838e3611d34d598",
  "mode": "Live",
  "firstName": "John",
  "lastName": "Doe",
  "email": "john@doe.com",
  "address": "Rutledge Ave 409",
  "city": "Folsom",
  "zip": "19033",
  "country": "US",
  "state": "PA",
  "phone": "55555555555",
  "created": "2016-03-24T15:19:10.7800694Z"
}

ATTRIBUTES

Parameter Type Description
id string Customer’s id

List Customers

Returns a list of your customers.

curl https://api.alternativepayments.com/api/customers \
-u <WEBSITE_SECRET_KEY>:
$res = Customer :: getAll();
AlternativePayments.ApiUrl = _apiUrl;
var result = AlternativePayments.GetAll<Customer>().Result;

The above command returns JSON structured like this:

{
    "customers": [
        {
            "id": "cus_7f0724f3b1d745d49",
            "mode": "Live",
            "firstName": "Jane",
            "lastName": "Doe",
            "email": "jane@doe.com",
            "country": "DE",
            "created": "2015-06-24T11:46:35.303Z"
        },
        {
            "id": "cus_15b154da474247dbb",
            "mode": "Live",
            "firstName": "John",
            "lastName": "Doe",
            "email": "john@doe.com",
            "address": "Rutledge Ave 409",
            "city": "Folsom",
            "zip": "19033",
            "country": "US",
            "phone": "55555555555",
            "created": "2015-06-24T12:28:06.527Z"
        }
    ]
}

Errors

Atributes

type Description
invalid_parameter_error Invalid paremeter was sent
payment_error Transaction failed to be created due to payment issue
api_error API errors

List of errors for invalid_paremeter_error

Code Message Status Code
api_keys_not_provided API keys are not provided 401
invalid_api_keys Invalid API key %s 401
invalid_object_sent Object is not sent or invalid object is sent 400
missing_required_parameter Missing required parameter %s 400
invalid_parameter_error Invalid parameter %s 400
disabled_website Disabled website 400
invalid_website Invalid website 400
invalid_transaction_id Invalid transaction 400
invalid_original_transaction_id Invalid transaction 400
invalid_payment_id Invalid payment id 400
invalid_customer_id Invalid customer id 400
invalid_reason Invalid reason 400
provide_payment_or_token Provide either payment object or token 400
provide_customer_or_customerid Provide either customer object or customerid 400
invalid_payment_option Invalid payment option 400
invalid_iban Invalid IBAN 400
invalid_bic Invalid BIC 400
invalid_currency Invalid currency 400
negative_number Must be positive number 400
pin_not_sent Pin must be sent 400
email_domain_black_listed Email domain is found on the black list 400
information_on_black_list Information sent on the transaction are found on the blacklist 400
customer_black_listed Customer is found on the black list 400
number_of_transaction_exceeded_limit Number of the transactions exceeded limit 400
volume_of_transaction_exceeded_limit Volume of the transactions exceeded limit 400
max_transaction_amount Volume of the transactions is higher then maximum limit 400
min_transaction_amount Volume of the transactions is lower then minimum limit 400
invalid_country Invalid country 400
parameter_can_have_100_characters_maximum Parameter %s can have 100 characters maximum. 400
payment_option_is_not_active Payment option is not active. 503
cpf_name_and_birthdate_do_not_match CPF does not belong to the person making the payment. 400
customer_reached_payment_limit Customer reached the payment limit for the period. 400
currency_is_not_active_in_system Currency is not active in the system. 400
currency_is_not_active_in_system Currency is not active in the system. 400

List of errors for payment_error

Code Message Status Code
void_not_supported Void is not supported 402
refund_not_supported Refund is not supported 402
transaction_can_not_be_refunded The transaction can not be refunded 402
refund_already_sent Refund already sent 402
void_already_sent Void already sent 402
transaction_can_not_be_voided Transaction can not be voided 402
customer_must_be_at_least_16_years_old Customer must be at least 16 years old 402
bank_unknown Bank unknown. 400
transaction_timeout Timeout 408
transaction_aborted Transaction aborted by user. 400

List of errors for api_error

Code Message Status Code
api_error API Error 402
acquirer_down Acquirer Down 402
statuscode Description
200 OK - Everything worked as expected.
400 Bad Request - Usually missing a required parameter.
401 Unauthorized - No valid API key provided.
402 Request Failed - Parameters were valid but request failed.
404 Not Found - The requested item doesn’t exist.
500 Server errors - internal server error.