Skip to content

Methods

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"