Server-to-Server Implementation Guide
This guide walks backend developers step by step with pseudocode through everything needed to integrate server-to-server endpoints.
1. Database Deposits Table
Create the deposits table:
CREATE TABLE deposits (
deposit_id VARCHAR(36) PRIMARY KEY,
user_id VARCHAR(36) NOT NULL,
amount INTEGER NOT NULL,
result VARCHAR(36)
);2. /thndr/pay Endpoint
/thndr/pay EndpointPayload:
{
"userId": "<userId>",
"depositId": "<depositId>",
"amount": 1234
}Execute following commands in one SQL transaction:
Check if this deposit was already processed:
Debit the user
Store deposit for idempotency and future result:
3. /thndr/results Endpoint
/thndr/results EndpointPayload:
Execute following commands in one SQL transaction:
Check if deposit exists
Check if result already processed
Process the result:
Mark deposit as processed
Last updated