Skip to content

Stancer

API Reference


Introduction

Welcome to the Stancer payment RESTful API !

We have language bindings in Shell, Python, Perl and PHP ! To offer an easy-to-use experience, we offer libraries in Shell, Python, Perl or PHP and the list keeps getting longer !

Code examples are displayed in each section; tabs available in the menu allow you to switch them to various programming languages.

The API is available at https://api.stancer.com/ and supports TLS 1.2, HTTP/1.1 and HTTP/2 requests.

Info

Perl library currently supports Perl 5.20+ versions.

You can find our library on CPAN or see the source code on GitLab or GitHub.

Info

For simplicity, PHP code will be written using typed properties implemented in 7.4.

PHP library currently supports PHP versions: 7.4, 8.0, 8.1.

You can find our library on Packagist or the source code on GitLab or GitHub.

Info

For simplicity, Python code will be written using type hinting (PEP484) implemented in 3.5.

Python library currently supports Python versions: 3.7, 3.8, 3.9, 3.10.

You can find our library on PyPI or see the source code on GitLab or GitHub.


Authentication with the API

To authenticate with the API, use this code:

1
curl -u <your_api_key>: "https://api.stancer.com/v1/checkout/paym_SKMLflt8NBATuiUzgvTYqsw5"

Warning

Make sure to replace <your_api_key> with your API key.

1
2
3
4
5
6
use Stancer::Config;

my $config = Stancer::Config->init(['<your_public_keys>', '<your_secret_keys>']);

$config->mode(Stancer::Config::TEST); # Not needed, TEST mode is set by default
                                    # But you need to change the mode to go on production ;)

Warning

Make sure to replace <your_public_keys> and <your_secret_keys> with your API keys (test and production).
We will use the right key depending on mode configuration.

1
2
3
4
5
6
<?php
$config = Stancer\Config::init(['<your_public_keys>', '<your_secret_keys>']);

$config->setMode(Stancer\Config::TEST_MODE); # Not needed, TEST mode is set by default
                                           # But you need to do it to go on production ;)
?>

Warning

Make sure to replace <your_public_keys> and <your_secret_keys> with your API keys (test and production).
We will use the right key depending on mode configuration.

1
2
3
4
import Stancer

conf = Stancer.Config()
conf.keys = ('<your_public_keys>', '<your_secret_keys>')

Warning

Make sure to replace <your_public_keys> and <your_secret_keys> with your API keys (test and production).
We will use the right key depending on mode configuration.

Stancer's payment service use API keys to allow access to the API. You can register for a new API key at our SignUp website.

The authentication to the API is performed via HTTP Basic Auth, you do not need to provide a password. Stancer's payment service expects for the API key to be included in all API requests to the server in a header that looks like the following:

Authorization: Basic eW91cl9hcGlfa2V5Og==


Payments

The payment object is structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{
  "id": "paym_KIVaaHi7G8QAYMQpQOYBrUQE",
  "amount": 100,
  "currency": "eur",
  "description": "Test Payment Company",
  "order_id": null,
  "unique_id": null,
  "methods_allowed": ["card", "sepa"],
  "method": "card",
  "card": {
    "brand": "mastercard",
    "country": "US",
    "exp_month": 2,
    "exp_year": 2023,
    "id": "card_xognFbZs935LMKJYeHyCAYUd",
    "last4": "4444",
    "name": null,
    "zip_code": null
  },
  "status": "to_capture",
  "capture": true,
  "created": 1538564253,
  "customer": "cust_9Cle7TXKkjhwqcWx4Kl5cQYk",
  "response": "00",
  "live_mode": false
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package Stancer::Payment;

use Moo;
use Stancer::Core::Types qw(:all);

has amount => (is => 'rw', isa => Int);

has auth => (is => 'rw', isa => AnyOf[InstanceOf['Stancer::Auth'], Bool]);

has capture => (is => 'rw', isa => Bool);

has card => (is => 'rw', isa => InstanceOf['Stancer::Card']);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has currency => (is => 'rw', isa => Enum['EUR', 'GBP', 'USD']);

has customer => (is => 'rw', isa => InstanceOf['Stancer::Customer']);

has description => (is => 'rw', isa => Varchar[3, 64]);

has device => (is => 'rw', isa => InstanceOf['Stancer::Device']);

has id => (is => 'ro', isa => Char[29]);

has method => (is => 'ro', isa => Str);

has order_id => (is => 'rw', isa => Varchar[36]);

has payment_page_url => (is => 'ro', isa => HttpsUrl);

has refundable_amount => (is => 'ro', isa => Int);

has refunds => (is => 'ro', isa => ArrayRef[InstanceOf['Stancer::Refund']]);

has response => (is => 'ro', isa => Varchar[2, 4]);

has return_url => (is => 'rw', isa => HttpsUrl);

has sepa => (is => 'rw', isa => InstanceOf['Stancer::Sepa']);

has status => (is => 'ro', isa => Str);

has unique_id => (is => 'rw', isa => Varchar[36]);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
namespace Stancer;

use DateTime;

class Payment {
  protected int $amount;
  protected ?Auth $auth;
  protected boolean $capture = true;
  protected ?Card $card;
  protected ?DateTime $created;
  protected string $currency;
  protected ?Customer $customer;
  protected ?string $description;
  protected ?Device $device;
  protected ?string $id;
  protected ?string $method;
  protected ?string $orderId;
  protected ?string $uniqueId;
  protected ?string $paymentPageUrl;
  protected int $refundableAmount;
  protected ?Refund[] $refunds;
  protected ?string $response;
  protected ?string $returnUrl;
  protected ?Sepa $sepa;

  public function __construct(string $id = null) {}
}
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
from datetime import datetime
from stancer import Card, Customer, Sepa

class Payment(object):
  _ENDPOINT = 'checkout'

  @property
  def amount(self) -> int:
    pass

  @amount.setter
  def amount(self, value: int):
    pass

  @property
  def capture(self) -> bool:
    pass

  @capture.setter
  def capture(self, value: bool):
    pass

  @property
  def card(self) -> Card:
    pass

  @card.setter
  def card(self, value: Card):
    pass

  @property
  def created(self) -> datetime:
    pass

  @property
  def currency(self) -> str:
    pass

  @currency.setter
  def currency(self, value: str):
    pass

  @property
  def customer(self) -> Customer:
    pass

  @customer.setter
  def customer(self, value: Customer):
    pass

  @property
  def description(self) -> str:
    pass

  @description.setter
  def description(self, value: str):
    pass

  @property
  def id(self) -> str:
    pass

  @property
  def live_mode(self) -> bool:
    pass

  @property
  def method(self) -> str:
    pass

  @property
  def order_id(self) -> str:
    pass

  @order_id.setter
  def order_id(self, value: str):
    pass

  @property
  def response(self) -> str:
    pass

  @property
  def sepa(self) -> Sepa:
    pass

  @sepa.setter
  def sepa(self, value: Sepa):
    pass

  @property
  def status(self) -> str:
    pass

  @property
  def unique_id(self) -> str:
    pass

  def __init__(self, uid=None):
    pass

Full parameters list and description of the payment object

Parameter Description Type
id Payment's id String, fixed size = 29
amount Transaction amount (in cents) Int, min = 50
currency Processed Payment's currency Enum EUR, USD, GBP
description The payment description String, min = 3, max = 64
order_id Your reference id String, min = 1, max = 36
unique_id Your unicity key String, min = 1, max = 36
methods_allowed The list of payment methods allowed for this payment If null defaults to all methods available
method The payment method used to pay Enum card, sepa
card The card object or id If present, will perform a credit card payment
sepa The sepa object or id If present, will perform a SEPA payment
customer The customer object or id If present, will link payment to customer
refunds Array of refund object Present if the payment was refunded
status The status of the payment See Payment status codes
response The response of the bank processing See Payment response codes
auth Auth object, must be set for 3-D Secure card payments See auth description
device The device object Required if auth is defined, see device description
capture Capture immediately the payment Boolean, default True
created The Unix timestamp representing creation date of the object in local time Int
date_bank Timestamp of the delivery date of the funds traded by the bank Int
return_url An HTTPS URL to redirect back your customer after processing the payment String, max = 2048
live_mode Test or Live mode Boolean, default False

Create a payment

HTTP request

/v1/checkout/

Data parameters

Parameter Field
amount Required
currency Required
description Optional
order_id Optional
unique_id Optional
methods_allowed Optional
auth Conditional

Return parameters

The API will replicate your data in the return parameters and add the following ones:

Parameter Field
id Required
created Required
method Required
auth Conditional
status Required
response Required
card Conditional
sepa Conditional
customer Optional
device Conditional
capture Optional
live_mode Optional

When you provide the unique_id field, we validate the uniqueness of the payment before processing. If this unique_id already exists within our systems, the transaction will then be rejected with a 409 Conflict response, whom body will contains the payment id already associated with this unique_id.

Code examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
curl -X POST "https://api.stancer.com/v1/checkout/" \
  --header "Content-Type: application/json" \
  --data '{
    "description": "Test Payment Company",
    "amount": "100",
    "currency": "eur",
    "card": {
        "number": "5555555555554444",
        "cvc": "123",
        "exp_year": "2023",
        "exp_month": "02"
    },
    "customer": {
        "email": "david@coaster.net",
        "mobile": "+33684858687",
        "name": "David Coaster"
    }
}'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
  #! /bin/perl -w
  use Stancer::Card;
  use Stancer::Customer;
  use Stancer::Payment;

  my $card = Stancer::Card->new();
  my $customer = Stancer::Customer->new();
  my $payment = Stancer::Payment->new();

  $card->number('5555555555554444');
  $card->cvc('123');
  $card->exp_month('02');
  $card->exp_year('2023');

  $customer->email('david@example.net');
  $customer->mobile('+33639980102');
  $customer->name('David Coaster');

  $payment->amount(100);
  $payment->currency('eur');
  $payment->card($card);
  $payment->customer($customer);
  $payment->description('Test Payment Company');

  $payment->send();
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
  <?php
  $card = new Stancer\Card();
  $card->setNumber('5555555555554444');
  $card->setCvc('123');
  $card->setExpirationMonth('02');
  $card->setExpirationYear('2023');

  $customer = new Stancer\Customer();
  $customer->setEmail('david@example.net');
  $customer->setMobile('+33639980102');
  $customer->setName('David Coaster');

  $payment = new Stancer\Payment();
  $payment->setAmount(100);
  $payment->setCard($card);
  $payment->setCurrency('eur');
  $payment->setCustomer($customer);
  $payment->setDescription('Test Payment Company');

  $payment->send();
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
  import stancer

  card = stancer.Card()
  card.number = '5555555555554444'
  card.cvc = '123'
  card.exp_month = 2
  card.exp_year = 2023

  customer = stancer.Customer()
  customer.email = 'david@example.net'
  customer.mobile = '+33639980102'
  customer.name = 'David Coaster'

  payment = stancer.Payment()
  payment.description = 'Test Payment Company'
  payment.amount = 100
  payment.currency = 'eur'
  payment.card = card
  payment.customer = customer

  payment.send()

