POST
/
api
/
loyalty
/
transactions
import SnagSolutions from '@snagsolutions/sdk';

const client = new SnagSolutions({
  apiKey: process.env['X_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const response = await client.loyalty.transactions.createTransaction({
    description: 'Purchase of item X',
    entries: [{ amount: 5 }],
  });

  console.log(response.id);
}

main();
{
  "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
  "description": "<string>",
  "entries": [
    {
      "walletAddress": "<string>",
      "amount": 123,
      "direction": "credit",
      "idempotencyKey": "<string>"
    }
  ],
  "createdAt": "<string>",
  "updatedAt": "<string>"
}

Authorizations

X-API-KEY
string
header
required

Body

application/json
Body

Schema for creating a loyalty transaction

description
string
required

Description of the loyalty transaction

Example:

"Purchase of item X"

entries
object[]
required

Array of transaction entries

loyaltyCurrencyId
string

Unique identifier for the loyalty currency

Example:

"123e4567-e89b-12d3-a456-426614174090"

Response

200
application/json
200
id
string
required
description
string
required
entries
object[]
required
createdAt
string
required
updatedAt
string
required