Skip to main content

Create Payment

Process a payment for an order. Supports partial payments where multiple payments can be made against a single order.

Endpoint

POST /payments

Request Body

orderId
string
required
UUID of the order to pay
method
string
required
Payment method. Options: cash, card, yape, plin, transfer, other
amount
number
required
Payment amount in cents (minimum: 1)
reference
string
Payment reference or transaction ID (max 255 characters)
tip
number
default:"0"
Tip amount in cents (minimum: 0)

Response

success
boolean
Indicates if the payment was processed successfully
data
object
id
string
Payment UUID
order_id
string
Order UUID
organization_id
string
Organization UUID
branch_id
string
Branch UUID
method
string
Payment method used
amount
number
Payment amount in cents
reference
string
Payment reference
tip
number
Tip amount in cents
status
string
Payment status (always “completed”)
created_at
string
ISO 8601 timestamp
order_number
string
Human-readable order number
order_total
number
Total order amount
total_paid
number
Total amount paid so far including this payment
remaining
number
Remaining balance on the order
fully_paid
boolean
Whether the order is now fully paid

Example Request

curl -X POST https://api.restai.app/v1/payments \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "orderId": "550e8400-e29b-41d4-a716-446655440000",
    "method": "cash",
    "amount": 5000,
    "tip": 500
  }'

Example Response

{
  "success": true,
  "data": {
    "id": "660e8400-e29b-41d4-a716-446655440000",
    "order_id": "550e8400-e29b-41d4-a716-446655440000",
    "organization_id": "770e8400-e29b-41d4-a716-446655440000",
    "branch_id": "880e8400-e29b-41d4-a716-446655440000",
    "method": "cash",
    "amount": 5000,
    "reference": null,
    "tip": 500,
    "status": "completed",
    "created_at": "2026-03-02T10:30:00Z",
    "order_number": "ORD-1234",
    "order_total": 5000,
    "total_paid": 5000,
    "remaining": 0,
    "fully_paid": true
  }
}

List Payments

Retrieve payments for the current branch with optional filtering.

Endpoint

GET /payments

Query Parameters

method
string
Filter by payment method: cash, card, yape, plin, transfer, other
startDate
string
Filter payments created after this ISO 8601 date
endDate
string
Filter payments created before this ISO 8601 date

Response

Returns an array of up to 100 payments ordered by creation date (newest first).

Example Request

curl https://api.restai.app/v1/payments?method=cash&startDate=2026-03-01 \
  -H "Authorization: Bearer YOUR_TOKEN"

Get Payment Details

Retrieve detailed information about a specific payment including order context.

Endpoint

GET /payments/:id

Path Parameters

id
string
required
Payment UUID

Response

success
boolean
Request success status
data
object
id
string
Payment UUID
order_id
string
Order UUID
method
string
Payment method
amount
number
Amount in cents
reference
string
Payment reference
tip
number
Tip amount
status
string
Payment status
created_at
string
Creation timestamp
order_number
string
Order number
order_total
number
Order total amount
order_status
string
Current order status

Example Request

curl https://api.restai.app/v1/payments/660e8400-e29b-41d4-a716-446655440000 \
  -H "Authorization: Bearer YOUR_TOKEN"

Daily Payment Summary

Get aggregated payment statistics for the current day, broken down by payment method.

Endpoint

GET /payments/summary

Response

success
boolean
Request success status
data
object
byMethod
array
Payment totals grouped by method
method
string
Payment method name
total
number
Total amount for this method
count
number
Number of payments
grandTotal
number
Total payment amount for the day
tipTotal
number
Total tips received
totalCount
number
Total number of payments

Example Request

curl https://api.restai.app/v1/payments/summary \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "success": true,
  "data": {
    "byMethod": [
      {
        "method": "cash",
        "total": 15000,
        "count": 5
      },
      {
        "method": "card",
        "total": 8000,
        "count": 3
      },
      {
        "method": "yape",
        "total": 4500,
        "count": 2
      }
    ],
    "grandTotal": 27500,
    "tipTotal": 2000,
    "totalCount": 10
  }
}

Get Unpaid Orders

Retrieve orders that have outstanding balances, useful for payment selection dialogs.

Endpoint

GET /payments/unpaid-orders

Response

Returns the 50 most recent orders with partial or no payment.
success
boolean
Request success status
data
array
Array of unpaid orders
id
string
Order UUID
order_number
string
Order number
customer_name
string
Customer name
total
number
Order total
total_paid
number
Amount paid so far
remaining
number
Outstanding balance
status
string
Order status
table_number
number
Table number if dine-in
created_at
string
Order creation time

Example Request

curl https://api.restai.app/v1/payments/unpaid-orders \
  -H "Authorization: Bearer YOUR_TOKEN"

Build docs developers (and LLMs) love