The above command returns a JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
{
  "amount": 100,
  "auth": true,
  "capture": true,
  "card": {
    "brand": "mastercard",
    "country": "US",
    "exp_month": 2,
    "exp_year": 2023,
    "id": "card_xognFbZs935LMKJYeHyCAYUd",
    "last4": "4444",
    "name": null,
    "zip_code": null
  },
  "created": 1538564253,
  "currency": "eur",
  "customer": "cust_9Cle7TXKkjhwqcWx4Kl5cQYk",
  "description": "Test Payment Company",
  "id": "paym_KIVaaHi7G8QAYMQpQOYBrUQE",
  "live_mode": false,
  "method": "card",
  "order_id": null,
  "response": "00",
  "status": "to_capture"
}

Get payment data

HTTP request

/v1/checkout/
id_payment

Query parameters

Parameter Description
id_payment The ID of the payment to retrieve

Important

Remember — a happy payment is an authenticated payment!

Return parameters

It will return the payment object asssociated with the id_payment you provided. If the id_payment does not exist, the API will return a 404 HTTP response code.

Code examples

1
curl "https://api.stancer.com/v1/checkout/paym_SKMLflt8NBATuiUzgvTYqsw5"
1
2
3
4
#! /bin/perl -w
use Stancer::Payment;

my $payment = Stancer::Payment->new('paym_SKMLflt8NBATuiUzgvTYqsw5');
1
2
<?php
$payment = new Stancer\Payment('paym_SKMLflt8NBATuiUzgvTYqsw5');
1
2
3
import stancer

payment = stancer.Payment('paym_SKMLflt8NBATuiUzgvTYqsw5')

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
{
  "amount": 3406,
  "card": {
    "brand": "visa",
    "country": "US",
    "exp_month": 3,
    "exp_year": 2021,
    "id": "card_jSmaDq5t5lMnz6H8tCZ0AbRG",
    "last4": "4242",
    "name": null,
    "zip_code": null
  },
  "country": "FR",
  "created": 1538492150,
  "currency": "eur",
  "description": null,
  "id": "paym_SKMLflt8NBATuiUzgvTYqsw5",
  "customer": null,
  "live_mode": false,
  "method": "card",
  "order_id": "815730837",
  "response": "00",
  "status": "to_capture"
}

Update a payment

HTTP request

/v1/checkout/
id_payment

Query parameters

Parameter Description
id_payment Payment id

Data parameters

Parameter Field
amount Optional
currency Optional
order_id Optional
description Optional
return_url Optional
customer Optional
card Optional
sepa Optional
device Optional
status Optional
auth Conditional

Return parameters

The above command returns an HTTP 200 / 204 code if correctly processed or an HTTP 404 code if the payment does not exist.

Code examples

1
2
3
4
5
curl -X PATCH "https://api.stancer.com/v1/checkout/paym_qcWx4Kl5c9Cle7TXKkjhwQYk" \
  --header "Content-Type: application/json" \
  --data '{
    "status": "capture"
}'
1
2
3
4
5
6
7
8
#! /bin/perl -w
use Stancer::Payment;

my $payment = Stancer::Payment->new('paym_SKMLflt8NBATuiUzgvTYqsw5');

$payment->amount(500);

$payment->send();
1
2
3
4
5
6
<?php
$payment = new Stancer\Payment('paym_SKMLflt8NBATuiUzgvTYqsw5');

$payment->setAmount(500);

$payment->send();
1
2
3
4
5
import stancer

payment = stancer.Payment('paym_SKMLflt8NBATuiUzgvTYqsw5')
payment.amount = 500
payment.save()

List all payments

HTTP request

/v1/checkout/
?created=
created
&start=
start
&limit=
limit
/v1/checkout/
?order_id=
order_id
/v1/checkout/
?unique_id=
unique_id

Query parameters

Parameter Field Description
created Optional A Unix timestamp filtering payments whom timestamps are equal to or greater
limit Optional An integer value limiting the number of objects to be returned
order_id Optional Fetches payments corresponding to the order_id you specified in your inital payment request
start Optional An integer cursor you can use for pagination starting at index 0
unique_id Optional Fetches payments corresponding to the unique_id you specified in your inital payment request

Every parameters can be used together, when you do so, they are treated as union.

Return parameters

Parameter Description
live_mode Whatever if you are in live mode
payments An array of payment objects
range Details of your request and pagination. If has_more is true, you will need to move the start cursor ahead to fetch more objects

Code examples

1
curl "https://api.stancer.com/v1/checkout/?created=1541586411&limit=2"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#! /bin/perl -w
use Stancer::Payment;

my $list = Stancer::Payment->list({order_id => '822386023', limit => 2});

while (my $payment = $list->next()) {
  # Do some stuff with $payment
}

# `list` method allow `hash` or `hashref`.
# `created` allow `integer` or a `DateTime` instance.
1
2
3
4
5
6
7
8
9
<?php
$list = Stancer\Payment::list(['order_id' => '822386023', 'limit' => 2]);

foreach ($list as $payment) {
  // Do some stuff with $payment
}

