# EGW Software Processor API (Quick Guide) Base URL: `https://sandbox.playegamesnow.com/` Auth: Bearer token (Authorization header). All responses are JSON. --- ## 1) Create customer + add money **POST** `/merchant/g/create/` Creates a new customer and immediately adds money to their balance. ### Request Body ```json { "wallet_amount": "25.00", "merchant_game_id": 42, "customer": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "date_of_birth": "1975-01-18" } } ``` ### Response (201) ```json { "session_id": "uuid", "amount": "25.00", "merchant_game_id": 42, "status": "pending" } ``` --- ## 2) Purchase (add money to existing customer) **POST** `/merchant/g/purchase/` Adds money to an existing customer. ### Request Body ```json { "wallet_amount": "10.00", "merchant_game_id": 42, "wallet_login_id": 123 } ``` ### Response (201) ```json { "session_id": "uuid", "amount": "10.00", "merchant_game_id": 42, "status": "pending" } ``` --- ## 3) Redeem (withdraw money from existing customer) **POST** `/merchant/g/redeem/` Withdraws money from an existing customer. ### Request Body ```json { "wallet_amount": "5.00", "merchant_game_id": 42, "wallet_login_id": 123 } ``` ### Response (201) ```json { "session_id": "uuid", "amount": "5.00", "merchant_game_id": 42, "status": "pending" } ``` --- ## Common Errors - `400 Bad Request` — missing/invalid fields, amount < 0.01, invalid types. - `401/403` — no auth, or user not linked to Merchant, or service disabled. - `404 Not Found` — merchant or merchant_game not found / not eligible. - `500` — error (message: "Failed to process transaction"). --- ### Fields - `wallet_amount` (decimal string, required, min 0.01) - `merchant_game_id` (integer, required) - each game will have it's unique, you will get it from merchant admin - `wallet_login_id` (integer, required) This is `customerId` that you will receive from webhook after call /merchant/g/create/ endpoint - `customer` (object, required) - `first_name` (string) - `last_name` (string) - `email` (string) - `date_of_birth` (string, ISO-8601, recommended `YYYY-MM-DD`) ## Notes on Async Processing These endpoints only initiate a transaction. The returned `session_id` is the transaction UUID for later status checks (handled separately). ## Webhook (Session Result) after you call create, redeem or purchase you will get session_id, after this you need to wait webhook in which we will send you information about status of this session(success, failed) and additional information, such as created customer id Webhook details: we will send a POST request to the URL that merchant sets in admin panel. request body is JSON. structure TBD (to be discussed). authorization via Bearer token (Authorization header).