Credential Initialization
config.php
Stores application secret credentials (BDAPPS_APP_ID and BDAPPS_APP_PASSWORD).
Every endpoint script includes this file to authenticate outgoing cURL requests to BDApps servers.
OTP Dispatch Request
send_otp.php
Receives the subscriber's phone number, normalizes it into international telecom format (tel:88017...),
and triggers an SMS PIN request to BDApps. BDApps returns a unique referenceNo.
OTP Verification & Subscription
verify_otp.php
Validates the user's input PIN against the issued referenceNo via BDApps OTP Verification API.
Upon match, the subscriber is registered and billing commences.
Subscription Status Query
check_subscription.php
Queries the BDApps getStatus endpoint to verify if a subscriber is currently REGISTERED or UNREGISTERED.
Unsubscription Processing
unsubscribe.php
Dispatches an unsubscription directive (action: 0) to BDApps, deactivating recurring daily/weekly charges for the subscriber.
Inbound / Outbound SMS
sms.php
Handles Mobile Originated (MO) SMS webhooks sent by BDApps when subscribers text the application shortcode, logs data to sms_log.txt, and transmits a Mobile Terminated (MT) reply.
Interactive USSD Menus
ussd.phpManages USSD session dialogues (*123#). Renders interactive option menus for registered users or prompts pop-up subscription dialogs for non-registered users.
Asynchronous Webhook Listener
subscription_listener.php
Listens for real-time background notification callbacks triggered by BDApps (e.g. daily auto-renewals or SMS cancellations) and appends events to subscription_notifications.log.
Core SDK Engine
sdk_file.php
Contains foundational OOP helper classes: Core, SMSSender, SMSReceiver, UssdSender, UssdReceiver, Subscription, DirectDebitSender, and Logger.
Configuration
Centralized credentials and constants declaration.
config.phpOTP Dispatch
Mobile normalization and OTP request handling.
send_otp.phpOTP Verification
Reference validation and subscription activation.
verify_otp.phpStatus Monitoring
Live getStatus querying for mobile numbers.
check_subscription.phpDeactivation
Unsubscription payload delivery to BDApps.
unsubscribe.phpSMS Gateway
MO receiver and MT auto-response handler.
sms.phpUSSD Engine
Interactive USSD session dialogue manager.
ussd.phpEvent Webhook
Asynchronous subscription callback logger.
subscription_listener.phpCore SDK
OOP abstractions, cURL client, & exception handlers.
sdk_file.phpStores environment Application ID and Password constants.
Normalizes 11-digit MSISDN and requests OTP generation.
Verifies OTP pin against issued reference number.
Queries active subscription state for a subscriber ID.
Issues action=0 payload to revoke subscription.
MO SMS receiver and MT reply handler using SMSSender.
Manages interactive USSD sessions and dialogue flows.
Asynchronous event webhook handler logging callbacks.
Core SDK classes containing cURL, logging, and models.
| Endpoint File | Method | Payload Parameters | Expected JSON Response |
|---|---|---|---|
| /send_otp.php | POST | user_mobile |
{"success":true, "referenceNo":"..."} |
| /verify_otp.php | POST | Otp, referenceNo |
{"statusCode":"S1000", "subscriptionStatus":"REGISTERED"} |
| /check_subscription.php | POST | user_mobile |
{"isSubscribed":true, "subscriptionStatus":"REGISTERED"} |
| /unsubscribe.php | POST | user_mobile |
{"success":true, "subscriptionStatus":"UNREGISTERED"} |
| /sms.php | POST | BDApps MO JSON Stream | {"statusCode":"S1000", "statusDetail":"Process completed successfully."} |
| /ussd.php | POST | BDApps USSD Session JSON | {"statusCode":"S1000", "statusDetail":"Success"} |
| /subscription_listener.php | POST | BDApps Notification JSON | {"statusCode":"S1000", "statusDetail":"Notification received"} |