// `list` method return a generator.
// `created` allow `integer` or a `DateTime` instance.
1
    Not available for the moment.

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
{
  "live_mode": true,
  "payments": [
    {
      "amount": 3021,
      "card": {
        "brand": "mastercard",
        "country": "FR",
        "created": 1541586412,
        "exp_month": 9,
        "exp_year": 2019,
        "id": "card_acn1TKrqViXWVyK88GjnIUxd",
        "last4": "7354",
        "name": null,
        "zip_code": null
      },
      "country": "FR",
      "currency": "eur",
      "date_bank": null,
      "date_paym": 1541586411,
      "description": null,
      "fee": 5,
      "customer": null,
      "method": "card",
      "order_id": "822386023",
      "id": "paym_JnU7xyTGJvxRWZuxvj78qz7e",
      "response": "75",
      "status": null
    },
    {
      "amount": 3021,
      "card": {
        "brand": "visa",
        "country": "FR",
        "created": 1541586569,
        "exp_month": 11,
        "exp_year": 2023,
        "id": "card_690TS4zmux1I7fnLAB1Jt3yE",
        "last4": "1435",
        "name": null,
        "zip_code": null
      },
      "country": "FR",
      "currency": "eur",
      "date_bank": 1541631600,
      "date_paym": 1541586568,
      "description": null,
      "fee": 5,
      "customer": null,
      "method": "card",
      "order_id": "822386023",
      "id": "paym_p5tjCrXHy93xtVtVqvEJoC1c",
      "response": "00",
      "status": 2
    }
  ],
  "range": {
    "end": 1,
    "has_more": true,
    "limit": 2,
    "start": 0
  }
}

Methods

Here is the list of payments methods object supported by our API. By default, the API allows all the payments methods available. If you do want to allow or restrict the use of specific payment methods, you can specify it as a list in the methods_allowed payment object.

Credit Card

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "id": "card_xognFbZs935LMKJYeHyCAYUd",
  "last4": "4444",
  "brand": "mastercard",
  "exp_month": 2,
  "exp_year": 2023,
  "name": null,
  "zip_code": null,
  "tokenize": true
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package Stancer::Card;

use Moo;
use Stancer::Core::Types qw(:all);

has brand => (is => 'ro', isa => Str);

has cvc => (is => 'rw', isa => Char[3]);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has exp_month => (is => 'rw', isa => Int);

has exp_year => (is => 'rw', isa => Int);

has id => (is => 'ro', isa => Char[29]);

has last4 => (is => 'ro', isa => Char[4]);

has name => (is => 'rw', isa => Varchar[4, 64]);

has number => (is => 'rw', isa => CardNumber);

has tokenize => (is => 'rw', isa => Bool);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
<?php
namespace Stancer;

use DateTime;

class Card
{
  protected ?string $brand;
  protected ?DateTime $created;
  protected ?string $cvc;
  protected int $expMonth;
  protected int $expYear;
  protected ?string $id;
  protected ?string $last4;
  protected ?string $name;
  protected ?string $number;
  protected ?boolean $tokenize = true;

  public function __construct(string $id = null) {}
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
from datetime import datetime

class Card(object):
  @property
  def brand(self) -> str:
    pass

  @property
  def created(self) -> datetime:
    pass

  @property
  def cvc(self) -> str:
    pass

  @cvc.setter
  def cvc(self, value: str):
    pass

  @property
  def exp_month(self) -> int:
    pass

  @exp_month.setter
  def exp_month(self, value: int):
    pass

  @property
  def exp_year(self) -> int:
    pass

  @exp_year.setter
  def exp_year(self, value: int):
    pass

  @property
  def id(self) -> str:
    pass

  @property
  def last4(self) -> str:
    pass

  @property
  def name(self) -> str:
    pass

  @name.setter
  def name(self, value: str):
    pass

  @property
  def number(self) -> str:
    pass

  @number.setter
  def number(self, value: str):
    pass

  @property
  def tokenize(self) -> bool:
    pass

  @tokenize.setter
  def tokenize(self, value: bool):
    pass

  @property
  def zip_code(self) -> str:
    pass

  @zip_code.setter
  def zip_code(self, value: str):
    pass

The card object is defined as follows:

Parameter Field Description Type
id Given by the API Card's id String, fixed size = 29
number Required at creation The customer PAN number String, min = 16, max = 19
last4 Given by the API Last 4 PAN number String, fixed size = 4 characters
brand Given by the API Card brand String
exp_month Required at creation Expiration month Int, min = 1, max = 12
exp_year Required at creation Expiration year Int, min = current year, max = 2100
cvc Optional but highly recommanded The card verification code String, fixed size = 3 characters
name Optional Card holder name String, min = 4, max = 64
funding Given by the API Type of funding Enum credit, debit, prepaid, universal, charge or deferred. May be null if the type could not be determined.
nature Given by the API Nature of the card Enum personal or corporate. May be null if the nature could not be determined.
network Given by the API Network used to process payments (may differ from brand) Enum national, mastercard or visa. May be null if the network could not be determined.
zip_code Optional City zip code String, min = 2, max = 8
tokenize Optional If you want the card to be tokenized and reused Boolean, default True
created Given by the API The Unix timestamp representing creation date of the object in local time Int

Create a card

HTTP request
/v1/cards/
Data parameters
Parameter Field
number Required
exp_month Required
exp_year Required
cvc Optional but highly recommanded
name Optional
tokenize Optional
zip_code Optional
Return parameters

The API will replicate your data, except for number and cvc, in the return parameters and add the following ones:

Parameter Field
id Required
created Required
last4 Required
brand Required
funding Required
nature Required
network Required

You may received a 409 Conflict HTTP response if the card already exists, whom body will contain the id of the already-existing card.

Code examples
1
2
3
4
5
6
7
8
curl -X POST "https://api.stancer.com/v1/cards/" \
  --header "Content-Type: application/json" \
  --data '{
    "number": "5555555555554444",
    "cvc": "123",
    "exp_year": "2023",
    "exp_month": "02"
}'

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "brand": "mastercard",
  "country": "US",
  "created": 1579010740,
  "exp_month": 2,
  "exp_year": 2023,
  "funding": "credit",
  "id": "card_ub99idEIFcbK517ZrKBIrt4y",
  "last4": "4444",
  "live_mode": false,
  "name": null,
  "nature": "personal",
  "network": "mastercard",
  "zip_code": null
}

Get card data

HTTP request
/v1/cards/
id_card
Query parameters
Parameter Description
id_card The ID of the card to retrieve
Return parameters

It will return the card object asssociated with the id_card you provided. If the id_card does not exist, the API will return a 404 HTTP response code.

Code examples
1
curl "https://api.stancer.com/v1/cards/card_ub99idEIFcbK517ZrKBIrt4y"

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
  "brand": "mastercard",
  "country": "US",
  "created": 1579010740,
  "exp_month": 2,
  "exp_year": 2023,
  "funding": "credit",
  "id": "card_ub99idEIFcbK517ZrKBIrt4y",
  "last4": "4444",
  "live_mode": false,
  "name": null,
  "nature": "personal",
  "network": "mastercard",
  "zip_code": null
}

Update a card

HTTP request
/v1/cards/
id_card
Query parameters
Parameter Description
id_card Card id
Data parameters
Parameter Field
exp_month Optional
exp_year Optional
name Optional
zip_code Optional
Return parameters

The above command returns an HTTP 200 / 204 code if correctly processed or an HTTP 404 code if the card does not exist.

Code examples
1
2
3
4
5
curl -X PATCH "https://api.stancer.com/v1/cards/card_ub99idEIFcbK517ZrKBIrt4y" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Pickle Rick"
}'

Delete a card

HTTP request
/v1/cards/
id_card
Query parameters
Parameter Description
id_card Card id
Return parameters

The above command returns an HTTP 204 code if success or an HTTP 404 code if the card does not exist.

Code examples
1
curl -X DELETE "https://api.stancer.com/v1/cards/card_ub99idEIFcbK517ZrKBIrt4y"

SEPA

Info

To make SEPA payments, you must contact us to provide or obtain a SEPA Creditor Identifier.

