Safon Automation API Integration Documentation. The definitive guide to connecting your backend architecture securely with our automated SMS payment webhook engine.
Hello! If you are using "Safon Automation" as your automatic bank SMS payment verification engine, this document is for you. The app reads bank SMS receipts from your mobile phone and forwards the extracted JSON data to your backend server via a Webhook.
Below is the exact architecture and matching logic you need to write in your backend (PHP, Node, Python, etc.) to accept the webhook securely and process user payments.
Create a new table named incoming_transactions. It should have these columns:
id (Auto increment)transaction_number (Unique - String/Varchar)amount (Decimal)status (Enum: 'unclaimed' or 'claimed', default 'unclaimed')raw_sms (Text)This handles receiving data from the Safon App. The app will send a POST request with the following JSON payload structure:
When this Webhook receives the request:
a. It MUST verify the authenticity of the request using an X-API-KEY header.
b. If the incoming request is a GET request, it means the App is doing a "Connection Test". It should return a 200 OK response with "Connected Successfully".
c. If it is a POST request, it should insert the extracted details into the incoming_transactions table with the status as "unclaimed".
d. Then, it should immediately query your pending users to see if there is any user whose transaction_id and amount perfectly matches. If found, it should automatically mark the user as 'Active/Approved' and change the SMS status to 'claimed'.
This is the endpoint where your users submit their payment proof on your own site.
incoming_transactions table to ensure this Transaction ID has not been used ('claimed') by another user already (Duplication & Fraud Prevention).