Points Management API
Create Points
Endpoint: POST /api/points/create
Description: Create a new point transaction for a user.
Example Request:
curl -X POST "https://api.tbns.io/functions/v1/api/points/create" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Imh3a2htcWF2enphaWVvdmtvdHdiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMwMDA3NDAsImV4cCI6MjA1ODU3Njc0MH0.nKjMLLZ7cY92nchtE2mFtBCOMqb0WWbiqkekaMqVFMU" \
-H "X-Token: X-TOKEN" \
-d '{
"subid": "order-12345",
"amount": 100,
"user_view_text": "Points for completing survey",
"user_id": "1749801330826x541366778024405570"
}'Required Fields:
subid: External reference IDamount: Point amount (number)user_view_text: Description visible to useruser_id: Target user's ID
Default Status: All new point transactions are created with status "Open"
Get User Points/Transactions
Endpoint: GET /api/user/points
Description: Retrieve point transactions with optional filtering. Results are sorted by amount in descending order.
6.1 Get All Transactions
6.2 Filter by User ID
6.3 Filter by Status
6.4 Combined Filters
Query Parameters:
user_id: Filter by specific user IDstatus: Filter by transaction status (Open,Closed,Pending,Approved)
Response: Returns detailed transaction data including amounts, dates, and descriptions.
Update Points Status
Endpoint: PATCH /api/points/update
Description: Update the status of a point transaction. Only transactions with "Open" status can be modified.
Example Request:
Required Fields:
point_id: ID of the point transaction to updatestatus: New status (PendingorClosed)
Business Rules:
Only transactions with status "Open" can be updated
Transactions with status "Closed", "Approved", or "Pending" cannot be modified
Returns descriptive error message if update is not allowed
Allowed Status Values:
Pending: Transaction is pending approval ( Next payment cycle, this transaction will be charged to your payment method. )Closed: Transaction is closed/cancelled ( cancel points forever, visible for the user )
Point Status Definitions
Open: New transactions that can be modified ( by creating )
Pending: Transactions approved from your site but not be paid ( you do it )
Closed: Cancelled or closed transactions ( you do it )
Approved: finalized transactions and ready to swap for the enduser ( we do it by payment )
Last updated