1
2
3
4
5
6
{
  "id": "sepa_oazGliEo6BuqUlyCzE42hcNp",
  "bic": "ILADFRPP",
  "last4": "2606",
  "name": "David Coaster"
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
package Stancer::Sepa;

use Moo;
use Stancer::Core::Types qw(:all);

has bic => (is => 'rw', isa => Bic);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has iban => (is => 'rw', isa => Iban);

has id => (is => 'ro', isa => Char[29]);

has last4 => (is => 'ro', isa => Char[4]);

has name => (is => 'rw', isa => Varchar[4, 64]);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
<?php
namespace Stancer;

use DateTime;

class Sepa
{
  protected ?string $bic;
  protected ?DateTime $created;
  protected ?string $iban;
  protected ?string $id;
  protected ?string $last4;
  protected string $name;

  public function __construct(string $id = null) {}
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from datetime import datetime

class Sepa(object):
  @property
  def bic(self) -> str:
    pass

  @bic.setter
  def bic(self, value: str):
    pass

  @property
  def created(self) -> datetime:
    pass

  @property
  def iban(self) -> str:
    pass

  @iban.setter
  def iban(self, value: str):
    pass

  @property
  def id(self) -> str:
    pass

  @property
  def last4(self) -> str:
    pass

  @property
  def name(self) -> str:
    pass

  @name.setter
  def name(self, value: str):
    pass

The SEPA object is defined as follows:

Parameter Field Description Type
id Given by the API SEPA's id String, fixed size = 29
bic Optional The BIC number associated with the IBAN String, min = 8, max = 11
iban Required The bank account number String, min = 16, max = 34
last4 Given by the API Last 4 bank account number String, fixed size = 4 characters
name Required IBAN holder's name String, min = 4, max = 64
mandate Required The mandate referring to the payment String, min = 3, max = 35
mandate_date Required Timestamp of the mandate signature date, required if mandate was provided Int
created Given by the API The Unix timestamp representing creation date of the object in local time Int

Create a SEPA

HTTP request
/v1/sepa/
Data parameters
Parameter Field
iban Required
name Required
bic Optional
mandate Required
date_mandate Required
Return parameters

The API will replicate your data, except for iban, in the return parameters and add the following ones:

Parameter Field
id Required
bic Required
created Required
last4 Required
mandate Required
date_mandate Required

You may received a 409 Conflict HTTP response if the sepa already exists, whom body will contain the id of the already-existing SEPA.

Code examples
1
2
3
4
5
6
curl -X POST "https://api.stancer.com/v1/sepa/" \
  --header "Content-Type: application/json" \
  --data '{
    "iban": "FR1420041010050500013M02606",
    "name": "David Coaster"
}'

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "bic": "TESTFRPP",
  "created": 1611140413,
  "date_mandate": null,
  "id": "sepa_fZvOCm7oDmUJhqvezEtlZwXa",
  "last4": "2606",
  "live_mode": false,
  "mandate": "mndt_fZDtzobQZxTXUFK3nNS41heE",
  "name": "David Coaster"
}

Get SEPA data

HTTP request
/v1/sepa/
id_sepa
Query parameters
Parameter Description
id_sepa The ID of the SEPA to retrieve
Return parameters

It will return the SEPA object asssociated with the id_sepa you provided. If the id_sepa does not exist, the API will return a 404 HTTP response code.

Code examples
1
curl "https://api.stancer.com/v1/sepa/sepa_fZvOCm7oDmUJhqvezEtlZwXa"

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "bic": "TESTFRPP",
  "created": 1611140413,
  "date_mandate": null,
  "id": "sepa_fZvOCm7oDmUJhqvezEtlZwXa",
  "last4": "2606",
  "live_mode": false,
  "mandate": "mndt_fZDtzobQZxTXUFK3nNS41heE",
  "name": "David Coaster"
}

Update a sepa

HTTP request
/v1/sepa/
id_sepa

You can update a sepa only if the mandate has not already been signed.

If you need to renew the mandate, you must recreate a sepa object.

Query parameters
Parameter Description
id_sepa SEPA's id
Data parameters
Parameter Field
name Optional, only if date_mandate was not already provided
mandate Optional, only if date_mandate was not already provided
date_mandate Optional, only if not already provided
Return parameters

The above command returns an HTTP 200 / 204 code if correctly processed or an HTTP 404 code if the sepa does not exist.

Code examples
1
2
3
4
5
curl -X PATCH "https://api.stancer.com/v1/sepa/sepa_fZvOCm7oDmUJhqvezEtlZwXa" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "Pickle Rick"
}'

Delete a sepa

HTTP request
/v1/sepa/
id_sepa
Query parameters
Parameter Description
id_sepa SEPA's id
Return parameters

The above command returns an HTTP 204 code if correctly processed or an HTTP 404 code if the sepa does not exist.

Code examples
1
curl -X DELETE "https://api.stancer.com/v1/sepa/sepa_fZvOCm7oDmUJhqvezEtlZwXa"

Authenticated payments

You may want to perform an authenticated payment, also known as 3-D Secure, Verified by Visa or Mastercard Identity Check. An anthenticated payment will send a request to the cardholder's bank to authenticate him or her.

To start an authenticated payment, you must provide an auth and a device objects in your payment data.

If you use our payment page, you just need to pass the request status to auth object and no device object, we will handle everything for you.

Auth

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
package Stancer::Auth;

use Moo;
use Stancer::Core::Types qw(:all);
use Stancer::Auth::Status;

has redirect_url => (is => 'ro', isa => HttpsUrl);

has return_url => (is => 'rw', isa => HttpsUrl);

has status => (is => 'ro', isa => Str, default => Stancer::Auth::Status::REQUEST);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?php
namespace Stancer;

use DateTime;

class Auth
{
  protected ?string $redirectUrl;
  protected ?string $returnUrl;
  protected ?string $status;

  public function __construct() {}
}

The auth object is defined as follows:

Parameter Description Type
redirect_url An HTTPS URL where you will redirect your customer to his bank for authentication String, max = 2048
Given by the API
return_url An HTTPS URL to redirect back your customer after the bank authentication String, max = 2048
status The status of the payment authentication See authenticated payment status codes

Device

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package Stancer::Device;

use Moo;
use Stancer::Core::Types qw(:all);

has city => (is => 'rw', isa => Str);

has country => (is => 'rw', isa => Str);

has http_accept => (is => 'rw', isa => Varchar[2048], default => $ENV{HTTP_ACCEPT});

has ip => (is => 'rw', isa => IpAddress, default => $ENV{SERVER_ADDR});

has languages => (is => 'rw', isa => Varchar[32], default => $ENV{HTTP_ACCEPT_LANGUAGE});

has port => (is => 'rw', isa => Int, default => $ENV{SERVER_PORT});

has user_agent => (is => 'rw', isa => Varchar[256], default => $ENV{HTTP_USER_AGENT});

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
namespace Stancer;

use DateTime;

class Device
{
  protected ?string $city;
  protected ?string $country;
  protected ?string $httpAccept = $_SERVER['HTTP_ACCEPT'];
  protected ?string $ip = $_SERVER['SERVER_ADDR'];
  protected ?string $languages = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
  protected ?string $port = $_SERVER['SERVER_PORT'];
  protected ?string $userAgent = $_SERVER['HTTP_USER_AGENT'];

  public function __construct() {}
}

The device object is defined as follows:

Parameter Field Description Type
ip Required IP address of the payer IPv4 or IPv6
port Required TCP port number of the payer Int, max = 65535
user_agent Optional HTTP User Agent header String, max = 256
http_accept Optional HTTP Accept header String, max = 2048
languages Optional HTTP Accept-Language header String, max = 32
city Conditional If ip provided, return the city of the payer String
country Conditional If ip provided, return the country of the payer String

Customers

