Skip to main content
POST
/
{locale}
/
shop
/
transactions
/
create
curl -X POST "https://staging-api.loyalty.lt/en/shop/transactions/create" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -d '{
    "user_email": "[email protected]",
    "order_id": "WC-12345",
    "order_total": 49.99,
    "currency": "EUR"
  }'
{
  "success": true,
  "message": "Points awarded successfully",
  "data": {
    "transaction_id": 12345,
    "points_awarded": 500,
    "points_balance": 1750,
    "loyalty_card_id": 567,
    "card_number": "123-456-789",
    "user_id": 123,
    "order_total": 49.99,
    "currency": "EUR"
  }
}

Create Transaction

Create a purchase transaction for a user, automatically calculating and awarding loyalty points. This endpoint supports both earning points and redeeming points in a single transaction.
This is the primary endpoint for e-commerce integrations (WooCommerce, Shopify, etc.) to award and redeem points. It requires Shop API authentication.

Path Parameters

locale
string
required
Language code (e.g., en, lt)

Authentication

X-API-Key
string
required
API key from Partners Portal
X-API-Secret
string
required
API secret from Partners Portal

Request Body

Required Fields

user_id
integer
User’s ID in the system (required if user_email not provided)
user_email
string
User’s email address (required if user_id not provided)
order_id
string
required
Unique order/transaction reference from your systemExample: "WC-12345", "ORDER-2024-001"
order_total
number
required
Total order amount for points calculationExample: 49.99

Optional Fields

points
integer
Manual points override (if not provided, calculated from card settings)
currency
string
default:"EUR"
Currency code (ISO 4217)
description
string
Transaction description (auto-generated if not provided)
shop_id
integer
Shop ID for multi-location tracking
partner_card_id
integer
Specific partner card template to use
loyalty_card_id
integer
Existing user loyalty card ID to use

Points Redemption

points_redeemed
integer
Number of points to redeem for discount
points_discount_amount
number
Discount amount applied via points redemption

Cart Items (for analytics)

cart_items
array
Array of purchased products
meta_data
object
Additional custom metadata

Response

success
boolean
Indicates if transaction was created successfully
message
string
Status message
data
object
curl -X POST "https://staging-api.loyalty.lt/en/shop/transactions/create" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: your_api_key" \
  -H "X-API-Secret: your_api_secret" \
  -d '{
    "user_email": "[email protected]",
    "order_id": "WC-12345",
    "order_total": 49.99,
    "currency": "EUR"
  }'
{
  "success": true,
  "message": "Points awarded successfully",
  "data": {
    "transaction_id": 12345,
    "points_awarded": 500,
    "points_balance": 1750,
    "loyalty_card_id": 567,
    "card_number": "123-456-789",
    "user_id": 123,
    "order_total": 49.99,
    "currency": "EUR"
  }
}

Points Calculation

Points are calculated based on the partner card’s configuration:
base_points = (order_total / currency_amount) × points_per_currency
visit_bonus = points_per_visit
total_points = round(base_points) + visit_bonus
If round_points_up is true, points are rounded up. Otherwise, rounded down.

Example Calculation

Card settings:
  • points_per_currency: 10
  • currency_amount: 1.00
  • points_per_visit: 5
  • round_points_up: true
For €15.50 order:
  1. Base: (15.50 / 1.00) × 10 = 155 points
  2. Visit bonus: +5 points
  3. Total: 160 points

Automatic Card Creation

If the user doesn’t have a loyalty card for your partner:
  1. System finds the partner’s default card template (auto_assign: true)
  2. Creates a new loyalty card for the user
  3. Awards initial bonus points (if configured)
  4. Processes the transaction

Push Notifications

When points are awarded, users receive a push notification in their mobile app:
“Operacija atlikta” : . Gavote taškų!

Alias Endpoint

For backward compatibility, this endpoint is also available as:
POST /{locale}/shop/transactions/award-points