Download the PHP package mattdi/telebirr-ussd without Composer
On this page you can find all versions of the php package mattdi/telebirr-ussd. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mattdi/telebirr-ussd
More information about mattdi/telebirr-ussd
Files in mattdi/telebirr-ussd
Package telebirr-ussd
Short Description Laravel integration package for Telebirr SOAP payment APIs, including asynchronous USSD Push / Buy Goods.
License MIT
Informations about the package telebirr-ussd
Telebirr USSD
v0.3.1 (Laravel 10/11/12/13 · PHP ^8.1) · A Laravel package for the asynchronous USSD Push / Buy Goods for Customer operation of the Telebirr SOAP payment API.
⚠️ Important: The Telebirr USSD Push flow is asynchronous. The immediate response only confirms that Telebirr accepted your request — it is not a payment confirmation. Only the
api:Resultcallback withResultCode = 0confirms a successful payment. Treat callback data as the source of truth.
Features
InitTrans_BuyGoodsForCustomerrequest builder (Buy Goods / USSD Push)- SOAP/XML request serialization and response parsing
- Initial synchronous acceptance response handling
- Asynchronous
api:Resultcallback parsing TelebirrTransactionCompletedevent for async settlement- Laravel service provider +
Telebirrfacade - Configurable endpoint, credentials, timeouts, and TLS/mTLS options
- Callback idempotency hook (
IdempotencyChecker) - Injectable security credential provider
- PHPUnit tests with Telebirr XML fixtures
- No undocumented Telebirr cryptographic algorithm hard-coded
Installation
Require the package:
Publish the config file:
Environment variables
Add the following to your .env:
Every variable maps directly to a field in the outlined Telebirr spec, so there are no redundant settings — each one corresponds to a different part of the request (Caller, Initiator) or the transport (SOAP timeout/mTLS).
Usage
Initiate a USSD Push / Buy Goods
ResponseCode = 0 in the immediate response means the request was accepted, not that payment succeeded.
Handle the callback
By default the package registers:
Point Telebirr's ResultURL at the publicly reachable URL configured via TELEBIRR_USSD_RESULT_URL.
The callback parses:
ResultTypeResultCodeResultDescOriginatorConversationIDConversationIDTransactionID
A successful result has ResultCode = 0. Listen for the completion event to settle the payment:
Recommended payment lifecycle
Treat the immediate API response and the async callback as separate events:
Persist at least:
- your internal payment UUID
originator_conversation_id- Telebirr
conversation_id - Telebirr
transaction_id - amount / currency
- customer MSISDN
- merchant shortcode
- result code / description
- timestamps
- processing status
Idempotency
The package intentionally does not require a database schema. In your listener, use originatorConversationId, conversationId, and especially transactionId as idempotency keys before applying fulfillment logic.
You can also bind your own IdempotencyChecker. The default implementation is a no-op:
Credentials
The two credential strings shown in the spec's example request are provided by Telebirr when you onboard:
Caller/Password→TELEBIRR_USSD_PASSWORDInitiator/SecurityCredential→TELEBIRR_USSD_SECURITY_CREDENTIAL
Both are sent verbatim into the SOAP request, so you can paste them straight into your .env.
Security credential provider
The package reads the credential via a small SecurityCredentialProvider contract; the default implementation returns TELEBIRR_USSD_SECURITY_CREDENTIAL. It exists so that, if Telebirr later publishes a getSecurityCredential() algorithm, you can compute the value at runtime instead of storing it statically:
Security & production hardening
Before going to production:
- Obtain the official Telebirr credential/security specification.
- Use the official production SOAP endpoint.
- Use the official production SOAP endpoint over HTTPS; enable mTLS client certificates only if Telebirr requires them.
- Restrict and authenticate the callback endpoint per Telebirr's requirements.
- Add idempotency using the Telebirr transaction/conversation identifiers.
- Never log PINs, security credentials, private keys, or raw authentication secrets.
- Verify the payment amount/order before fulfilling goods.
- Implement reconciliation/query handling if Telebirr provides it.
- Add monitoring and structured audit logs.
Architecture
Changelog
See CHANGELOG.md for version history.
License
MIT
All versions of telebirr-ussd with dependencies
psr/log Version ^3.0
ext-dom Version *
illuminate/support Version ^10.0|^11.0|^12.0|^13.0