1
2
3
4
5
6
7
8
{
  "id": "cust_9Cle7TXKkjhwqcWx4Kl5cQYk",
  "email": "david@example.net",
  "mobile": "+33639980102",
  "name": "David Coaster",
  "created": 1538562174,
  "live_mode": false
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package Stancer::Customer;

use Moo;
use Stancer::Core::Types qw(:all);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has email => (is => 'rw', isa => Varchar[5, 64]);

has id => (is => 'ro', isa => Char[29]);

has mobile => (is => 'rw', isa => Varchar[8, 16]);

has name => (is => 'rw', isa => Varchar[4, 64]);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<?php
namespace Stancer;

use DateTime;

class Customer
{
  protected ?DateTime $created;
  protected ?string $email;
  protected ?string $id;
  protected ?string $mobile;
  protected ?string $name;

  public function __construct(string $id = null) {}
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from datetime import datetime

class Customer(object):
  _ENDPOINT = 'customers'

  @property
  def created(self) -> datetime:
    pass

  @property
  def email(self) -> str:
    pass

  @email.setter
  def email(self, value: str):
    pass

  @property
  def id(self) -> str:
    pass

  @property
  def mobile(self) -> str:
    pass

  @mobile.setter
  def mobile(self, value: str):
    pass

The customer object is defined as follows:

Field Description Type
id Customer's id String, fixed size = 29
email Customer's email String, min = 5, max = 64
mobile Customer's mobile phone String, min = 8, max = 16
name Customer's name String, min = 4, max = 64
created The Unix timestamp representing creation date of the object in local time Int
live_mode Test or Live mode Boolean inherited from a payment object if linked, default False

Customers objects created in Test mode cannot be used in Live mode. Likewise, objects created in Live mode cannot be used in Test mode.

Create a customer

HTTP request

/v1/customers/

Data parameters

Parameter Field
email Optional
mobile Optional
name Optional
live_mode Optional

Code examples

1
2
3
4
5
6
7
curl -X POST "https://api.stancer.com/v1/customers/" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "David Coaster",
    "email": "david@coaster.net",
    "mobile": "+33684858687"
}'
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#! /bin/perl -w
use Stancer::Customer;

my $customer = Stancer::Customer->new();

$customer->email('david@example.net');
$customer->mobile('+33639980102');
$customer->name('David Coaster');

$customer->send();
1
2
3
4
5
6
7
8
<?php
$customer = new Stancer\Customer();

$customer->setEmail('david@example.net');
$customer->setMobile('+33639980102');
$customer->setName('David Coaster');

$customer->send();
1
2
3
4
5
6
7
8
import stancer

customer = stancer.Customer()
customer.email = 'david@example.net'
customer.mobile = '+33639980102'
customer.name = 'David Coaster'

customer.send()

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
{
  "created": 1538562174,
  "email": "david@example.net",
  "id": "cust_9Cle7TXKkjhwqcWx4Kl5cQYk",
  "live_mode": false,
  "mobile": "+33639980102",
  "name": "David Coaster"
}

Get customer data

HTTP request

/v1/customers/
id_customer

Query parameters

Parameter Description
id_customer Customer's id

Return parameters

The request will return the customer object asssociated with the id_customer you provided. If the id_customer does not exist, the API will return a 404 HTTP response code.

Code examples

1
curl "https://api.stancer.com/v1/customers/cust_9Cle7TXKkjhwqcWx4Kl5cQYk"
1
2
3
4
#! /bin/perl -w
use Stancer::Customer;

my $customer = Stancer::Customer->new('cust_9Cle7TXKkjhwqcWx4Kl5cQYk');
1
2
<?php
$customer = new Stancer\Customer('cust_9Cle7TXKkjhwqcWx4Kl5cQYk');
1
2
3
import stancer

customer = stancer.Customer('cust_9Cle7TXKkjhwqcWx4Kl5cQYk')

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
{
  "created": 1538562174,
  "email": "david@example.net",
  "id": "cust_9Cle7TXKkjhwqcWx4Kl5cQYk",
  "live_mode": false,
  "mobile": "+33639980102",
  "name": "David Coaster"
}

Update a customer

HTTP request

/v1/customers/
id_customer

Query parameters

Parameter Description
id_customer Customer's id

Data parameters

Parameter Field
email Optional
mobile Optional
name Optional

Return parameters

The above command returns an HTTP 204 code if correctly processed or an HTTP 404 code if the customer does not exist.

Code examples

1
2
3
4
5
curl -X PATCH "https://api.stancer.com/v1/customers/cust_9Cle7TXKkjhwqcWx4Kl5cQYk" \
  --header "Content-Type: application/json" \
  --data '{
    "email": "david@coaster.com"
}'
1
2
3
4
5
6
7
8
#! /bin/perl -w
use Stancer::Customer;

my $customer = Stancer::Customer->new('cust_9Cle7TXKkjhwqcWx4Kl5cQYk');

$customer->email('david@example.net');

$customer->send();
1
2
3
4
5
6
<?php
$customer = new Stancer\Customer('cust_9Cle7TXKkjhwqcWx4Kl5cQYk');

$customer->setEmail('david@coaster.com');

$customer->send();
1
2
3
4
5
import stancer

customer = stancer.Customer('cust_9Cle7TXKkjhwqcWx4Kl5cQYk')
customer.email = 'david@example.com'
customer.send()

Delete a customer

HTTP request

/v1/customers/
id_customer

Query parameters

Parameter Description
id_customer Customer's id

Return parameters

The above command returns an HTTP 204 code if correctly processed or an HTTP 404 code if the customer does not exist.

Code examples

1
curl -X DELETE "https://api.stancer.com/v1/customers/cust_9Cle7TXKkjhwqcWx4Kl5cQYk"

Refunds

1
2
3
4
5
6
7
8
{
  "id": "refd_o6Y1oZinbl9lErB24OSQCAKl",
  "payment": "paym_sS1sXwDuaqGTjuQ7DY4BBNaI",
  "amount": 50,
  "currency": "eur",
  "created": 1540231459,
  "live_mode": false
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
package Stancer::Refund;

use Moo;
use Stancer::Core::Types qw(:all);

has amount => (is => 'ro', isa => Int);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has currency => (is => 'ro', isa => Enum['EUR', 'GBP', 'USD']);

has id => (is => 'ro', isa => Char[29]);

has payment => (is => 'ro', isa => InstanceOf['Stancer::Payment']);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
<?php
namespace Stancer;

use DateTime;

class Refund
{
  protected int $amount;
  protected DateTime $created;
  protected string $currency;
  protected string $id;
  protected Payment $payment;

  public function __construct(string $id = null) {}
}
1
Not available for the moment

The refund object is defined as follows:

Parameter Description Type
id Refund's id String, fixed size = 29
payment Refunded payment id String, fixed size = 29
amount Amount to refund in cents, if omitted will refund the the whole payment Int, have to be =< to the original amount of the payment
currency Processed currency Enum EUR, USD, GBP
status Refund status See refund status codes
created Refund creation's timestamp Int
date_refund Timestamp of the date when the API sent the refund request to the bank Int
date_bank Timestamp of the delivery date of the funds by the bank Int
live_mode Whatever if the refund is in live mode Boolean

Create a refund

1
2
3
4
5
6
curl -X POST "https://api.stancer.com/v1/refunds/" \
  --header "Content-Type: application/json" \
  --data '{
    "payment": "paym_sS1sXwDuaqGTjuQ7DY4BBNaI",
    "amount": 50
}'
1
2
3
4
5
6
#! /bin/perl -w
use Stancer::Payment;

my $payment = Stancer::Payment->new('paym_sS1sXwDuaqGTjuQ7DY4BBNaI');

$payment->refund(50); # Amount is optional
1
2
3
4
<?php
$payment = new Stancer\Payment('paym_sS1sXwDuaqGTjuQ7DY4BBNaI');

$payment->refund(50); // Amount is optional
1
Not available for the moment

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
{
  "amount": 50,
  "created": 1540231459,
  "currency": "eur",
  "id": "refd_o6Y1oZinbl9lErB24OSQCAKl",
  "live_mode": false,
  "payment": "paym_sS1sXwDuaqGTjuQ7DY4BBNaI"
}

HTTP request

/v1/refunds/

Data parameters

Parameter Field
payment Required
amount Optional

Return parameters

The request returns a refund object as previously defined.

Get refund data

1
curl "https://api.stancer.com/v1/refunds/refd_o6Y1oZinbl9lErB24OSQCAKl"
1
2
3
4
#! /bin/perl -w
use Stancer::Refund;

my $refund = Stancer::Refund->new('refd_o6Y1oZinbl9lErB24OSQCAKl');
1
2
<?php
$payment = new Stancer\Refund('refd_o6Y1oZinbl9lErB24OSQCAKl');
1
Not available for the moment

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
{
  "amount": 50,
  "created": 1540231459,
  "currency": "eur",
  "id": "refd_o6Y1oZinbl9lErB24OSQCAKl",
  "live_mode": false,
  "payment": "paym_sS1sXwDuaqGTjuQ7DY4BBNaI"
}

HTTP request

/v1/refunds/
id_refund

Query parameters

Parameter Field
id_refund Required

Return parameters

The request returns a refund object as previously defined.


Disputes

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
  "id": "dspt_kkyLpFvqM8JYQrBJlhN9bxSY",
  "payment": "paym_oTwazegPIbxPnUWDntboWvyL",
  "amount": 5247,
  "currency": "eur",
  "response": "45",
  "order_id": "825030405",
  "created": 1540504800,
  "live_mode": true
}
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
package Stancer::Dispute;

use Moo;
use Stancer::Core::Types qw(:all);

has amount => (is => 'ro', isa => Int);

has created => (is => 'ro', isa => InstanceOf['DateTime']);

has currency => (is => 'ro', isa => Enum['EUR', 'GBP', 'USD']);

has id => (is => 'ro', isa => Char[29]);

has order_id => (is => 'ro', isa => Varchar[1, 24]);

has payment => (is => 'ro', isa => InstanceOf['Stancer::Payment']);

has response => (is => 'ro', isa => Varchar[2, 4]);

1;
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
<?php
namespace Stancer;

use DateTime;

class Dispute
{
  protected int $amount;
  protected DateTime $created;
  protected string $currency;
  protected string $id;
  protected ?string $orderId;
  protected Payment $payment;
  protected string $response;

