Balance & delivery status
Retrieve the credit balance
Section titled “Retrieve the credit balance”$balance = $client->getBalance();
echo 'Request ID: ' . $balance->getRequestId() . PHP_EOL;echo 'Credits: ' . $balance->getCredits() . PHP_EOL;getBalanceInCredits() is an alias for getBalance().
Check delivery status
Section titled “Check delivery status”Query by the server-generated request ID or your client request ID, never both:
$deliveries = $client->checkStatusByServerRequestId( 'cc479845-0f15-4ae7-b645-6ef6489868c1');
// Alternatively:$deliveries = $client->checkStatusByClientRequestId('order-9543212');
foreach ($deliveries as $delivery) { printf( "%s: %s\n", $delivery->getMobileNumber(), $delivery->getStatus() );}The lower-level checkStatus($smsServerRequestId, $clientRequestId) method is also available and enforces the same either/or rule.
Delivery status values
Section titled “Delivery status values”| Constant | Value | Meaning |
|---|---|---|
DeliveryStatus::NEW |
new |
Initial state |
DeliveryStatus::TEMP_LOCKED |
temp_locked |
Internal processing state |
DeliveryStatus::PROCESSING_ERROR |
processing_error |
Processing failed and will not retry |
DeliveryStatus::FAILURE |
failure |
Repeated attempts failed |
DeliveryStatus::SENT |
sent |
Message left the network |
DeliveryStatus::ERROR |
error |
Temporary error; retry may occur |
DeliveryStatus::DELIVERED |
delivered |
Delivered to the handset |
DeliveryStatus::NOT_DELIVERED |
not_delivered |
Could not be delivered |
DeliveryStatus::UNKNOWN_DELIVERY |
unknown_delivery |
No handset confirmation within 24 hours |
SmsDeliveryStatusItem::isDelivered() checks specifically for delivered. isFinalStatus() recognizes processing errors, failure, delivered, not delivered, and unknown delivery as terminal states.
