Paynotify service (HTTP GET/POST requests communictaion)
The Mobio.bg Payment Notification Service allows you to organize a SMS value added service where a notification is send to your server when there is an incoming SMS. Your server receives the notification, processes the incoming SMS and generates a reply to the sender.
When there is an incoming SMS for your service the Mobio.bg server sends a HTTP POST or GET request to an URL that is specified when the service is configured.
The Mobio.bg server sends the HTTP POST/GET request with the following parameters:
- fromnum: contains the sender's GSM number (for example: 359888123123);
- tonum: contains the short code to which the SMS was send from the sender (for example: 1094);
- message: contains the text of the received SMS (for example: TXT);
- item: contains the parameter send after the service's prefix (for example: if the service has a prefix TXT and the user sends an SMS "TXT123" the item parameter will be 123);
- smsID: contains an internal tracking ID that your script should pass without any modification when sending a reply to the user;
- servID: contains an unique ID of your service in Mobio's system;
- amount: contains the SMS price in local currency with VAT excl;
- currency: contains the currency code according to ISO 4217;
- opetator: contains the mobile operator code. Mobile operator code is MCC + MNC. For example: MCC for Bulgaria is 284, MNC for Mobiltel is 01. The parameter operator will be 28401. You can find more information about the MCCs and MNCs in the Wikipedia's Mobile Network Code page;
When your processing script needs to send a reply (MT SMS) back to the user it should make a HTTP POST or GET request to the following URL:
The request should contain the following parameters:
- servID: the unique ID of your service. It can be seen in the Mobio.bg control panel after the service's configuration;
- tonum: the user's GSM number;
- message: the text of the message that will be send to the user;
- extid: Mobio.bg internal tracking ID that your script receives as a parameter when Mobio.bg server makes a request to your script;
Example PHP script that receives the HTTP request from the Mobio.bg server, processes the incoming SMS and generates a reply to the user:
<?PHP $item = $_REQUEST["item"]; $fromnum = $_REQUEST["fromnum"]; $extid = $_REQUEST["extid"]; $servID = $_REQUEST[“servID”]; $mobio_remote_addrs = array("87.120.176.216", "35.234.105.159"); if(in_array($_SERVER['REMOTE_ADDR'], $mobio_remote_addrs)) { // your script action begins // mark user as VIP, add credits... $sms_reply = "SMS processed successfully."; // your script action ends file("http://mobio.bg/paynotify/pnsendsms.php?servID=$servID&tonum=$fromnum&extid=$extid&message=".urlencode($sms_reply)); } ?>