Skip to main content

Card Pool

General Information

Sailplay implements the ability to upload a list of cards and subsequently retrieve cards from it using an API.

The retrieved values can be used:

  • atomically — simply to get a card number;
  • with client binding — to immediately record the card number in the client's profile.

In practice, this functionality is most often used for the generation and issuance of virtual card numbers, which:

  • can be inserted into emails and messages;
  • do not have a physical medium.

Each code can be retrieved from a group only once.

When recording a card number to a client, the system checks whether this origin_user_id is already in use by other clients.
If the code is already taken, it is skipped, and the system attempts to take the next one.
Maximum number of attempts — 5.


API Methods

Creating a Card Pool

Creating a pool (group) of card numbers is performed using the method /partners/origin-user-ids/load/.

Uploading is carried out via a POST request with a .txt file, where:

  • each line of the file contains one card number.

The request must pass:

  • authorization data;
  • group name (group_name), into which the numbers will be loaded.

Upon successful processing:

  • a group with the specified name is created;
  • all numbers from the file are added to the pool.
info

Multiple files can be uploaded to the same group.
Values will be appended, while only unique card numbers are preserved in the group.


Retrieving a Card Number

After creating a group, two ways to retrieve a card number are available.

Retrieve a Card Number

Method /partners/origin-user-ids/allocate/

  • returns a free card number from the group (group_name);
  • marks the number as issued;
  • the number can then be used in business logic (for example, displayed to the client).

Retrieve and Immediately Assign to Client

Method /partners/origin-user-ids/allocate-and-assign/

  • returns a card number from the group;
  • automatically assigns it to the client as origin_user_id;
  • the client is determined by the passed identifier.
warning

If the client already had an origin_user_id specified, the value will be overwritten when using the allocate-and-assign method.