Receive MO SMS
Endpoint URL
Client has to provide endpoint URLWorkflow
1. myPAY sends MO SMS as HTTP/S GET request2. Client responses OK
Sequence Diagram
1. MO SMS HTTP/S GET request
| GET parameter | Required | Type | Description |
|---|---|---|---|
id |
required | int32 | Unique ID of MO SMS. Client has to check for duplicity. In case of duplicate request, client has to respond OK |
gtw_type |
required | int32 | Operator code. (e.g. 23101 - Orange SK, 23102 - Telekom SK, 23103 - Swan SK, 23106 - O2 SK) |
src_no |
required | string(32) | MSISDN in international format, e.g. +421... |
dst_no |
required | string(32) | Destination number, e.g. 8877, 8811, ... |
message |
required | string | Text of SMS, UTF-8 encoded. Multipart SMS are concatenated. |
hash |
required | string(40) | Hex (lowercase) encoded SHA1 HMAC from (id + gtw_type + src_no + dst_no + message). |
2.1 Response
OK
2.2 Error response
ERROR
| Response | Description |
|---|---|
OK |
Response OK with HTTP status 200 is considered as MO SMS received. |
ERROR |
Response ERROR with HTTP status 200 or different. Request will be executed in 1 minute again. |
| All other responses are handled as ERROR |
3. Code examples
<?php
define('MYPAY_HASH_KEY', ''); // Add key
$hashStr = $_GET['id'] . $_GET['gtw_type'] . $_GET['src_no'] . $_GET['dst_no'] . $_GET['message'];
$hash = hash_hmac('SHA1', $hashStr, MYPAY_HASH_KEY);
if ($hash === $_GET['hash']) {
// Request valid, process MO SMS
}
else {
// Request not valid
echo 'ERROR';
die();
}