Repository navigation
v1.4.0
MTN Get Status failures, sandbox currency and callback guidance. Anyone reading
Transaction::getReason() on a failed transaction should upgrade: MTN's documented Get Status
body left it empty.
Fixed
- A FAILED transaction from Get Status had no reason. Since January 2024 MTN
reports the business failure in an HTTP 200 body withreasonas a bare
string ("reason": "NOT_ENOUGH_FUNDS"), but only the{ code, message }
object was parsed.Transaction::parse()now accepts both shapes; a string becomes an
ErrorReasonwith that code and an empty message - An
ErrorReasonwithout a message rendered with a trailing space
("[NOT_ENOUGH_FUNDS] "); it now renders as"[NOT_ENOUGH_FUNDS]" - Payments in the sandbox failed with the default currency. The sandbox accepts
EUR only, butquickPay()and the requestmake()factories default to XAF.
Against the sandbox,requestToPay(),quickPay(),deposit(),transfer()
andrefund()now sendEURwhatever the request currency; the request
object is left untouched, and other environments are unaffected - The README's callback example fulfilled the order straight from the callback
data. MTN and Airtel do not sign callbacks, so anyone who knows the callback
URL could mark an unpaid order as paid. The example now re-queries the status
from MTN or Airtel before fulfilling, for both providers
Added
ErrorReasonconstants and predicates for the Get Status failure codes MTN
documents or returns in production:LOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED,
COULD_NOT_PERFORM_TRANSACTION,SENDER_ACCOUNT_NOT_ACTIVE,
PAYEE_LIMIT_REACHED,TRANSACTION_NOT_FOUND,VALIDATION_ERRORErrorReason::isPayerFundingFailure(): true forNOT_ENOUGH_FUNDS,
PAYER_LIMIT_REACHEDandLOW_BALANCE_OR_PAYEE_LIMIT_REACHED_OR_NOT_ALLOWED.
MTN Congo returns the last one instead ofNOT_ENOUGH_FUNDS, so
isNotEnoughFunds()alone misses an insufficient balance thereMomoApi::SANDBOX_CURRENCY:'EUR', the only currency the sandbox accepts