Introduction
This documentation is a concise reference manual containing instructions about how to effectively use and integrate with 2000charge API.
Supported Payment Options
| Payment Option | Supported Country (ISO Code) | Processing Currency |
|---|---|---|
| Bancontact | BE | € Euro |
| BLIK | PL | zł Polish Zloty |
| DirectPayEU | AR, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB, GI, GR, HR, HU, IE, IS, IT, LT, LU, LV, MK, MT, NL, NO, PL, PT, RO, RS, SE, SI, SK, TN, TR | € Euro |
| DPMax | AT, BE, BG, CY, CZ, DE, DK, EE, ES, FI, FR, GR, HR, HU, IE, IS, IT, LT, LU, LV, MT, NL, NO, PL, PT, RO, SE, SI, SK | € Euro |
| EPS | AT | € Euro |
| IDEAL | NL | € Euro |
| paysafecard | AT ,AU, BE, BG, CA, HR, HU, CH, CY, CZ, DK, ES, FI, FR, DE, GB*, GE, GI, GR, IE, IT, LI, LT, LU, MT, MX, NL, NO, NZ, PE, PL, PT, RO, SE, SI, SK, UY | € Euro, CHF Swiss Franc |
| PIX | BR | R$ Brazil Real |
| Przelewy24 | PL | zł Polish Zloty |
| SEPA | AL, AR, AT, BE, BG, CH, CY, CZ, DE, DK, EE, ES, FI, FR, GB*, GR, HR, HU, IE, IS, IT, LI, LT, LU, LV, MC, MD, ME, MK, MT, NL, NO, PL, PT, RO, SE, SI, SK, SM | € Euro |
- For United Kingdom use ISO code which is GB.
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 the transaction.
| Currency | Code | Symbol |
|---|---|---|
| Australia Dollar | AUD | $ |
| Brazil | BRL | R$ |
| Chinese Yuan Renminbi | CNY | ¥ |
| Euro | EUR | € |
| Gibraltar Pound | GIP | £ |
| Hungary Forint | HUF | Ft |
| Iceland Krona | ISK | kr |
| New Zaeland Dollar | NZD | $ |
| Norway Krone | NOK | kr |
| Poland Zloty | PLN | zł |
| Romania New Leu | RON | lei |
| Sweden Krona | SEK | kr |
| United Kingdom Pound | GBP | £ |
| US Dollar | USD | $ |
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.2000charge.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.2000charge.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.2000charge.com/api/transactions?limit=5&offset=10
In API response, you will receive information about the 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": "Test",
"status": "Pending",
"customer": {
"id": "cus_711e8c0f4f7b4893a",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"created": "2015-04-07T12:09:58.423Z"
},
"payment": {
"id": "pay_20443651fcdf40228",
"mode": "Test",
"paymentOption": "sepa",
"customerId": "cus_711e8c0f4f7b4893a",
"iban": "DEST1000200030004000500",
"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 |
|---|---|
| customer.created | The customer object has been created in the system. |
| transaction.pending | The transaction has been created in the system and is awaiting an action. |
| transaction.aborted | A status indicating that a transaction has been canceled by the consumer during confirmation on his e-banking account page. |
| 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 |
| transfer.pending | A transfer has been created in the system and is awaiting an action. |
| transfer.approved | A transfer has been approved by the bank. |
| transfer.voided | A transfer has been nullified by the system prior to being approved. |
| transfer.declined | A transfer has been declined prior to receiving an approved status. |
| 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 cannot be captured. |
| preauth.declined | Preauthorization has been declined, the amount cannot be captured. |
| plan.created | A status indicating that the plan has been created. |
| plan.deactivated | A status indicating that the plan has been deactivated. |
| plan.updated | A status indicating that the plan has been updated. |
| subscription.created | A status indicating that the subscription has been created. |
| subscription.canceled | A status indicating that the subscription has been canceled. |
| subscription.expired | A status indicating that the subscription has been expired. |
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 | Insuficient 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 |
| 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 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 |
Descriptors
curl https://api.2000charge.com/api/payments -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"payment": {
"holder": "John Doe",
"paymentOption": "sepa",
"iban": "DEST1000200030004000500"
},
"customer": {
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE"
},
"amount": 220,
"currency": "EUR",
"ipaddress": "123.1.1.1",
"customDescriptor": "Test descriptor which will be sent by Merchant",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
Once transaction has been made, a consumer’s bank account will show the descriptors. Some of our descriptors are turned off by default and you might have to contact our support, so they can assist you with adding more descriptors.
We offer the following descriptors:
| Parameter | Type | Description | Default |
|---|---|---|---|
| TransactionId | string | Transaction ID | Yes |
| WebsiteURL | string | Merchant’s Website Url | No |
| Company Name | string | Merchant’s Company Name | No |
| ProductDescription | string | Merchant’s Product Description | No |
| TransactionCreated | date | Date of the transaction | No |
| TransactionAmount | integer | Original Amount of the transaction | No |
| TransactionCurrency | string | Currency of the transaction | No |
We also offer the possibility of sending custom descriptors in the transaction request.
| Parameter | Type | Description | Default |
|---|---|---|---|
| customDescriptor | string | Custom Descriptor sent by Merchant | No |
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 reused multiple times.
Creating Payment Object
curl https://api.2000charge.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": "Test",
"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 paremeters for payment object vary depending on payment option used.
In response, paymentObject id will be sent.
Creating transaction using Payment Object
curl https://api.2000charge.com/api/transactions -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"currency": "EUR",
"amount": 500,
"ipaddress": "123.1.1.1",
"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": "Test",
"status": "Pending",
"customer": {
"id": "cus_de0636cef44540a4a",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"created": "2016-03-17T05:17:58.0438821Z"
},
"payment": {
"id": "pay_917a86ff369e4f8a9",
"mode": "Test",
"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 a transaction using generated "paymentid". So, you don’t need to send, for example, in case of SEPA, holder, paymentOption or iban parameters.
Bancontact
curl https://api.2000charge.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"
},
"payment": {
"paymentOption": "bancontact",
"holder": "John Doe",
},
"amount": 100,
"currency": "EUR",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("BE");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("boncontact");
$payment->setHolder("John Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "bancontact";
payment.Holder = customer.FirstName + " " + customer.LastName;
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'BE'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'bancontact',
'holder' => 'John Doe'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
id='cus_bd838e3611d34d598',
firstName='John',
lastName='Doe',
email='john@doe.com',
country='BE'
)
payment = Payment(
paymentOption='bancontact',
holder='John Doe'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.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": "bancontact",
"holder": "John Doe",
"created": "2016-03-25T13:51:04.7717784Z"
},
"amount": 100,
"currency": "EUR",
"merchantPassThruData": "Order #1234958",
"created": "2016-03-25T13:51:04.8497785Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | bancontact |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
BLIK
curl https://api.2000charge.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"
},
"payment": {
"paymentOption": "blik",
"holder": "John Doe",
},
"amount": 100,
"currency": "EUR",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("PL");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("blik");
$payment->setHolder("John Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "blik";
payment.Holder = customer.FirstName + " " + customer.LastName;
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'PL'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'blik',
'holder' => 'John Doe'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
id='cus_bd838e3611d34d598',
firstName='John',
lastName='Doe',
email='john@doe.com',
country='PL'
)
payment = Payment(
paymentOption='blik',
holder='John Doe'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.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": "blik",
"holder": "John Doe",
"created": "2016-03-25T13:51:04.7717784Z"
},
"amount": 100,
"currency": "EUR",
"merchantPassThruData": "Order #1234958",
"created": "2016-03-25T13:51:04.8497785Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | blik |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
DirectPayEU
curl https://api.2000charge.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": "directpayeu",
"holder": "John Doe"
},
"amount": 100,
"currency": "EUR",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("directpayeu");
$payment->setHolder("John Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "directpayeu";
payment.Holder = customer.FirstName + " " + customer.LastName;
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'DE'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'directpayeu',
'holder' => 'John Doe'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='DE'
)
payment = Payment(
paymentOption='directpayeu',
holder='John Doe'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
The above command returns JSON structured like this:
{
"id": "trn_a8f111115834f",
"mode": "Test",
"status": "Pending",
"customer": {
"id": "cus_117f802222d98b",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"created": "2017-01-18T10:04:01.6071148Z"
},
"payment": {
"id": "pay_1e51111224ffeb",
"mode": "Test",
"paymentOption": "directpayeu",
"holder": "John Doe",
"created": "2017-01-18T10:04:01.5831133Z",
"ipAddress": "123.1.1.1"
},
"amount": 100,
"currency": "EUR",
"created": "2018-01-18T10:04:01.6041154Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"redirectUrl": "https://2000charge.com/directpay/index/132111111111111111fd23e0d9515",
"ipAddress": "123.1.1.1"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | directpayeu |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
| documentId | string | Customer’s Document Id | Optional |
DPMax
curl https://api.2000charge.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":"DirectPayMax",
"holder":"John Doe",
"iban": "DE19500105171654629345"
},
"amount": 100,
"currency":"EUR",
"ipAddress":"123.1.1.1",
"redirectUrls":{
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("DirectPayMax");
$payment->setHolder("John Doe");
$payment->iban("DE19500105171654629345");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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.iban = "DE19500105171654629345";
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'DE'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'DirectPayMax',
'holder' => 'John Doe',
'iban' => 'DE19500105171654629345'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='DE'
)
payment = Payment(
paymentOption='DirectPayMax',
holder='John Doe',
iban='DE19500105171654629345'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
The above command returns JSON structured like this:
{
"id": "trn_4295124a85ea46",
"mode": "Live",
"status": "AwaitingPisAuthorization",
"customer": {
"id": "cus_ba0df2c1723347979",
"mode": "Live",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"created": "2022-04-12T09:26:22.4547812Z"
},
"payment": {
"id": "pay_35c9eb043a034301a",
"mode": "Live",
"paymentOption": "DirectPayMax",
"holder": "John Doe",
"iban": "DE19XXXXX9345",
"created": "2022-04-12T09:26:22.4234722Z",
"ipAddress": "123.1.1.1"
},
"amount": 100,
"currency": "EUR",
"created": "2022-04-12T09:26:22.4547812Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"redirectUrl": "http://authorization-url.com",
"authorizationFlow": "Redirect",
"ipAddress": "123.1.1.1"
}
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | DirectPayMax |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
| iban | string | Customers IBAN | IBAN or BIC should be provided |
| psuId | string | Payment Service User Id | Required for some institutions |
| bic | string | Customers BIC | IBAN or BIC should be provided |
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
EPS
curl https://api.2000charge.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": "AT"
},
"payment": {
"paymentOption": "eps",
"bic": "TESTDETT421",
"holder": "John Doe"
},
"amount": 100,
"currency": "EUR",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setFirstName("John");
$customer->setLastName("Doe");
$customer->setEmail("john@doe.com");
$customer->setcountry("AT");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("eps");
$payment->setHolder("John Doe");
$payment->setBIC("TESTDETT421");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = \2000charge\Transaction :: post($transaction);
2000charge.ApiUrl = _apiUrl;
var customer = new Customer();
customer.FirstName = "John";
customer.LastName = "Doe";
customer.Email = "john@doe.com";
customer.country = "AT";
var payment = new Payment();
payment.paymentOption = "eps";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.bic = "TESTDETT421";
var redirect = new RedirectUrls();
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'AT'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'eps',
'holder' => 'John Doe',
'bic' => 'TESTDETT421'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='AT'
)
payment = Payment(
paymentOption='eps',
holder='John Doe',
bic='TESTDETT421'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.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": "AT",
"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": 100,
"currency": "EUR",
"merchantPassThruData": "order_242444",
"created": "2016-03-25T14:04:41.7643102Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | eps |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
| BIC | string | Customer’s BIC | Mandatory |
iDEAL
curl https://api.2000charge.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"
},
"payment": {
"paymentOption": "iDEAL",
"holder": "John Doe"
},
"amount": 100,
"description": "Some description", // required
"merchantTransactionId": "12345678", // required
"currency": "EUR",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("NL");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("ideal");
$payment->setHolder("John Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setDescription("Some description");
$transaction->setMerchantTransactionId("12345678");
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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;
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Description = "Some description";
transaction.MerchantTransactionId = "12345678";
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'NL'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'ideal',
'holder' => 'John Doe'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'description' => 'Some description',
'merchantTransactionId' => '12345678',
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
id='cus_bd838e3611d34d598',
firstName='John',
lastName='Doe',
email='john@doe.com',
country='NL'
)
payment = Payment(
paymentOption='ideal',
holder='John Doe'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'description': 'Some description',
'merchantTransactionId': '12345678',
'currency': 'EUR',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
The above command returns JSON structured like this:
{
"id": "trn_afecfa2bb05d43",
"mode": "Live",
"status": "Pending",
"customer": {
"id": "cus_dd01be8ba9554de09",
"mode": "Live",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "NL",
"created": "2022-05-12T09:14:25.4679409Z"
},
"payment": {
"id": "pay_365485d22e59414b8",
"mode": "Live",
"paymentOption": "iDEAL",
"holder": "John Doe",
"created": "2022-05-12T09:14:25.4055419Z",
"ipAddress": "123.1.1.1"
},
"amount": 100,
"currency": "EUR",
"merchantTransactionId": "12345678",
"description": "Some description",
"created": "2022-05-12T09:14:25.4679409Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_afecfa2bb05d43"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | ideal |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
ATTRIBUTES
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| description | string | Description | Mandatory |
| merchantTransactionId | string | The unique identifier for a payment provided by the merchant | Mandatory |
PaySafe Card
curl https://api.2000charge.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": "123.1.1.1",
"redirectUrls": {
"ReturnUrl":"https://developers.2000charge.com/returnpages/success.html",
"CancelUrl":"https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("paysafe");
$payment->setHolder("John Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "paysafe";
payment.Holder = customer.FirstName + " " + customer.LastName;
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'DE'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'paysafe',
'holder' => 'John Doe'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
id='cus_bd838e3611d34d598',
firstName='John',
lastName='Doe',
email='john@doe.com',
country='DE'
)
payment = Payment(
paymentOption='paysafe',
holder='John Doe'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
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": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://checkout.nts.com/direction.aspx?transaction_id=trn_2688"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | paysafe |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
PIX
curl https://api.2000charge.com/api/transactions -u \
<WEBSITE_SECRET_KEY>
: -H "Content-Type:application/json" -X POST -d '
{
"customer": {
"firstName": "Roberto",
"lastName": "Doe",
"email": "Roberto@Doe.com",
"country": "BR"
},
"payment": {
"paymentOption": "pix",
"holder": "RobertoDoe",
"documentId": "014.423.868-35"
},
"amount": 100,
"currency": "BRL",
"description": "Purchase details",
"merchantTransactionId": "12345678",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setFirstName("Roberto");
$customer->setLastName("Doe");
$customer->setEmail("Roberto@Doe.com");
$customer->setcountry("BR");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("pix");
$payment->setHolder("Roberto Doe");
$payment->setDocumentId("014.423.868-35");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setAmount(100);
$transaction->setCurrency("BRL");
$transaction->setDescription("Purchase details");
$transaction->setMerchantTransactionId("12345678");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.ApiUrl = _apiUrl;
var customer = new Customer();
customer.FirstName = "Roberto";
customer.LastName = "Doe";
customer.Email = "Roberto@Doe.com";
customer.country = "BR";
var payment = new Payment();
payment.paymentOption = "pix";
payment.Holder = customer.FirstName + " " + customer.LastName;
payment.DocumentId = "014.423.868-35";
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.Amount = 100;
transaction.Currency = "BRL";
transaction.MerchantTransactionId = "12345678";
transaction.Description = "Purchase details";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'Roberto',
'lastName' => 'Doe',
'email' => 'robero@doe.com',
'country' => 'BR'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'pix',
'holder' => 'Roberto Doe',
'documentId' => '014.423.868-35'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'BRL',
'merchantTransactionId' => '12345678',
'description' => 'Purchase details',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='Roberto',
lastName='Doe',
email='roberto@doe.com',
country='BR'
)
payment = Payment(
paymentOption='pix',
holder='Roberto Doe',
documentId='014.423.868-35'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'BRL',
'merchantTransactionId': '12345678',
'description': 'Purchase details',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
The above command returns JSON structured like this:
{
"id": "trn_43baf0cf75",
"mode": "Test",
"status": "Pending",
"customer": {
"id": "cus_cacc9d89ee674e44b",
"mode": "Test",
"firstName": "Roberto",
"lastName": "Doe",
"email": "roberto@doe.com",
"country": "BR",
"created": "2024-03-25T14:00:38.0421808Z"
},
"payment": {
"id": "pay_abcaa1351f5c45fe8",
"mode": "Test",
"paymentOption": "pix",
"holder": "Roberto Doe",
"created": "2024-03-25T14:00:37.9641807Z",
"documentId": "014.423.868-35"
},
"amount": 100,
"currency": "BRL",
"merchantTransactionId": "12345678",
"created": "2024-03-25T14:00:38.0421808Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | pix |
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 |
| string | Customer’s Email | Mandatory | |
| country | string | Customer’s country - ISO1 country Code | Mandatory |
Przelewy24
curl https://api.2000charge.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"
},
"payment": {
"paymentOption": "przelewy24",
"holder": "John Doe",
},
"amount": 100,
"currency": "EUR",
"ipaddress": "123.1.1.1",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("PL");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("przelewy24");
$payment->setHolder("John Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.Description = "Test transaction";
transaction.IpAddress = "123.1.1.1";
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' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='PL'
)
payment = Payment(
paymentOption='przelewy24',
holder='John Doe'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.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": "John Doe",
"created": "2016-03-25T13:51:04.7717784Z"
},
"amount": 100,
"currency": "EUR",
"merchantPassThruData": "Order #1234958",
"created": "2016-03-25T13:51:04.8497785Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"ipaddress": "123.1.1.1",
"redirectUrl": "http://mybankingsite.com/hRedirection.aspx?transaction_id=trn_1a5f5e0c97"
}
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| paymentOption | string | przelewy24 |
Mandatory |
| holder | string | Customer’s First and Last Name | Mandatory |
SEPA
You must specify 'SEPA’ as a parameter for 'paymentOption’.
curl https://api.2000charge.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": "sepa",
"holder": "John Doe",
"iban": "DEST1000200030004000500"
},
"amount": 100,
"currency": "EUR",
"ipaddress": "123.1.1.1",
}
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("DE");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("sepa");
$payment->setHolder("John Doe");
$payment->setIBAN("DEST1000200030004000500");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setAmount(100);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "DEST1000200030004000500";
payment.Holder = customer.FirstName + " " + customer.LastName;
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.Amount = 100;
transaction.Currency = "EUR";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'DE'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'sepa',
'holder' => 'John Doe',
'iban' => 'DEST1000200030004000500'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 100,
'currency' => 'EUR',
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='DE'
)
payment = Payment(
paymentOption='sepa',
holder='John Doe',
iban='DEST1000200030004000500'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 100,
'currency': 'EUR',
'iPAddress': '123.1.1.1'
})
The above command returns JSON structured like this:
{
"id": "trn_d12209838b",
"mode": "Test",
"status": "Pending",
"customer": {
"id": "cus_de0636cef44540a4a",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"created": "2016-03-17T05:17:58.0438821Z"
},
"payment": {
"id": "pay_917a86ff369e4f8a9",
"mode": "Test",
"paymentOption": "sepa",
"holder": "John Doe",
"iban": "DESTXXXXX0500",
"bic": "SPAEAT2SXXX",
"created": "2016-03-17T05:17:58.0108663Z"
},
"amount": 100,
"ipaddress": "123.1.1.1",
"currency": "EUR",
"created": "2016-03-17T05:17:58.0388728Z"
}
ATTRIBUTES (for recuring 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 isRecuring and initialTransactionId parameters, it will be processed as a one-time transaction. For recurring transactions, you must use those parameters.
An initial transaction that is first in a series of recurring transactions must be sent with isRecuring set to true. For all subsequent transactions in the recuring series, you must use initialTransactionId of the first transaction that is part of that series.
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
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 |
Retrieving Transaction ↓
curl https://api.2000charge.com/api/transactions/{Id} \
-u <WEBSITE_SECRET_KEY>:
$res = Transaction :: get("trn_543256467");
2000charge.ApiUrl = _apiUrl;
var id = "trn_543256467";
var result = 2000charge.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_326cf8bab3a742",
"mode": "Live",
"status": "Funded",
"customer": {
"id": "cus_0fe9bf220263461c9",
"mode": "Live",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"created": "2020-10-05T10:25:32.677Z"
},
"paymentId": "pay_b010589bb3f944a48",
"payment": {
"id": "pay_b010589bb3f944a48",
"mode": "Live",
"customerId": "cus_0fe9bf220263461c9",
"paymentOption": "DirectPayMax",
"holder": "John Doe",
"created": "2020-10-05T10:25:32.56Z",
"ipAddress": "77.46.149.145"
},
"amount": 100,
"currency": "EUR",
"created": "2020-10-05T10:25:32.67Z",
"ipAddress": "77.46.149.145",
"sequenceType": "OOFF"
}
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 example
GET https://api.2000charge.com/api/transactions/trn_326cf8bab3a742
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 |
| customer | customer object | Customer Object |
| paymentId | string | Unique identifier for payment |
| payment | payment object | Payment Object |
| amount | integer | Transaction amount |
| currency | string | Transaction currency |
| created | string | UTC creation date |
| redirectUrl | string | Redirection URL |
| ipAddress | string | Customer IP address |
| sequenceType | string | Sequence type |
Retrieve SCT and SDD
curl GET https://api.2000charge.com/api/sepa/transactions/?{offset}&{Limit}&{CreatedFrom}&{CreatedTo}&{UpdatedFrom}&{UpdatedTo}&{transactionStatus} \
-u <WEBSITE_SECRET_KEY>:
$res = Transaction :: get("trn_543256467");
2000charge.ApiUrl = _apiUrl;
var id = "trn_543256467";
var result = 2000charge.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:
{
"transactions": [
{
"id": "trn_123a4bc5678",
"status": "Pending",
"customer": {
"firstName": "John",
"lastName": "Doe",
"country": "DE",
"created": "2018-06-12T11:18:58.913Z"
},
"amount": 200,
"currency": "EUR",
"created": "2018-06-17T12:00:18.977Z",
"updated": "2018-06-17T12:00:21.537Z",
"type": "Sale"
},
{
"id": "trn_123a4bc5678",
"status": "Pending",
"customer": {
"firstName": "John",
"lastName": "Doe",
"country": "DE",
"created": "2018-06-12T11:18:58.913Z"
},
"amount": 200,
"currency": "EUR",
"created": "2018-06-16T12:00:22.147Z",
"updated": "2018-06-16T12:00:25.407Z",
"type": "Sale"
},
{
"id": "trn_123a4bc5678",
"status": "Pending",
"customer": {
"firstName": "John",
"lastName": "Doe",
"country": "DE",
"created": "2018-06-12T11:18:58.913Z"
},
"amount": 200,
"currency": "EUR",
"created": "2018-06-15T12:00:21.033Z",
"updated": "2018-06-15T12:00:23.803Z",
"type": "Sale"
},
{
"id": "trn_123a4bc5678",
"status": "Pending",
"customer": {
"firstName": "John",
"lastName": "Doe",
"country": "DE",
"created": "2018-06-12T11:18:58.913Z"
},
"amount": 200,
"currency": "EUR",
"created": "2018-06-14T12:00:26.197Z",
"updated": "2018-06-14T12:00:29.91Z",
"type": "Sale"
}
],
"pagination": {
"offset": 0,
"limit": 20,
"count": 4
}
}
Retrieves the details of SEPA Credit Transfers(SCT) and SEPA Direct Debit Transactions(SDD).
REQUEST ATTRIBUTES
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| Offset | string | Number of pages | Optional |
| Limit | string | Upper Limit for transactions in response | Optional |
| CreatedFrom | date | Created FROM date and time | Optional |
| CreatedTo | date | Created TO date and time | Optional |
| UpdatedFrom | date | Updated FROM date and time | Optional |
| UpdatedTo | date | Updated TO date and time | Optional |
| transactionStatus | string | Transaction status | Optional |
Request example
GET https://api.2000charge.com/api/sepa/transactions/?offset=0&Limit=1000&CreatedFrom=2018-06-01T13:21:42Z&CreatedTo=2018-06-12T15:21:42Z&transactionStatus=Funded
RESPONSE ATTRIBUTES
| Parameter | Type | Description |
|---|---|---|
| id | string | Unique identifier for this transaction |
| status | string | Transaction status |
| merchantTransactionId | string | Reference ID |
| firstName | string | Customer’s First Name |
| lastName | string | Customer’s Last Name |
| country | string | Customer’s country - ISO1 country Code |
| created | date | Transaction created date and time |
| updated | date | Transaction updated date and time |
| type | string | Transaction type |
| declineReason | string | Returned/Declined reason |
| count | string | Total number of transaction |
TRANSACTION TYPES
| Transaction Type | Data Type | Description |
|---|---|---|
| Sale | string | Debit transactions |
| Transfer | string | Transfer transactions |
| Refund | string | Refunded transactions |
| Void | string | Voided transactions |
| Returned | string | Returned transactions (CB, ISF, Invalid) |
Retrieve Refund
curl https://api.2000charge.com/api/transactions/{transactionId}/refunds/{refundId} \
-u <WEBSITE_SECRET_KEY>:
$res = Refund :: get("trn_d70bcef", "trn_543256467");
var result = 2000charge.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": "Test",
"amount": 89.77,
"currency": "EUR",
"originalTransactionId": "trn_00dc520",
"originalTransaction": {
"id": "trn_00dc520",
"mode": "Test",
"status": "Refunded",
"customer": {
"id": "cus_0635336b935f4d14b",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-22T12:07:18.323Z"
},
"payment": {
"id": "pay_55e66facd4874733a",
"mode": "Test",
"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.2000charge.com/api/{transactionId}/refunds/{refundId}
Retrieve Void
curl https://api.2000charge.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 = 2000charge.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": "Test",
"amount": 4000,
"currency": "EUR",
"originalTransactionId": "trn_41f1487",
"originalTransaction": {
"id": "trn_41f1487",
"mode": "Test",
"status": "Voided",
"customer": {
"id": "cus_7f0724f3b1d745d49",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-24T11:46:35.303Z"
},
"payment": {
"id": "pay_13f3beaf091b43308",
"mode": "Test",
"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.2000charge.com/api/transactions/{transactionId}/voids/{voidId}
List Transactions ↓
-u <WEBSITE_SECRET_KEY>:
curl https://api.2000charge.com/api/transactions/
curl https://api.2000charge.com/api/transactions/?{offset}&{Limit}&{startDate}&{endDate}
$res = Transaction :: getAll();
2000charge.ApiUrl = _apiUrl;
var result = 2000charge.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"
}
]
This API call returns a list of transactions created for a particular website.
Request examples
GET https://api.2000charge.com/api/transactions/
GET https://api.2000charge.com/api/transactions/?offset=1&Limit=1000&startDate=2017-08-07T11:14:09.5621581Z&endDate=2018-06-18T11:14:09.5621581Z
REQUEST ATTRIBUTES
| Parameter | Type | Description |
|---|---|---|
| offset | string | Number of pages |
| Limit | string | Upper Limit for transactions in response |
| startDate | date | Created FROM date and time |
| endDate | date | Created TO date and time |
RESPONSE ATTRIBUTES
| Parameter | Type | Description |
|---|---|---|
| id | string | Unique identifier for the 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": "Test",
"status": "Refunded",
"customer": {
"id": "cus_004259ff7622456fb",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-22T13:35:38.467Z"
},
"payment": {
"id": "pay_1ea32718e5664ae3b",
"mode": "Test",
"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": "Test",
"status": "Refunded",
"customer": {
"id": "cus_4130397035104ca38",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-22T13:39:10.547Z"
},
"payment": {
"id": "pay_1c45c65d5be24054a",
"mode": "Test",
"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": "Test",
"status": "Pending",
"customer": {
"id": "cus_8bfb7b0f7f9843458",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-23T07:39:40.57Z"
},
"payment": {
"id": "pay_7f1dcd13f19c4963a",
"mode": "Test",
"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"
}
]
}
List Voids
curl https://api.2000charge.com/api/transactions/{transactionId}/voids \
-u <WEBSITE_SECRET_KEY>:
$res = Void :: getAll("trn_543256467");
var result = 2000charge.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": "Test",
"amount": 4000,
"currency": "EUR",
"reason": "Fraud",
"originalTransactionId": "trn_41f1487",
"originalTransaction": {
"id": "trn_41f1487",
"mode": "Test",
"status": "Voided",
"customer": {
"id": "cus_7f0724f3b1d745d49",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-24T11:46:35.303Z"
},
"payment": {
"id": "pay_13f3beaf091b43308",
"mode": "Test",
"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.2000charge.com/api/transactions/{transactionId}/voids
Refund a Transaction
curl https://api.2000charge.com/api/transactions/{transactionId}/refunds \
-u <WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"reason": "FRAUD"
}'
$obj = new \2000charge\Model\RefundTransaction();
$obj->setReason(ReturnReason::UNSATISFIED_CUSTOMER);
$res = Refund :: post($obj, "trn_543256467");
var refund - new RefundTransaction(){
Reason = "unsatisfied customer"
};
var result = 2000charge.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:
{
"transactionId": "trn_00dc520",
"reason": "FRAUD",
"message": "Your refund request has been accepted. Once processed, you will receive a webhook notification."
}
Refunds a transaction that has been created previously.
ATTRIBUTES
| Parameter | Type | Description |
|---|---|---|
| reason | string | Reason for the refund, from predefined list |
REFUND REASONS
| Parameter | Description |
|---|---|
| CHARGEBACK_AVOIDANCE | Chargeback avoidance |
| END_USER_ERROR | End user error |
| FRAUD | Fraud |
| UNSATISFIED_CUSTOMER | Unsatisfied customer |
| INVALID_TRANSACTION | Invalid transaction |
| MERCHANT_REQUEST | Merchant request |
| MANAGEMENT_REQUEST | Management request |
| DUPLICATED | Duplicated |
REQUEST
POST https://api.2000charge.com/api/transactions/{transactionId}/refunds
Void a Transaction
curl https://api.2000charge.com/api/transactions/{transactionId}/voids \
-u <WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"reason": "FRAUD"
}'
$obj = new \2000charge\Model\VoidTransaction();
$obj->setReason(ReturnReason::UNSATISFIED_CUSTOMER);
$res = Void :: post($obj, "trn_543256467");
var void - new VoidTransaction(){
Reason = "unsatisfied customer"
};
var result = 2000charge.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": "Test",
"amount": 4000,
"currency": "EUR",
"reason": "FRAUD",
"originalTransactionId": "trn_41f1487",
"originalTransaction": {
"id": "trn_41f1487",
"mode": "Test",
"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 predefined list |
REQUEST
POST https://api.2000charge.com/api/transactions/{transactionId}/voids
Transfer
The transfer is a transaction that credits recipient’s account and is initiated by the Merchant.*
Create Transfer
curl https://api.2000charge.com/api/transfers -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"sender": {
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE"
},
"recipient": {
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"payment": {
"holder": "John Doe",
"paymentOption": "sepa",
"iban": "BE88XXXXX2541"
}
},
"currency": "EUR",
"amount": 100,
"ipaddress": "123.1.1.1"
}
The above command returns JSON structured like this:
{
"id": "tsf_f7614deaf8f6",
"mode": "Test",
"status": "Approved",
"recipient": {
"id": "cus_a8b90e060ec34544b",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"payment": {
"id": "pay_781860822f034b1d9",
"mode": "Test",
"paymentOption": "sepa",
"holder": "John Doe",
"iban": "BE88XXXXX2541",
"bic": "GEBABEBBXXX",
"created": "2017-03-27T11:18:16.3857116Z",
"ipAddress": "123.1.1.1"
},
"created": "2017-03-27T11:18:16.4177116Z"
},
"sender": {
"mode": "Test",
"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": "123.1.1.1"
}
To create a transfer you must send recipient and sender objects. Recipient’s account will be credited for a 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 |
| 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 |
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.2000charge.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": "123.1.1.1",
"trialPeriod": 7
}'
The above command returns JSON structured like this:
{
"id": "pln_7021187813bb",
"mode": "Test",
"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": "123.1.1.1"
}
A subscription plan contains the pricing information for different products or features. The 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 | Mandatory |
| 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 the 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.2000charge.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": "Test",
"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. Please keep in mind, 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.2000charge.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": "Test",
"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 |
Retrieve a Plan
curl https://api.2000charge.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": "Test",
"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": "123.1.1.1"
}
You can retrieve plan information in the API request.
Create Subscription
curl https://api.2000charge.com/api/subscriptions -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"payment": {
"holder": "John Doe",
"paymentOption": "SEPA",
"iban": "DE8937040xxxxx13000"
},
"customer": {
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE"
},
"planId": "pln_41cd17a5fe13",
"ipAddress": "123.1.1.1",
"quantity": 2,
"phoneverification":{
"token":"1d91d2083c5d4xxxbb424798c2fafdca",
"pin":"9411"
}
}
The above command returns JSON structured like this:
{
"id": "sbs_e71bbe5375af",
"mode": "Test",
"planId": "pln_7021187813bb",
"customerId": "cus_5210f6ee95c445f5a",
"customer": {
"id": "cus_5210f6ee95c445f5a",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "DE",
"created": "2016-12-01T10:40:34.258387Z"
},
"payment": {
"id": "pay_7c3a29e41fba4171a",
"mode": "Test",
"paymentOption": "sepa",
"holder": "John Doe",
"iban": "DEST1000200030004000500",
"bic": "ABNANL2AXXX",
"created": "2016-12-01T10:40:34.2243803Z"
},
"amount": 0,
"isConversionRateFixed": false,
"quantity": 2,
"currentBillingCycle": 0,
"ipAddress": "123.1.1.1",
"status": "Trial",
"created": "2016-12-01T10:40:34.3693928Z",
"phoneVerification": {
"pin": "1212",
"token": "1d91d2083c5dxxxx24798c2fafdca"
}
}
After creating a plan and collecting customer’s data, next step is to subscribe customers to plans.
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Customer’s First Name | Mandatory |
| lastName | string | Customer’s Last Name | Mandatory |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
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 |
Retrieve a Subscription
curl https://api.2000charge.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": "Test",
"planId": "pln_e06119d1c5ab",
"plan": {
"id": "pln_e06119d1c5ab",
"mode": "Test",
"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": "123.1.1.1",
"created": "2016-12-01T13:25:53.797Z",
"cancelSubscriptions": false
},
"customerId": "cus_f2043b2a4d7f4da99",
"customer": {
"id": "cus_f2043b2a4d7f4da99",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"created": "2016-12-01T13:26:03.363Z"
},
"paymentId": "pay_aa3xd2cd1aaa49528",
"payment": {
"id": "pay_aa33d2cd1aaa49528",
"mode": "Test",
"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": "123.1.1.1",
"status": "Trial",
"created": "2016-12-01T13:26:03.417Z"
}
You can retrieve subscription information in the API request.
Cancel a Subscription
curl https://api.2000charge.com/api/subscriptions/sbs_b9a2ba8b8285 -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X DELETE -d '
{
"CancelationReason":"END_USER_ERROR"
}
The above command returns JSON structured like this:
{
"id": "sbs_a31ba70dcb4e",
"mode": "Live",
"planId": "pln_19f8cab8a077",
"plan": {
"id": "pln_19f8cab8a077",
"mode": "Live",
"name": "Payment Plan Name",
"description": "Payment Plan Description",
"amount": 1,
"currency": "EUR",
"intervalUnit": "Day",
"intervalCount": 1,
"billingCycles": 365,
"trialPeriod": 0,
"isConversionRateFixed": true,
"status": "Active",
"created": "2021-10-05T13:40:09.037Z",
"cancelSubscriptions": false
},
"customerId": "cus_c636c5c2ac974ad29",
"customer": {
"id": "cus_c636c5c2ac974ad29",
"mode": "Live",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"created": "2021-10-22T12:48:43.837Z"
},
"paymentId": "pay_18133c15b8d04b1da",
"payment": {
"id": "pay_18133c15b8d04b1da",
"mode": "Live",
"customerId": "cus_c636c5c2ac974ad29",
"paymentOption": "SEPA",
"holder": "John Doe",
"created": "2021-10-22T12:48:43.83Z",
"mandateID": "bcb592dcb5fc4b",
"mandateDateOfSignature": "10/22/2021"
},
"amount": 6,
"currency": "EUR",
"isConversionRateFixed": true,
"quantity": 6,
"intervalStartDate": "2021-10-22T12:48:43.85Z",
"nextRecurringDate": "2021-10-23T12:48:43.85Z",
"currentBillingCycle": 1,
"ipAddress": "123.1.1.1",
"status": "Canceled",
"created": "2021-10-22T12:48:43.85Z"
}
You can cancel a existing active subscription via API request.
Hosted Page
You can create the 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.2000charge.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":"123.1.1.1",
"RedirectUrls":{
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}'
The above command returns JSON structured like this:
{
"id": "trn_6a013b5221a7",
"mode": "Test",
"status": "Created",
"customer": {
"id": "cus_aacd0143efd349dd9",
"mode": "Test",
"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": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"redirectUrl": "https://checkout.2000charge.com/payment?id=8bf6dcxxxxxxxxxxxx8bdbb2",
"ipAddress": "123.1.1.1"
}
To create the 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.
We also give you the possibility of using a hosted page with previously set payment option on the initial API request. Please keep in mind, if the payment option is sent in the payment object, it cannot 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 |
| 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 |
| merchantPassThruData | string | Merchant’s Identification | Optional |
| returnUrl | string | url that customer is redirected to after successful payment | Mandatory |
| cancelUrl | string | url that customer is redirected to on aborted payment | Mandatory |
| paymentOption | string | Payment Option | Optional |
Create Subscription
curl https://api.2000charge.com/api/subscriptions/hosted -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X POST -d '
{
"planId":"pln_41cd17a123",
"quantity":1,
"customer":{
"firstName":"John",
"lastName":"Doe",
"email":"john@doe.com",
"country":"DE",
"city":"City12",
"zip":"1007",
"address":"address line 1",
"address2":"address line 2"
},
"ipAddress":"123.1.1.1",
"redirectUrls":{
"returnUrl":"https://developers.2000charge.com/returnpages/success.html",
"cancelUrl":"https://developers.2000charge.com/returnpages/failure.html"
},
"merchantPassThruData":"merchant data",
"payment":{
"mandateId":"1234",
"mandateDateOfSignature":"09/08/2020"
}
}'
The above command returns JSON structured like this:
{
"id":"sbs_e71bb123",
"mode":"Test",
"planId":"pln_7021187813bb",
"amount":100,
"currency":"EUR",
"isConversionRateFixed":false,
"quantity":1,
"ipAddress":"123.1.1.1",
"created":"2020-12-01T10:40:34.3693928Z",
"customer":{
"firstName":"John",
"lastName":"Doe",
"email":"john@doe.com",
"country":"DE",
"address":"address line 1",
"address2":"address line 2"
},
"redirectUrls":{
"returnUrl":"https://developers.2000charge.com/returnpages/success.html",
"cancelUrl":"https://developers.2000charge.com/returnpages/failure.html"
},
"redirectUrl":"https://checkout.2000charge.com/subscription?id=8bf6dcxxxxxxxxxxxx8bdbb2",
"merchantPassThruData":"custom data"
}
To create the subscription using the hosted page you must send required parameters, such as customer’s email, payment plan identification code and customer’s IP address. Optional parameters can be later changed on the hosted page.
ATTRIBUTES
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Senders First Name | Optional |
| lastName | string | Senders Last Name | Optional |
| string | Senders Email | Optional | |
| country | string | Senders country - ISO1 country Code | Optional |
| city | string | Senders city | Optional |
| zip | string | Secondary zip code | Optional |
| address | string | Senders address line | Optional |
| address2 | string | Secondary senders address line | Optional |
PAYMENT OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| mandateId | string | Unique mandate identifier | Optional |
| mandateDateOfSignature | string | Mandate signature date | Optional |
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| planId | string | A unique payment plan identifier | Mandatory |
| quantity | integer | Amount of items in related subscription | Optional |
| customer | obejct | Object that contains customer data | Optional |
| ipAddress | string | Customer’s IP address | Mandatory |
| merchantPassThruData | string | Merchant’s Identification | Optional |
| returnUrl | string | url that customer’s is redirected to after successful payment | Mandatory |
| cancelUrl | string | url that customer’s is redirected to on aborted or failed payment | Mandatory |
| payment | object | url that customer is redirected to on aborted or failed payment | Optional |
DPMax - Open Banking
Introduction
DPMax represents our dedication to continue providing our clients with the best in class service based on the PSD2 Open Banking concept. With “Pay by Bank” functionality, customers can seamlessly initiate payments upon purchase, directly debiting funds from their accounts. DPMax stands out as the optimal choice for businesses seeking maximum coverage and redundancy, leveraging the advantages of Open Banking
Creating DPMax transaction ↓
There are 3 options for creating DPMax transaction: Checkout page, Widget and custom UI. When using the Checkout page, you have the option to use DPMax directly, bypassing the list of other payment options.
Using Checkout page
curl https://api.2000charge.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"
},
"payment" : {
"paymentOption":"DirectPayMax"
},
"Amount":200,
"Currency":"EUR",
"ipAddress":"123.1.1.1",
"RedirectUrls":{
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}'
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("NL");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$payment = new \2000charge\Model\Payment();
$payment->setpaymentOption("DirectPayMax");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setPayment($payment);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(200);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.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 = "DirectPayMax";
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.Payment = payment;
transaction.RedirectUrls = redirect;
transaction.Amount = 200;
transaction.Currency = "EUR";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'NL'
)
payment = ApRubySdk::Payment.new(
'paymentOption' => 'DirectPayMax'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'payment' => payment,
'amount' => 200,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='NL'
)
payment = Payment(
paymentOption='DirectPayMax'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'payment': payment,
'amount': 200,
'currency': 'EUR',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
The above command returns JSON structured like this:
{
"id": "trn_6a013b5221a7",
"mode": "Test",
"status": "Created",
"customer": {
"id": "cus_aacd0143efd349dd9",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "NL",
"created": "2017-04-03T14:18:24.1812715Z"
},
"payment": {
"mode": "Test",
"paymentOption": "DirectPayMax",
"holder": "John Doe",
"created": "0001-01-01T00:00:00Z"
},
"amount": 200,
"currency": "EUR",
"created": "2017-04-03T14:18:24.2332783Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"redirectUrl": "https://checkout.2000charge.com/payment?id=8bf6dcxxxxxxxxxxxx8bdbb2",
"ipAddress": "123.1.1.1"
}
You can create the transaction using our hosted page. When the transaction is created, you will receive redirect URL, on which your customer should be redirected.
ATTRIBUTES
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Sender’s First Name | Mandatory |
| lastName | string | Sender’s Last Name | Mandatory |
| string | Sender’s Email | Mandatory | |
| country | string | Sender’s country - ISO1 country Code | Mandatory |
PAYMENT OBJECT
| Parameter | Type | Value | Description | Requirement |
|---|---|---|---|---|
| paymentOption | string | DirectPayMax | Payment Option | 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 |
| merchantPassThruData | string | Merchant’s Identification | Optional |
| returnUrl | string | url that customer is redirected to after successful payment | Mandatory |
| cancelUrl | string | url that customer is redirected to on aborted payment | Mandatory |
DPMax for PSPs
curl https://api.2000charge.com/api/transactions/hosted/dpmax -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":"123.1.1.1",
"RedirectUrls":{
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
}
}'
$customer = new \2000charge\Model\Customer();
$customer->setEmail("john@doe.com");
$customer->setcountry("NL");
$customer->setFirstName("John");
$customer->setLastName("Doe");
$redirect = new \2000charge\Model\RedirectUrls();
$redirect->setReturnUrl("https://developers.2000charge.com/returnpages/success.html");
$redirect->setCancelUrl("https://developers.2000charge.com/returnpages/failure.html");
$transaction = new \2000charge\Model\Transaction();
$transaction->setCustomer($customer);
$transaction->setRedirectUrls($redirect);
$transaction->setAmount(200);
$transaction->setCurrency("EUR");
$transaction->setIpAddress($ipAddress);
$res = Transaction :: post($transaction);
2000charge.ApiUrl = _apiUrl;
var customer = new Customer();
customer.Email = "john@doe.com";
customer.FirstName = "John";
customer.LastName = "Doe";
customer.country = "NL";
var redirect = new RedirectUrls();
redirect.ReturnUrl = "https://developers.2000charge.com/returnpages/success.html"
redirect.CancelUrl = "https://developers.2000charge.com/returnpages/failure.html"
var transaction = new Transaction();
transaction.Customer = customer;
transaction.RedirectUrls = redirect;
transaction.Amount = 200;
transaction.Currency = "EUR";
transaction.IpAddress = "123.1.1.1";
customer = ApRubySdk::Customer.new(
'firstName' => 'John',
'lastName' => 'Doe',
'email' => 'john@doe.com',
'country' => 'NL'
)
redirectUrls = ApRubySdk::RedirectUrls.new(
'returnUrl' => 'https://developers.2000charge.com/returnpages/success.html',
'cancelUrl' => 'https://developers.2000charge.com/returnpages/failure.html'
)
@transaction = ApRubySdk::Transaction.create(
'customer' => customer,
'amount' => 200,
'currency' => 'EUR',
'redirectUrls' => redirectUrls,
'ipAddress' => '123.1.1.1'
)
customer = Customer(
firstName='John',
lastName='Doe',
email='john@doe.com',
country='NL'
)
redirectUrls = RedirectUrls(
returnUrl='https://developers.2000charge.com/returnpages/success.html',
cancelUrl='https://developers.2000charge.com/returnpages/failure.html'
)
return Transaction.create({
'customer': customer,
'amount': 200,
'currency': 'EUR',
'iPAddress': '123.1.1.1',
'redirectUrls': redirectUrls
})
The above command returns JSON structured like this:
{
"id": "trn_6a013b5221a7",
"mode": "Test",
"status": "Created",
"customer": {
"id": "cus_aacd0143efd349dd9",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "NL",
"fullName": "John Doe",
"created": "2017-04-03T14:18:24.1812715Z"
},
"payment": {
"mode": "Test",
"paymentOption": "DirectPayMax",
"holder": "John Doe",
"created": "0001-01-01T00:00:00Z"
},
"amount": 200,
"currency": "EUR",
"created": "2017-04-03T14:18:24.2332783Z",
"redirectUrls": {
"returnUrl": "https://developers.2000charge.com/returnpages/success.html",
"cancelUrl": "https://developers.2000charge.com/returnpages/failure.html"
},
"redirectUrl": "https://checkout.2000charge.com/payment?id=8bf6dcxxxxxxxxxxxx8bdbb2&isDpmaxMode=true",
"ipAddress": "123.1.1.1"
}
You can create a DPMax transaction using a hosted Checkout page without displaying other payment options. When the transaction is created, you’ll receive a redirect URL, on which your customer should be redirected to.
ATTRIBUTES
CUSTOMER OBJECT
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| firstName | string | Sender’s First Name | Mandatory |
| lastName | string | Sender’s Last Name | Mandatory |
| string | Sender’s Email | Mandatory | |
| country | string | Sender’s country - ISO1 country Code | Mandatory |
OTHER PARAMETERS
| Parameter | Type | Description | Requirement |
|---|---|---|---|
| amount | integer | Transaction amount (in cents) | Mandatory |
| currency | string | ISO 4217 formatted currency code | Mandatory |
| ipAddress | string | Customer’s IP address | Mandatory |
| merchantPassThruData | string | Merchant’s Identification | Optional |
| returnUrl | string | URL that customer is redirected to after successful payment | Mandatory |
| cancelUrl | string | URL that customer is redirected to on aborted payment | Mandatory |
Using Widget
SDK available for widget: dotNet, Java, Python, Ruby, PHP
PHP SDK Setup
Install
After creating a test account download and extract ttc-php-sdk to your server from the link - ttc-php-sdk
API keys
Locate the ttc-php-sdk/TwoThousandCharge.php file and insert your Public and Secret API keys. You must insert your API keys. After the registration process you will be provided with the API Test Keys and API Production Keys, the parameters needed to start accepting payments through our payment system.
NOTE: Production API Keys are avaliable once you are verified, and are used to proccess live transactions.
Include the following code to your page
Insert the script below before the opening tag of your webpage, ie
<!DOCTYPE html>
<html>
<?php require_once 'ttc-php-sdk/TwoThousandCharge.php';
$product_data = (object) array(
'currency' => "USD";
'amount' => "125.00";
'productDescription' => "Red T-shirt";
'formPost' => isset($_POST) ? $_POST : '',
'successUrl' => "https://developers.2000charge.com/returnpages/success.html";
'cancelUrl' => "https://developers.2000charge.com/returnpages/failure.html";
);
$transaction_status = $TwoThousandCharge->transaction($product_data);
?>
If Windows hosting and using SSL
After line 178 in ttc-php-sdk/lib/TwoThousandCharge/request.php you will see:
$curl = curl_init($url);
/* Begin windows ssl line. This next line is for windows ssl. remove if not on windows using ssl */
/* curl_setopt($curl, CURLOPT_CAINFO, 'C:\Program Files(x86)\PHP\v5.6\extras\ssl\curl-ca-bundle.crt'); */
/* end windows using ssl */
Line 180 needs to be enabled and pointing to your .crt file if you are in a Windows hosting environment and using SSL.
Webpage Setup
Insert the scripts below before the closing tag of your webpage:
<script> var AP_BUTTONS = ['PaymentButton1']; </script>
<script src="https://widget.2000charge.com/v22k/js/payment-button.js" type="text/javascript"></script>
You are required to embed the payment widget code to your page:
<form method="post">
<div
data-ttc-amount="<?php echo $product_data->amount; ?>"
data-ttc-button-text="Pay using 2000Charge Widget"
data-ttc-company-name="YourCompanyName"
data-ttc-currency="<?php echo $product_data->currency; ?>"
data-ttc-description="<?php echo $product_data->productDescription; ?>"
data-ttc-extra="Additional description"
data-ttc-public-key="<?php echo $TwoThousandCharge->getPublicKey(); ?>"
data-ttc-setup="SET_FORM_VALUES"
data-ttc-paymentoption="directpaymax"
id="PaymentButton1">
</div>
</form>
Using Custom UI
For custom UI, direct API call should be used:
List of Institutions
In order to process DPMax transactions by using personalized UI, it is possible to retrieve a list of supported institutions with important parameters for these institutions (for example: Is PsuId required and in which format it is)
Get List of Institutions by country ISO code
curl https://api.2000charge.com/api/institutions/getInstitutionsForCountry/{countryIsoCode} -u \
<WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X GET'
The above command returns JSON structured like this:
{
"institutions": [
{
"id": 7,
"name": "Unicajabanco",
"code": "UCJAES2MXXX",
"isPSUIdRequired": false
},
{
"id": 7,
"name": "CAJA DUERO",
"code": "UCJAES2MXXX",
"isPSUIdRequired": false
}
...
]
}
This endpoint will return all available institutions for specific country
Processing the transaction
For processing the transaction RedirectUrl parameter from API response should be used
Preauthorization
Create preauthorization
curl https://api.2000charge.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 preauth transaction, and after receiving transaction.approved event from that preauth transaction, capture full amount of that preauthorized 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 | string | 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 |
| 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 |
| birthDate | date | Customer’s birthday - MM/DD/YYYY | Optional |
| phone | string | Customer’s phone Number | Optional |
Capturing preauthorization
curl https://api.2000charge.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 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 |
| 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 |
| birthDate | 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 re-used. To re-use payment information, please see Payment Object section.
Create Token
curl https://api.2000charge.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 |
Creating Transaction
curl https://api.2000charge.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": "123.1.1.1",
"token": "VCtKKZza00g/3JjExts6S72GrVDxPfYG"
}
The above command returns JSON structured like this:
{
"id": "trn_b0d0c2716215",
"mode": "Test",
"status": "Funded",
"customer": {
"id": "cus_fec53db887ef402ba",
"mode": "Test",
"firstName": "John",
"lastName": "Doe",
"email": "john@doe.com",
"country": "US",
"created": "2016-09-11T23:35:24.4821996Z"
},
"payment": {
"id": "pay_56510f9a22634ae08",
"mode": "Test",
"paymentOption": "creditcard",
"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": "123.1.1.1"
}
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.2000charge.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 \2000charge\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);
2000charge.ApiUrl = _apiUrl;
Customer c = new Customer()
{
FirstName = "Tname1",
LastName = "Lname1",
Email = "mymail1@email.com",
Ip = "123.1.1.1",
state = "DE"
};
var result = 2000charge.Post<Customer>(c).Result;
The above command returns JSON structured like this:
{
"id": "cus_bd838e3611d34d598",
"mode": "Test",
"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 | Requirement |
|---|---|---|---|
| firstName | string | First name | Mandatory |
| lastName | string | Last name | Mandatory |
| string | Mandatory | ||
| address | string | address | Optional |
| city | string | city | Optional |
| zip | string | city ZIP code | Optional |
| country | string | country | Optional |
| state | string | state | Optional |
| phone | string | phone number | Optional |
Retrieve a Customer
Retrieves the details of an existing customer.
curl https://api.2000charge.com/api/customers/{id} \
-u <WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X GET -d '
$res = Customer :: get("cus_123456aaa");
2000charge.ApiUrl = _apiUrl;
var result = 2000charge.Get<Customer>("cus_nonprofitaaa").Result;
The above command returns JSON structured like this:
{
"id": "cus_bd838e3611d34d598",
"mode": "Test",
"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 | Requirement |
|---|---|---|---|
| id | string | Customer’s id | Mandatory |
List Customers
Returns a list of your customers.
curl https://api.2000charge.com/api/customers \
-u <WEBSITE_SECRET_KEY>: -H "Content-Type:application/json" -X GET -d
$res = Customer :: getAll();
2000charge.ApiUrl = _apiUrl;
var result = 2000chargea.GetAll<Customer>().Result;
The above command returns JSON structured like this:
{
"customers": [
{
"id": "cus_7f0724f3b1d745d49",
"mode": "Test",
"firstName": "Jane",
"lastName": "Doe",
"email": "jane@doe.com",
"country": "DE",
"created": "2015-06-24T11:46:35.303Z"
},
{
"id": "cus_15b154da474247dbb",
"mode": "Test",
"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 The type of error returned by the API:
invalid_parameter_error,payment_error,api_error - code Short description of the error.
- statuscode HTTP Status Code
- message A human-readable message providing more details about the error.
| 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. |