  public function __construct(string $id = null) {}
}
1
Not available for the moment

The dispute object is defined as follows:

Parameter Description Type
id Dispute's id String, fixed size = 29
payment Related payment's id String, fixed size = 29
amount Disputed amount Int
currency Currency of the disputed amount Enum EUR, USD, GPB
response Response code description See Payment response codes
order_id The order_id you specified in your inital payment request String
created Creation's timestamp of the dispute Int
live_mode Whatever if the refund is in live mode Boolean

Get dispute data

HTTP request

/v1/disputes/
id_dispute

Query parameters

Parameter Field
id_dispute Required

Return parameters

The request returns a dispute object as previously defined.

Code Examples

1
curl "https://api.stancer.com/v1/disputes/<id_dispute>"
1
2
3
4
#! /bin/perl -w
use Stancer::Dispute;

my $dispute = Stancer::Dispute->new('dspt_kkyLpFvqM8JYQrBJlhN9bxSY');
1
2
<?php
$dispute = new Stancer\Dispute('dspt_kkyLpFvqM8JYQrBJlhN9bxSY');
1
Not available for the moment

The above command returns JSON structured as follows:

1
2
3
4
5
6
7
8
9
{
  "amount": 5247,
  "created": 1540504800,
  "id": "dspt_kkyLpFvqM8JYQrBJlhN9bxSY",
  "order_id": "825030405",
  "payment": "paym_oTwazegPIbxPnUWDntboWvyL",
  "response": "45",
  "live_mode": true
}

List all disputes

HTTP request

/v1/disputes/
?created=
created
?start=
start
?limit=
limit

Query parameters

Parameter Field Description Type
created Optional A Unix timestamp filtering disputes whom timestamp are equal to or greater Int
limit Optional An integer value limiting the number of objects to be returned Int, min = 1 max = 100, default = 10
start Optional An integer cursor you can use for pagination starting at index 0 Int, default = 0

Return parameters

Parameter Description
disputes An array of dispute objects
live_mode Whatever if you are in live mode
range Details of your request and pagination. If has_more is true, you will need to move the start cursor ahead to fetch more objects

Code Examples

1
curl "https://api.stancer.com/v1/disputes/?start=0&limit=2"
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#! /bin/perl -w
use Stancer::Dispute;

my $list = Stancer::Dispute->list({created => 1_540_504_800, limit => 2});

while (my $dispute = $list->next()) {
  # Do some stuff with $dispute
}

# `list` method allow `hash` or `hashref`.
# `created` allow `integer` or a `DateTime` instance.
1
2
3
4
5
6
7
8
9
<?php
$date = new DateTime('@1540504800');

foreach (Stancer\Dispute::list([created => $date, limit => 2]) as $dispute) {
  // Do some stuff with $dispute
}

// `list` method return a generator.
// `created` allow `integer` or a `DateTime` instance.
1
Not available for the moment

The above command returns JSON structured as follows:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{
  "disputes": [
    {
      "amount": 5247,
      "created": 1540504800,
      "id": "dspt_kkyLpFvqM8JYQrBJlhN9bxSY",
      "order_id": "825030405",
      "payment": "paym_oTwazegPIbxPnUWDntboWvyL",
      "response": "45"
    },
    {
      "amount": 2999,
      "created": 1541372400,
      "id": "dspt_VIk2SufjagxqT6ZtoRbqUkUm",
      "order_id": "825198976",
      "payment": "paym_oArnefSPklDJ6pEFdxIF6QkG",
      "response": "45"
    }
  ],
  "live_mode": true,
  "range": {
    "end": 1,
    "has_more": true,
    "limit": 2,
    "start": 0
  }
}

Payment webpage

Reach the webpage

Stancer’s payment webpage can be reached via:

  • A simple redirection
  • An iframe

Regardless how you reach the payment webpage, its URL remains the same: the webpage automatically detects the used mode.

Use the payment webpage

Create a valid payment object

To use our webpage, you will need to create a payment object that contains the parameters listed below:

  • Amount
  • Object
  • Redirect url

Please refer to the appropriate section to create a payment object.

Forge a valid payment page URL

The generic webpage’s address is: https://payment.stancer.com/[public key]/[payment id]?lang=[lang].

To forge a valid URL, you will need to replace the following objects within the generic webpage’s adress:

  • [public key]: Replace this field by your personal public key (either pprod or ptest depending whether your in live mode or not)
  • [payment id]: replace this field by the valid payment object you created

Redirection

Once you created a valid URL, simply redirect your users to the valid URL you just forged.

They will be automatically redirected to the return URL you provided.

Iframe integration

Simply add your valid URL within the following code sample <iframe src="xxx"></iframe> to use the payment webpage as an iframe.

Using the iframe enables the payment page to communicate with your website thus allowing you to have some information about the payment being currently processed. For further details on messages handling, please refer to the MDN.

Please note that you will need to indicate the message’s origin to safely use the iframe. Here is a code example :

1
2
3
4
5
6
7
8
9
function receiveMessage(event)
{
  if (event.origin !== 'https://payment.stancer.com')
    return;

  // ...
}

window.addEventListener('message', receiveMessage, false);

Data sent to event.data are sent through a Javascript object.

Available keys for the iframe are the following:

key Description
width int, page’s widht (pxls)
height int, page’s height (pxls)
status string, process’state
url string, redirect url

height and width keys allow you to change the iframe’s size and therefore ensure a seamless integration into your website.

You will find below a code example of our iframe's integration:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
window.addEventListener('message', function (event) {
  if (event.origin !== 'https://payment.stancer.com') {
    return;
  }

  var minHeight = 320;
  var props = {};

  if (event.data.width) {
    props.width = event.data.width;
  }

  if (event.data.height && event.data.height > minHeight) {
    props.height = event.data.height;
  }

  if (props) {
    $('.js-stancer-payment-iframe').animate(props, {
      duration: 200,
      easing: 'linear',
      queue: false,
    });
  }
});

Status & events

Status field can take the following values :

value Description
error an error occurred, our webpage then displays a generic error messages and redirects your user to the redirect URL you provided (within the payment object). The error code will be displayed within the payment status (href).
init the webpage is loading up
invalid the webpage cannot process the payment. You may have sent an incorrect payment object
finished payment has been sent for capture. The webpage will soon redirect your user to the redirect URL you provided within the payment object.
pending the webpage is awaiting for the user to fill up the payment form
secure-auth-end the SCA (Strong Customer Authentication) is done, the webpage will soon process the payment
secure-auth-error the SCA failed (due to a timeout, a failed authentication…). The webpage generates the appropriate error code and then redirects your user.
secure-auth-start SCA is going to begin : our webpage will soon redirect your user to its SCA’s webpage for authentication.

The regular process can be summed up as: init > pending > finished.

If you do use authenticated payments (which we strongly recommend), the regular process becomes: init > pending > secure-auth-start > secure-auth-end > finished.

During redirects, the return URL is added so your user is seamlessy redirected through the different websites used to process the payment. Please note that our webpage automatically redirects after 3 seconds. You can use some status to shorten this duration and for instance decide to immediately redirect you user if our webpage indicates a status such as error or finished.

Languages

Add lang parameter

You can add an optional language parameter lang to the payment page URL. By doing so, the URL becomes: https://payment.stancer.com/[public key]/[payment id]?lang=[lang]. This parameter uses the BCP47 format (e.g: fr-fr, fr-be).

Please note that letter case is not considered and that the used delimiter can be either a dash or underscore.

Translation process

The webpage will use your user’s browser language by default. If we do not support this language, the webpage will then switch to the lang parameter mentioned previously. Again, if this translation is not yet available, our webpage will then be displayed in English.

The lang parameter overrules the previous logic: when used, the payment page will use the parameter you set. If not available, the webpage will switch to broswer’s language and ultimately fall back to our default language (English) if we do not support the user browser’s language.

Example: an Italian user is using your website translated to Portuguese. You decide to redirect him using a lang parameter set to pt-pt. Our webpage then tests:

  • Is a pt-pt translation available? Sadly not yet
  • Is an it-it translation available? Again, unfortunately no

Therefore, the webpage will be displayed in English.


Payouts

Warning

Currently payouts exist only in live mode. Those routes return 501 Not implemented error if you use a test mode API key.

