CallbackUrlInterceptor
Interceptor that attaches the optional X-Callback-Url header to transaction-initiation requests.
MTN MOMO supports a callback URL on the asynchronous POST operations that start a transaction — request-to-pay/withdraw, deposit, refund, transfer, cash transfer, invoice, payment, and pre-approval — to which the platform posts the result once the operation completes. It is not used by status (GET), cancel (DELETE), account/balance/user-info queries, delivery-notification POSTs, or the auth/token POSTs, so this interceptor scopes the header to the initiation endpoints by matching the request method (POST) and the final path segment.
The URL is read from CredentialProvider.getCallbackUrl on every request; when it is blank the header is omitted, making the callback opt-in (no behavior change until a URL is configured).
Parameters
Supplies the configured callback URL at request time.
Functions
Adds the X-Callback-Url header when a callback URL is configured and the request targets a transaction-initiation endpoint; otherwise forwards the request unchanged.