Register a card
Registers a card and assigns the POS terminals its payments are sent through.
The name, slug, bank, card_type, card_payment_type, cash_payment and installment_payment fields are all required. three_d_payment, installment_three_d_payment and is_commerce_card may be omitted; the card is then created without 3D secure terminals and is not marked as a commerce card.
Two uniqueness rules apply, and they fail differently. The combination of bank, card_type and card_payment_type must not already exist — a repeat fails validation with 400 Bad Request. Separately, the code in slug must not already belong to another card of the same bank — a repeat is rejected with 406 Not Acceptable and the message <code> already exists. See Uniqueness.
The terminals assigned here are only reached under the conditions described in Dynamic Settings & Environment Variables: in particular, a three_d_payment terminal is never used while 3D secure verification is switched off through THREE_D_SECURE_ENABLED, and is_commerce_card has no visible effect until the commerce-card installment filters are configured through INSTALLMENT_FILTERS.
Token credential sent in the Authorization header, in the form: Token <your-token>. Requires a staff (admin) account.
Request body for registering or fully updating a card. name, slug, bank, card_type, card_payment_type, cash_payment and installment_payment are required on both operations.
On create, an omitted three_d_payment or installment_three_d_payment leaves the card without that terminal, and an omitted is_commerce_card stores the card as not being a commerce card. On a full update those three keep their stored values instead of being cleared; send a terminal field as null or is_commerce_card as false to reset them.
Display name of the card.
Example CardThe code that identifies the card within its bank. May contain only letters, digits, underscores and hyphens. Must not already belong to another card of the same bank.
example-cardIdentifier of the bank the card belongs to. Must match an existing bank.
3Identifier of the card type. Must match an existing card type.
1Whether a card is a credit or a debit card.
credit— a credit card. A card stored without a payment type is treated as one.debit— a debit card. WhileTHREE_D_REDIRECT_DEBITis on, which is the default, every payment matched to a card marked this way is redirected to 3D secure verification.
creditPossible values: Identifier of the POS terminal a single, non-installment payment is sent through. Must match an existing terminal.
5Identifier of the POS terminal an installment payment is sent through. Must match an existing terminal.
5Identifier of the POS terminal used when a single payment is redirected to 3D secure verification. Optional; send null to leave the card without one.
6Identifier of the POS terminal used when an installment payment is redirected to 3D secure verification. Optional; send null to leave the card without one.
6Whether the card is the store's own commerce card. Optional; a card created without it is stored as false.
falseThe registered card.
A card returned by the API — the record that describes a payment card the store accepts and states which POS terminal each kind of payment made with it is sent through. The bank, the card type and the four terminal fields are returned as identifiers rather than nested objects.
Unique identifier of the card.
Display name of the card.
Example CardThe code that identifies the card within its bank. Unique among the cards of the same bank, but the same code may be used by cards of other banks.
example-cardIdentifier of the bank the card belongs to.
3Identifier of the card type — the scheme or programme of the card.
1Whether a card is a credit or a debit card.
credit— a credit card. A card stored without a payment type is treated as one.debit— a debit card. WhileTHREE_D_REDIRECT_DEBITis on, which is the default, every payment matched to a card marked this way is redirected to 3D secure verification.
creditPossible values: Identifier of the POS terminal a single, non-installment payment is sent through.
5Identifier of the POS terminal an installment payment is sent through.
5Identifier of the POS terminal used when a single payment is redirected to 3D secure verification, or null when the card has none. Never used while THREE_D_SECURE_ENABLED is off.
6Identifier of the POS terminal used when an installment payment is redirected to 3D secure verification, or null when the card has none.
6Whether the card is the store's own commerce card. Read by the commerce-card installment filters, and without effect while none of them is configured through INSTALLMENT_FILTERS.
falseThe request contains invalid or missing data. Alongside the usual per-field messages, one case is specific to cards: when the bank, card_type and card_payment_type of the request repeat a combination that another card already uses, the answer is reported under non_field_errors and names those three fields as a set. The other uniqueness rule — the code of a card within its bank — is answered with 406 Not Acceptable instead.
Authentication credentials were not provided or are invalid.
The authenticated user does not have administrator privileges.
The request is well-formed but another card of the same bank already uses the code sent in slug.
POST /api/v1/remote/1/cards/ HTTP/1.1
Host: sandbox.akinon.com
Authorization: YOUR_API_KEY
Content-Type: application/json
Accept: */*
Content-Length: 215
{
"name": "Example Card",
"slug": "example-card",
"bank": 3,
"card_type": 1,
"card_payment_type": "credit",
"cash_payment": 5,
"installment_payment": 5,
"three_d_payment": 6,
"installment_three_d_payment": 6,
"is_commerce_card": false
}{
"pk": 1,
"name": "Example Card",
"slug": "example-card",
"bank": 3,
"card_type": 1,
"card_payment_type": "credit",
"cash_payment": 5,
"installment_payment": 5,
"three_d_payment": 6,
"installment_three_d_payment": 6,
"is_commerce_card": false
}Last updated
Was this helpful?

