> ## Documentation Index
> Fetch the complete documentation index at: https://docs.clearline.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Introduction to Transactions

> Send purchase data to ClearLine for loyalty, analytics, and marketing

Transaction endpoints allow you to send purchase data from your POS system to ClearLine. This data powers loyalty programs, customer analytics, personalized marketing campaigns, and receipt promotions.

## What are Transactions?

Transactions represent completed purchases at your point of sale. When you send transaction data to ClearLine, you unlock:

* **Loyalty Program Tracking:** Automatically award points, stamps, or rewards based on purchase behavior
* **Customer Analytics:** Track purchase patterns, preferences, and customer lifetime value
* **Targeted Marketing:** Trigger personalized offers based on what customers buy
* **Receipt Promotions:** Display relevant promotions on customer receipts
* **Coupon Validation:** Apply and track coupon usage in real-time

## Core Workflow

<Steps>
  <Step title="Start an Interaction" icon="play">
    Initiate a customer interaction session using [Start
    Interaction](/api-reference/pos-api-v1/start-pos-interaction). This returns a `sessionId` that links the transaction to the customer interaction.
  </Step>

  <Step title="Send Transaction Data" icon="receipt">
    Submit the completed purchase using the [Create POS
    Transaction](/api-reference/transactions/create-pos-transaction) endpoint with your session ID, purchase items, and customer details.
  </Step>

  <Step title="Process Response" icon="check">
    ClearLine returns loyalty points earned, applied coupons, triggered promotions, and receipt content.
  </Step>
</Steps>

## When to Send Transactions

<Tabs>
  <Tab title="Post-Purchase">
    Send transaction data **after** the purchase is complete and payment is confirmed. **Best for:** Standard checkout flow with confirmed payments (most common)
  </Tab>

  <Tab title="Pre-Purchase Validation">
    Send transaction data **before** finalizing the sale to validate coupons and calculate discounts. **Best for:** Real-time coupon validation and discount previews
  </Tab>

  <Tab title="Real-Time Updates">
    Send transaction updates as items are scanned or modified during checkout. **Best for:** Live loyalty point calculations and dynamic offer triggers
  </Tab>
</Tabs>

## Transaction Endpoints

<CardGroup cols={2}>
  <Card title="Create POS Transaction" icon="receipt" href="/api-reference/transactions/create-pos-transaction">
    Send completed purchase data to ClearLine
  </Card>

  <Card title="Start Interaction" icon="play" href="/api-reference/pos-api-v1/start-pos-interaction">
    Initiate a customer session before sending transactions
  </Card>

  <Card title="Validate Coupons" icon="ticket" href="/api-reference/coupons-api-v2/lookup-and-validate-coupon-codes">
    Validate coupon codes before applying to transactions
  </Card>

  <Card title="Receipt Promotions" icon="file-invoice" href="/api-reference/pos-receipt/get-receipt-promotion-details">
    Retrieve promotion details to display on receipts
  </Card>
</CardGroup>

## Best Practices

<AccordionGroup>
  <Accordion title="Always Link to Sessions" defaultOpen icon="link">
    Include the `sessionId` from your interaction start call in every transaction to track the complete customer journey and attribute loyalty rewards correctly.
  </Accordion>

  <Accordion title="Handle Refunds Properly" icon="rotate-left">
    Send refund transactions with negative amounts and reference the original transaction ID to ensure loyalty points are adjusted and analytics remain accurate.
  </Accordion>

  <Accordion title="Include Product Details" icon="box">
    Send detailed product information (SKU, category, price) for each item to enable category-based promotions and better customer insights.
  </Accordion>

  <Accordion title="Implement Retry Logic" icon="arrows-rotate">
    Network issues happen. Implement exponential backoff retry for failed transaction sends to prevent lost data and loyalty point discrepancies.
  </Accordion>
</AccordionGroup>

## Next Steps

<CardGroup cols={2}>
  <Card title="Transaction API Reference" icon="code" href="/api-reference/transactions/create-pos-transaction">
    View complete API specification and request examples
  </Card>

  <Card title="Complete Integration Guide" icon="book-open" href="/pos-integration/post-purchase-transaction-to-cmc">
    Step-by-step guide with code examples and workflow diagrams
  </Card>

  <Card title="Quick Start Tutorial" icon="rocket" href="/api-reference/quick-start">
    Get your first transaction working in 5 minutes
  </Card>

  <Card title="Coupon Integration" icon="ticket" href="/pos-integration/coupons/validate-coupon-via-transaction">
    Learn how to validate and apply coupons in transactions
  </Card>
</CardGroup>
