Send MT SMS
Endpoint URL
TBDWorkflow
1. Client send MT SMS as HTTP/S GET request2. myPAY system responses OK
3. This flow can be repeated for subsription/recurring payments (every week, month, year, etc...)
Important notes
Sent MT SMS can be considered billed only if billed status has been delivered!Sequence Diagram
1. MT SMS HTTP/S GET request
| GET parameter | Required | Type | Description |
|---|---|---|---|
id_mo |
required | int32 | ID of MO SMS |
id_mtsms |
required | int32 | !!!UNIQUE!!! ID of MT SMS from client (for checking duplicates and for statuses) |
src_no |
required | string(32) | Source number, e.g. 8877, 8811, ... |
dst_no |
required | string(32) | Destination MSISDN in international format, e.g. +421... |
message |
required | string(160) | only GSM7 alphabet with ASCII encoding |
bill_key |
required | string(32) | Billing code (assigned by myPAY) |
pid |
required | int32 | Project ID (assigned by ASMS) |
hash |
required | string(40) | Hex (lowercase) encoded SHA1 HMAC from (id_mo + id_mtsms + src_no + dst_no + message + bill_key + pid) |
2.1 Response
OK
2.2 Error response
ERROR*<code>
| Response | Description |
|---|---|
OK |
MT SMS sent. |
ERROR |
MT SMS sending failed. See code list for description |
| All other responses has to be handled as ERROR with unknown code |
| Error codes | |
|---|---|
| Error code | Description |
1010 |
ID_MTSMS not found |
1020 |
PID not found |
1030 |
GTW_TYPE not found (legacy) |
1040 |
DST_NO not found |
1050 |
MESSAGE not found |
1051 |
MESSAGE longer than 160 characters |
1060 |
BILL_KEY not found |
1061 |
BILL_KEY unknown |
1070 |
SRC_NO not found |
1080 |
ID MO SMS not found |
1090 |
STATUS not found |
2001 |
DB error |
2100 |
System error |
3000 |
Hash error / Not authorized |
3. Code examples
<?php
define('MYPAY_URL', ''); // Add URL
define('MYPAY_HASH_KEY', ''); // Add key
define('MYPAY_PID', ''); // Add PID
$data = array(
'id_mo' => 1, // ID of MO SMS
'id_mtsms' => 1, // Unique ID, (e.g. primary key from DB)
'src_no' => '8877', // Shortcode
'dst_no' => '+421903123456', // MSISDN
'message' => 'myPAY. ... 5 eur.', // Generate SMS text
'bill_key' => 'MYPAY-00-00', // Bill key
'pid' => MYPAY_PID,
);
$hashStr = $data['id_mo'] . $data['id_mtsms'] . $data['src_no'] . $data['dst_no'] .
$data['message'] . $data['bill_key'] . $data['pid'];
$data['hash'] = hash_hmac('SHA1', $hashStr, MYPAY_HASH_KEY);
$ch = curl_init(MYPAY_URL . '?' . http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, 0);
$response = curl_exec($ch);
curl_close($ch);
if ($response == 'OK') {
// SMS sent
}
else {
// SMS not sent
}