Payouts are the credit transferts regularly sent by Stancer to your bank to transfer your collections processed with Stancer. Each payout contains your customer's payments, refunds and potential disputes. Therefore, a payout object is structured as follows :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
{
  "amount": 9400,
  "created": 1642744806,
  "currency": "eur",
  "date_bank": null,
  "date_paym": 1642633200,
  "fees": 100,
  "id": "pout_GexV3lpllrBkyRny15qfsMC0",
  "live_mode": true,
  "payments": {
    "amount": 15000
  },
  "refunds": {
    "amount": 5000
  },
  "disputes": {
    "amount": 500
  },
  "statement_description": "Stancer Payout Statement",
  "status": "paid"
}

The payout object is defined as follows:

Parameter Description Type
id Payout id String, fixed size = 29
amount The total credit tranfer amount you will receive Int
currency Processed currency Enum EUR
date_paym The date the payment transactions were made  Timestamp, Int
date_bank The date you will receive the credit tranfer  Timestamp, Int
fees The fees you paid for processing the payments Int
payments Payments processed the date_paym date Object
refunds Refunds processed the date_paym date Object
disputes Disputes received the date_paym date Object
statement_description The statement description which will be displayed on your bank account String
status Payout status See payout status codes
created Payout creation's timestamp Int

Get the payout list

HTTP request

/v1/payouts/
?created=
created
&start=
start
&limit=
limit

Query parameters

Parameter Field Description Type
created Optional A Unix timestamp filtering payments whom timestamps are equal to or greater Int
limit Optional An integer value limiting the number of objects to be returned Int, min = 1, max = 100, default = 10
start Optional An integer cursor you can use for pagination starting at index 0 Int, default = 0
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
{
    "live_mode": true,
    "payouts": [
    {
      "amount": 9400,
      "created": 1642744806,
      "currency": "eur",
      "date_bank": null,
      "date_paym": 1642633200,
      "fees": 100,
      "id": "pout_GexV3lpllrBkyRny15qfsMC0",
      "live_mode": true,
      "payments": {
        "amount": 15000
      },
      "refunds": {
        "amount": 5000
      },
      "disputes": {
        "amount": 500
      },
      "statement_description": "Stancer Payout Statement",
      "status": "paid"
    }
    ],
    "range": {
        "created": 1585127453,
        "end": 0,
        "has_more": true,
        "limit": 1,
        "order_id": null,
        "start": 0,
        "unique_id": null
    }
}

Get a payout detail

HTTP request

/v1/payouts/
id_payout
/
type
/
?created=
created
&start=
start
&limit=
limit

Query parameters

Parameter Field Description Type
type Payout type can be payments, refunds, disputes String
created Optional A Unix timestamp filtering payments whom timestamps are equal to or greater Int
limit Optional An integer value limiting the number of objects to be returned Int, min = 1, max = 100, default = 10
start Optional An integer cursor you can use for pagination starting at index 0 Int, default = 0

This endpoint will return an object type list as previously described such as List all payments


Test cards

Valid cards

Americas

Number Brand Funding Country 3DS Return
4242424242424242 Visa Credit US 🇺🇸 Not required OK
4444333322221111 Visa Debit US 🇺🇸 Not required OK
4111111111111111 Visa Prepaid US 🇺🇸 Not required OK
5555555555554444 Mastercard Credit US 🇺🇸 Optional OK
5200828282828210 Mastercard Debit US 🇺🇸 Optional OK
5105105105105100 Mastercard Prepaid US 🇺🇸 Optional OK
4000000000003220 Visa Credit US 🇺🇸 Required Must perform 3DS (A1)
4000000000003055 Visa Credit US 🇺🇸 Not enrolled OK
4000000760000002 Visa Credit BR 🇧🇷 Optional OK
4000001240000000 Visa Credit CA 🇨🇦 Optional OK
4000004840000008 Visa Credit MX 🇲🇽 Optional OK

Europe

Number Brand Country 3DS Return
4000000400000008 Visa AT 🇦🇹 Optional OK
4000000560000004 Visa BE 🇧🇪 Optional OK
4000002080000001 Visa DK 🇩🇰 Optional OK
4000002460000001 Visa FI 🇫🇮 Optional OK
4000002500000003 CB FR 🇫🇷 Optional OK
4000002760000016 Visa DE 🇩🇪 Optional OK
4000003720000005 Visa IE 🇮🇪 Optional OK
4000003800000008 Visa IT 🇮🇹 Optional OK
4000004420000006 Visa LU 🇱🇺 Optional OK
4000005280000002 Visa NL 🇳🇱 Optional OK
4000005780000007 Visa NO 🇳🇴 Optional OK
4000006200000007 Visa PT 🇵🇹 Optional OK
4000006430000009 Visa RU 🇷🇺 Optional OK
4000007240000007 Visa ES 🇪🇸 Optional OK
4000007520000008 Visa SE 🇸🇪 Optional OK
4000007560000009 Visa CH 🇨🇭 Optional OK
4000008260000000 Visa GB 🇬🇧 Optional OK

Asia / Pacific

Number Brand Country 3DS Return
4000000360000006 Visa AU 🇦🇺 Optional OK
4000001560000002 Visa CN 🇨🇳 Optional OK
4000003440000004 Visa HK 🇭🇰 Optional OK
4000003920000003 Visa JP 🇯🇵 Optional OK
3530111333300000 JCB JP 🇯🇵 Optional OK
4000007020000003 Visa SG 🇸🇬 Optional OK
4000005540000008 Visa NZ 🇳🇿 Optional OK

Invalid cards

Number Brand Country 3DS Return
4000000000000002 Visa FR 🇫🇷 Optional Do not honor (05)
4000000000009995 Visa FR 🇫🇷 Optional Insufficient funds (51)
4000000000009987 Visa FR 🇫🇷 Optional Lost card (41)
4000000000009979 Visa FR 🇫🇷 Optional Stolen card (42)

Automatically generates a captured payment

Number Brand Country 3DS Return
4000000000000077 Visa FR 🇫🇷 Optional Captured

Automatically generates a dispute

Number Brand Country 3DS Return
4000000000000259 Visa FR 🇫🇷 Optional Dispute
4000000000001976 Visa FR 🇫🇷 Optional Duplicated
4000000000005423 Visa FR 🇫🇷 Optional Fraud

Test IBANs

Europeans Valid IBANs

IBAN Country Name Birthdate Signature Return
AT611904300234573201 AT 🇦🇹 Otto Normalverbraucher 1971-02-02 Optional OK
BE62510007547061 BE 🇧🇪 Jef Van Pijperzele 1972-03-03 Optional OK
CH2089144321842946678 CH 🇨🇭 Leonhard Euler 1973-04-04 Optional OK
DE89370400440532013000 DE 🇩🇪 Max Mustermann 1974-05-05 Optional OK
EE382200221020145685 EE 🇪🇪 Friedrich Robert Faehlmann 1975-06-06 Optional OK
ES0700120345030000067890 ES 🇪🇸 Juan Pérez 1976-07-07 Optional OK
FI2112345600000785 FI 🇫🇮 Maija Meikäläinen 1977-08-08 Optional OK
FR1420041010050500013M02606 FR 🇫🇷 Pierre Martin 1978-09-09 Optional OK
GB33BUKB20201555555555 GB 🇬🇧 John Doe 1970-01-01 Optional OK
IE29AIBK93115212345678 IE 🇮🇪 John Kilkenny 1979-10-10 Optional OK
LT121000011101001000 LT 🇱🇹 Jonas Petraitis 1980-11-11 Optional OK
LU280019400644750000 LU 🇱🇺 Adalbert Boros 1981-12-12 Optional OK
IT02A0301926102000000490887 IT 🇮🇹 Piero Pers 1982-01-13 Optional OK
NL39RABO0300065264 NL 🇳🇱 Jan Modaal 1983-02-14 Optional OK
NO9386011117947 NO 🇳🇴 Peder Aas 1984-03-15 Optional OK
PT50000201231234567890154 PT 🇵🇹 Jan Kowalski 1985-04-16 Optional OK
SE3550000000054910000003 SE 🇸🇪 Lisa Svensson 1986-05-17 Optional OK

Invalid IBANs

