Skip to main content

Gifts

In the context of the platform, gifts are a separate entity used as a reward for loyalty program participants. A gift can be obtained by spending accumulated bonus points.

A gift can be a product from your catalog, a promocode, or any other object.


Creating and Editing a Gift

Creating a Gift

Creating a gift is performed with a request to the method:

  • /api/v2/gifts/manage/create/

In the request, along with authorization data, the following fields must be passed:

  • name — name of the gift
  • description — text description of the gift
  • points — cost of the gift in bonus points
  • pic — image of the gift (file passed in the request body)

Optionally, for a gift, you can specify:

  • sku — product identifier of the gift
  • enabled — gift status (1 — available for issuance, 0 — unavailable)
Important

When sending a request to create or edit a gift, the POST method must be used.

Editing a Gift

Editing a gift is performed with the method:

  • /api/v2/gifts/manage/edit/

In terms of request/response structure and passed parameters, it is similar to creation, but there are differences:

  • when editing, necessarily pass the gift_id parameter — the gift ID
  • pass only those parameters that you are changing (or pass all — then all will be updated)
  • you cannot change the gift type (from non-coupons to coupon)
  • if the gift type is coupon, and you pass the coupons parameter, all new non-repeating coupons will be added to the existing list

Getting a List of Gifts

To get a list of all created gifts, use the method /api/v2/gifts/list/


Issuing a Gift

Issuing a gift to a client is performed with the method:

  • /api/v2/gifts/purchases/new/

The client identifier and the gift identifier must be passed in the request.

The following is used as the gift identifier:

  • sku — if it was specified during creation, or
  • gift_id — identifier in Sailplay (returned upon gift creation in the id field)

If required by business logic, an order number can be passed as a separate order_num parameter when issuing a gift (this field is optional).

Canceling Gift Issuance

To cancel gift issuance, send a similar request to the method:

  • /api/v2/gifts/purchases/delete/

Editing Gift Issuance

Method for editing gift issuance:

  • /api/v2/gifts/purchases/edit/

Used to edit an issued gift (for example, to transfer it to another client).

In addition to authorization data, the following must be passed in the request:

  • purchase_gift_id — identifier of the gift issuance transaction
  • client identifier to which the transaction will be linked