IBAN Country Name Birthdate Signature Return
FR2990665286926539507769811 FR 🇫🇷 Jean Banbois 1992-11-23 Optional Incorrect Account Number (AC01)
FR8191676442817818484578833 FR 🇫🇷 Marie-Jeanne Sansbanque 1993-12-24 Optional Closed Account Number (AC04)
FR3083648641551044006702169 FR 🇫🇷 Marc Barrer 1994-01-25 Optional Blocked Account (AC06)
FR4200838098473368525032012 FR 🇫🇷 Sophie Fontek 1995-02-26 Optional Transaction Forbidden (AG01)
FR7099253427049384102178149 FR 🇫🇷 Hector Fauché 1996-03-27 Optional Insufficient Funds (AM04)
FR7240745948453163519978561 FR 🇫🇷 Lillianne Sansmandat 1997-04-28 Optional No Mandate (MD01)
FR5533686478441573584650545 FR 🇫🇷 Vincent Refusé 1998-05-29 Optional Refund Request By End Customer (MD06)
FR2488294045573706143240475 FR 🇫🇷 Eric Indécis 1999-06-30 Optional Not Specified Reason Customer Generated (MS02)

Automatically generates a captured payment

IBAN Country Name Birthdate Signature Return
FR9430003000409249176322Z50 FR 🇫🇷 Gilles Dupont 1987-06-18 Optional OK

Automatically generates a dispute

IBAN Country Name Birthdate Signature Return
BE08510007547063 BE 🇧🇪 Camille Honnête 1988-07-19 Optional Insufficient Funds (AM04)
ES5000120345030000067892 ES 🇪🇸 Pepito Pérez 1990-09-21 Optional Closed Account Number (AC04)
FR5720041010050500013M02608 FR 🇫🇷 Michel Pascontent 1989-08-20 Optional Not Specified Reason Customer Generated (MS02)
NL82RABO0300065266 NL 🇳🇱 Agathe Feeling 1991-10-22 Optional Refund Request By End Customer (MD06)

Fields inclusion

The following table defines the inclusion values used in fields descriptions:

Inclusion value Definition
Required Must include the field
Conditional Must include the field if the conditions are satisfied
Optional May include the field

Return codes

Payment status codes

The status field in the payment object indicates in which state is the payment.

Status Meaning
authorized The bank authorized the payment but the transaction will only be processed when the capture will be set to true
canceled The payment will not be performed, no money will be captured
captured The amount of the payment have been credited to your account
capture_sent The capture operation is being processed, the payment can not be cancelled anymore, refunds must wait the end of the capture process
disputed The customer declined the payment after it have been captured on your account
expired The authorisation was not captured and expired after 7 days
failed The payment has failed, refer to the response field for more details
refused The payment has been refused
to_capture The bank authorized the payment, money will be processed within the day

You can also pass one of the following status:

Status Meaning
authorize Ask the authorization
capture Ask to authorize and capture the payment

Refund status codes

The status field in the refund object indicates in which state is the refund.

Status Meaning
failed The refund has failed, refer to the response field for more details
not_honored When payment is disputed while trying to refund
refund_sent The refund has been sent to the bank, awaiting an answer
refunded The amount of the refund have been credited to your account
to_refund Refund will be processed within the day

Authenticated payment status codes

The status field in the auth object returns the authorisation state for an authenticated payment.

Status Meaning
attempted Customer was redirected to his bank for authentication
available Customer strong authentication is possible
declined Authentication declined
expired Authentication sessions expired after 6 hours
failed Authentication failed
requested A strong authentication is awaiting for more information
success Authentication succeeded, processing can continue
unavailable The strong authentication is not available for this payment method

You can also pass one of the following status:

Status Meaning
request The merchant asked for a strong authentication

Scoring status codes

The status field in the scoring object returns the state of the scoring.

Status Meaning
attempted Customer was redirected to his bank for authentication
declined The customer declined the scoring process
expired Authentication sessions expired after 6 hours
failed Authentication failed
success The scoring process has succeeded
unavailable The customer's bank does not allow DSP2 processing

Payout status codes

The status field in the payout explains in which state is the credit transfer which wires funds from Stancer to your bank.

Status Meaning
pending The payout has been created and is awaiting for clearing
to_pay The payout is ready to be transfered
sent The payout has been sent out for processing
paid The payout credit transfer has been processed: funds have been received by your bank
failed The credit transfer has failed, please refer to you dashboard for more informations

Payment response codes

Card response codes

Code Meaning
00 Successful approval/completion or that VIP PIN verification is valid
01 Refer to card issuer
02 Refer to card issuer, special condition
03 Invalid merchant or service provider
04 Pickup
05 Do not honor
06 General error
07 Pickup card, special condition (other than lost/stolen card)
08 Honor with identification
09 Request in progress
10 Partial approval
11 VIP approval
12 Invalid transaction
13 Invalid amount (currency conversion field overflow) or amount exceeds maximum for card program
14 Invalid account number (no such number)
15 No such issuer
16 Insufficient funds
17 Customer cancellation
19 Re-enter transaction
20 Invalid response
21 No action taken (unable to back out prior transaction)
22 Suspected Malfunction
25 Unable to locate record in file, or account number is missing from the inquiry
28 File is temporarily unavailable
30 Format error
41 Merchant should retain card (card reported lost)
43 Merchant should retain card (card reported stolen)
51 Insufficient funds
52 No checking account
53 No savings account
54 Expired card
55 Incorrect PIN
57 Transaction not permitted to cardholder
58 Transaction not allowed at terminal
59 Suspected fraud
61 Activity amount limit exceeded
62 Restricted card (for example, in country exclusion table)
63 Security violation
65 Activity count limit exceeded
68 Response received too late
75 Allowable number of PIN-entry tries exceeded
76 Unable to locate previous message (no match on retrieval reference number)
77 Previous message located for a repeat or reversal, but repeat or reversal data are inconsistent with original message
78 ’Blocked, first used’—The transaction is from a new cardholder, and the card has not been properly unblocked.
80 Visa transactions: credit issuer unavailable. Private label and check acceptance: Invalid date
81 PIN cryptographic error found (error found by VIC security module during PIN decryption)
82 Negative CAM, dCVV, iCVV, or CVV results
83 Unable to verify PIN
85 No reason to decline a request for account number verification, address verification, CVV2 verification; or a credit voucher or merchandise return
91 Issuer unavailable or switch inoperative (STIP not applicable or available for this transaction)
92 Destination cannot be found for routing
93 Transaction cannot be completed, violation of law
94 Duplicate transmission
95 Reconcile error
96 System malfunction, System malfunction or certain field error conditions
A0  Authentication Required, you must do a card inserted payment with PIN code
A1  Authentication Required, you must do a 3-D Secure authentication
B1 Surcharge amount not permitted on Visa cards (U.S. acquirers only)
N0 Force STIP
N3 Cash service not available
N4 Cashback request exceeds issuer limit
N7 Decline for CVV2 failure
P2 Invalid biller information
P5 PIN change/unblock request declined
P6 Unsafe PIN
Q1 Card authentication failed
R0 Stop payment order
R1 Revocation of authorization order
R3 Revocation of all authorizations order
XA Forward to issuer
XD Forward to issuer
Z1 Offline-declined
Z3 Unable to go online
7810 Refusal count exceeded for this card / sepa
7811 Exceeded payment volume for this card / sepa
7840 Stolen or lost card
7898 Bank server unavailable

Dispute response codes

Response Network Meaning
14 National Transaction not authorized
42 National Duplicate processing
45 National Transaction disputed
1040 Visa Fraud; card Absent Environment
1261 Visa Duplicate processing
4808 Mastercard Requested/required authorization not obtained. Transaction not authorized
4834 Mastercard Duplicate processing
4837 Mastercard Fraudulent transaction; no cardholder authorization
4853 Mastercard Cardholder Dispute Defective/Not as Described
4863 Mastercard Cardholder does not recognize. Potential fraud

HTTP response codes

Stancer's Payments API, through HTTP response status codes, indicates if your payment request succeeded or failed.

Here are the 3 status codes ranges you can expect:

  • 2xx success status codes confirm that your request worked as expected
  • 4xx error status codes indicate an error caused by the provided information (e.g., a required parameter was omitted)
  • 5xx error status codes are rare and indicate an error with the API servers

The API uses the following detailed HTTP error codes:

Code Reason Meaning
200 OK A successful HTTP request
204 No Content The server successfully processed the request and no content returned
400 Bad Request Your request is invalid
401 Unauthorized Your API key is wrong
404 Not Found The specified object could not be found
409 Conflict The request could not be processed because of conflict in the current state of the resource
429 Too Many Requests You're requesting too many objects! Slow down!
498 Token expired/invalid It indicates an expired or otherwise invalid token
500 Internal Server Error We had a problem with our server. Try again later
503 Service Unavailable We're temporarily offline for maintenance. Please try again later