openapi: 3.1.0 info: title: GoDigital Payments API version: 1.1.4 summary: Collect and disburse mobile money across Tanzanian networks through one API. description: | The GoDigital Payments API is a single merchant-facing API for payments across multiple mobile money networks in Tanzania: **YAS**, **Vodacom**, **Airtel** and **Halotel**. Use it to: - **Collect** money from customers with a USSD push (C2B) - **Disburse** money to customer wallets (B2C) - **Query** the latest status of any transaction - **Check** your wallet balances - **Verify** the registered name behind a mobile number ### Before you start 1. Get your **Client ID** and **Client Secret** from GoDigital during onboarding. 2. Make sure your server's public IP address is **whitelisted**. 3. Request an access token from `POST /oauth/token`. 4. Send the required security headers with every payment request. New here? Read the [Quickstart](/quickstart) and the [Authentication guide](/authentication) first. ### Try it in the browser Every endpoint on this page has a **Test request** button. Save your sandbox credentials on the [Sandbox Credentials](/sandbox) page, then pick the **GoDigital Sandbox** identity in the playground. Timestamps, nonces, request IDs and body hashes are filled in for you. contact: name: GoDigital Integration Support url: https://godigital.tz servers: - url: https://api-sandbox.godigital.tz/api/v1 description: UAT / Sandbox - url: https://{host}/api/v1 description: Production (host shared with you at go-live) variables: host: default: production-host-from-onboarding description: Production API host provided by GoDigital during go-live. tags: - name: Authentication description: | Exchange your client credentials for a short-lived bearer access token. The token endpoint only accepts requests from **whitelisted IP addresses**. - name: Disbursements (B2C) description: | Send money from your provider disbursement wallet to a customer's mobile wallet. Funds are reserved when the request is accepted and posted when the provider confirms success. - name: Collections (C2B) description: | Ask a customer to approve a payment on their phone with a USSD push. The final outcome is delivered asynchronously to your callback URL. - name: Transactions description: Look up the latest normalized status of any payment. - name: Wallets description: Check the real-time balance of your wallets before sending money. - name: Name Check description: Verify the registered customer name behind a mobile number before paying out. x-tagGroups: - name: Getting access tags: [Authentication] - name: Payments tags: [Disbursements (B2C), Collections (C2B), Transactions] - name: Account & verification tags: [Wallets, Name Check] paths: /oauth/token: post: tags: [Authentication] operationId: createAccessToken summary: Get an access token description: | Exchanges your client credentials for a bearer access token using the OAuth2 **client credentials** grant. Tokens are valid for `expires_in` seconds (normally 3600). Request a new token before the current one expires, and send it on every payment request in the `Authorization: Bearer ` header. :::caution This endpoint is protected by IP whitelisting. Requests from non-whitelisted public IP addresses are rejected. ::: security: [] requestBody: required: true content: application/x-www-form-urlencoded: schema: $ref: "#/components/schemas/TokenRequest" example: grant_type: client_credentials client_id: your-client-id client_secret: your-client-secret responses: "200": description: Access token issued. content: application/json: schema: $ref: "#/components/schemas/TokenResponse" example: access_token: eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ... token_type: Bearer expires_in: 3600 scope: payments:read payments:write default: description: Token request rejected. content: application/json: schema: $ref: "#/components/schemas/TokenError" examples: invalidCredentials: summary: PGW-1001 Invalid client credentials value: success: false code: PGW-1001 message: Invalid client credentials ipNotWhitelisted: summary: PGW-1009 IP address is not whitelisted value: status: FAILED code: PGW-1009 message: IP address is not whitelisted /payments/disbursements: post: tags: [Disbursements (B2C)] operationId: createDisbursement summary: Create B2C disbursement description: | Sends funds from your provider-specific **disbursement wallet** to a customer's mobile wallet. You choose the network with `providerCode`; GoDigital selects the internal route. **How funds move** 1. The gateway checks the available balance of your disbursement wallet for that provider. 2. If funds are sufficient, `amount` is **reserved** and the request is acknowledged with `transactionStatus: FUNDS_RESERVED`. 3. On final provider **success**, the reservation is consumed and the ledger is posted. 4. On **failure**, the reservation is released back to your available balance. The acknowledgement is **not** the final result. Wait for the [callback](/callbacks) or [query the transaction](/api/transactions). :::tip Make sure `msisdn` belongs to the network in `providerCode`. Sending a YAS number with `providerCode: VODACOM` will fail at the provider. Use [Name Check](/api/name-check) first. ::: parameters: - $ref: "#/components/parameters/XClientId" - $ref: "#/components/parameters/XRequestId" - $ref: "#/components/parameters/XIdempotencyKey" - $ref: "#/components/parameters/XTimestamp" - $ref: "#/components/parameters/XNonce" - $ref: "#/components/parameters/XContentSha256" - $ref: "#/components/parameters/XSignature" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PaymentRequest" examples: yasPayout: summary: Customer refund to a YAS wallet value: requestId: 6e3c1d3d-6b96-4e08-8a7d-c4968ea6905a merchantId: 0882eff7-da0f-4a6c-a581-9899a2a6e779 providerCode: YAS amount: 25000.00 currency: TZS msisdn: "255713123456" reference: PAYOUT-1001 callbackUrl: https://merchant.example.com/api/payment-result narration: Customer refund responses: "200": description: Disbursement accepted for processing and funds reserved. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: $ref: "#/components/schemas/DisbursementAck" example: status: SUCCESS code: PGW-0000 message: Disbursement accepted for processing requestId: 6e3c1d3d-6b96-4e08-8a7d-c4968ea6905a timestamp: "2026-04-19T21:30:05+03:00" data: transactionId: TXN-20260419-000021 providerCode: YAS transactionStatus: FUNDS_RESERVED reservedAmount: 25000.00 currency: TZS default: $ref: "#/components/responses/PaymentError" /payments/collections/push: post: tags: [Collections (C2B)] operationId: createPushCollection summary: Create C2B push collection description: | Sends a USSD push to the customer's phone asking them to approve a payment. The customer approves or rejects the request on their handset. The response only confirms the push was **accepted for processing** (`transactionStatus: ROUTED`). Wait for the [callback](/callbacks) or [query the transaction](/api/transactions) for the final result. On final success, the provider **collection wallet** is credited and your total balances are updated. parameters: - $ref: "#/components/parameters/XClientId" - $ref: "#/components/parameters/XRequestId" - $ref: "#/components/parameters/XIdempotencyKey" - $ref: "#/components/parameters/XTimestamp" - $ref: "#/components/parameters/XNonce" - $ref: "#/components/parameters/XContentSha256" - $ref: "#/components/parameters/XSignature" requestBody: required: true content: application/json: schema: $ref: "#/components/schemas/PaymentRequest" examples: vodacomInvoice: summary: Collect an invoice from a Vodacom customer value: requestId: 3cf73c52-d6b0-4906-8b5d-f9a4f82b5011 merchantId: 0882eff7-da0f-4a6c-a581-9899a2a6e779 providerCode: VODACOM amount: 10000.00 currency: TZS msisdn: "255754123456" reference: INV-1001 callbackUrl: https://merchant.example.com/api/payment-result narration: Invoice INV-1001 responses: "200": description: Collection request accepted and routed to the provider. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: $ref: "#/components/schemas/CollectionAck" example: status: SUCCESS code: PGW-0000 message: Collection request accepted requestId: 3cf73c52-d6b0-4906-8b5d-f9a4f82b5011 timestamp: "2026-04-19T21:34:41+03:00" data: transactionId: TXN-20260419-000022 providerCode: VODACOM transactionStatus: ROUTED currency: TZS default: $ref: "#/components/responses/PaymentError" /payments/{reference}: get: tags: [Transactions] operationId: getTransactionStatus summary: Query transaction status description: | Returns the latest normalized status of a payment. Use it when a callback has not arrived, or to reconcile your records. A transaction is final when `transactionStatus` is `SUCCESS`, `FAILED` or `REVERSED`. See [Transaction states](/transaction-states). parameters: - name: reference in: path required: true description: The reference of the payment you want to look up. schema: type: string example: INV-1001 - $ref: "#/components/parameters/XClientId" - $ref: "#/components/parameters/XRequestId" - $ref: "#/components/parameters/XTimestamp" - $ref: "#/components/parameters/XNonce" - $ref: "#/components/parameters/XContentSha256" - $ref: "#/components/parameters/XSignature" responses: "200": description: Transaction found. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: $ref: "#/components/schemas/Transaction" example: status: SUCCESS code: PGW-0000 message: Transaction retrieved successfully requestId: 3cf73c52-d6b0-4906-8b5d-f9a4f82b5011 timestamp: "2026-04-19T21:39:09+03:00" data: transactionId: TXN-20260419-000022 providerCode: VODACOM operation: C2B_USSD_PUSH transactionStatus: SUCCESS amount: 10000.00 currency: TZS msisdn: "255754123456" reference: INV-1001 providerTransactionId: "919994765" providerReceiptNo: 5HN31LXJQAX finalizedAt: "2026-04-19T21:38:57+03:00" default: $ref: "#/components/responses/PaymentError" /payments/wallets/balance/{clientId}: get: tags: [Wallets] operationId: getWalletBalance summary: Balance enquiry description: | Returns real-time balance information for your wallets. Use it to confirm you have enough available funds before sending a disbursement. Your wallets are organised as a tree: one **merchant parent wallet**, a **total wallet** per provider, and **collection** and **disbursement** leaf wallets under each provider. parameters: - name: clientId in: path required: true description: Your Client ID issued during onboarding. schema: type: string example: your-client-id - name: Accept in: header required: true schema: type: string default: application/json - name: Content-Type in: header required: true schema: type: string default: application/json - $ref: "#/components/parameters/XClientId" - $ref: "#/components/parameters/XRequestId" - $ref: "#/components/parameters/XIdempotencyKey" - $ref: "#/components/parameters/XTimestamp" - $ref: "#/components/parameters/XNonce" - $ref: "#/components/parameters/XContentSha256" - $ref: "#/components/parameters/XSignature" responses: "200": description: Wallet balance retrieved. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: type: object description: Balance details for your wallets. additionalProperties: true default: $ref: "#/components/responses/PaymentError" /payments/name-check: get: tags: [Name Check] operationId: nameCheck summary: Verify customer name description: | Returns the registered customer name for a mobile number on a given network. Use it before a disbursement to confirm you are paying the right person, and that the number belongs to the network you are about to use. security: [] parameters: - name: providerCode in: query required: true description: Mobile network of the number. schema: $ref: "#/components/schemas/ProviderCode" example: HALOTEL - name: msisdn in: query required: true description: Customer mobile number in international format, for example `2556XXXXXXXX`. schema: type: string pattern: "^255[0-9]{9}$" example: "255621234567" - name: Accept in: header required: true schema: type: string default: application/json - $ref: "#/components/parameters/XClientId" - $ref: "#/components/parameters/XRequestId" responses: "200": description: Name found. content: application/json: schema: allOf: - $ref: "#/components/schemas/Envelope" - type: object properties: data: $ref: "#/components/schemas/NameCheckResult" example: status: SUCCESS code: PGW-0000 message: Request processed successfully data: providerCode: HALOTEL msisdn: "255621234567" recipientName: Full Name resultCode: "200" resultMessage: SUCCESS route: DIRECT default: $ref: "#/components/responses/PaymentError" security: - bearerAuth: [] components: securitySchemes: bearerAuth: type: http scheme: bearer bearerFormat: JWT description: | Access token from `POST /oauth/token`, sent as `Authorization: Bearer `. parameters: XClientId: name: X-Client-Id in: header required: true description: Client identifier issued during onboarding. schema: type: string example: your-client-id XRequestId: name: X-Request-Id in: header required: true description: Unique identifier for this request, used for traceability. A UUID is recommended. schema: type: string format: uuid example: 6e3c1d3d-6b96-4e08-8a7d-c4968ea6905a XIdempotencyKey: name: X-Idempotency-Key in: header required: true description: | Unique key for this operation. Sending the **same key with the same body** returns the original result. Reusing a key with a **different body** is rejected (`PGW-1004`). schema: type: string example: 0b8f2c1e-6a43-4d3b-9b0e-2f7d4c1a9e55 XTimestamp: name: X-Timestamp in: header required: true description: Current time as a 10-digit Unix epoch timestamp in **seconds**. schema: type: string pattern: "^[0-9]{10}$" example: "1782275551" XNonce: name: X-Nonce in: header required: true description: Unique random value for every request, used to prevent replay attacks. schema: type: string example: 9f1c2a7e4b8d4c0e XContentSha256: name: X-Content-SHA256 in: header required: true description: | SHA-256 hash of the **raw request body**, Base64-encoded. For requests without a body, hash the empty string (`47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=`). schema: type: string example: 47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU= XSignature: name: X-Signature in: header required: false description: | Optional Base64-encoded HMAC-SHA256 request signature. Only validated when signing was enabled for your integration during onboarding. schema: type: string responses: PaymentError: description: | The request was rejected or failed. Check `code` for the reason. See [Errors](/errors) for every code. content: application/json: schema: $ref: "#/components/schemas/Envelope" examples: insufficientBalance: summary: PGW-1006 Insufficient balance value: status: FAILED code: PGW-1006 message: Insufficient available balance in disbursement wallet requestId: 6e3c1d3d-6b96-4e08-8a7d-c4968ea6905a timestamp: "2026-04-19T21:30:05+03:00" data: null invalidMsisdn: summary: PGW-1003 Invalid MSISDN value: status: FAILED code: PGW-1003 message: Invalid MSISDN format data: null duplicate: summary: PGW-1004 Duplicate request value: status: FAILED code: PGW-1004 message: Duplicate requestId or idempotency conflict data: null authFailed: summary: PGW-1007 Authentication failed value: status: FAILED code: PGW-1007 message: Authentication failed data: null ipNotWhitelisted: summary: PGW-1009 IP not whitelisted value: status: FAILED code: PGW-1009 message: IP address is not whitelisted data: null notFound: summary: PGW-1010 Transaction not found value: status: FAILED code: PGW-1010 message: Transaction not found data: null schemas: ProviderCode: type: string description: Mobile network wallet tree the request is posted to. enum: [YAS, VODACOM, AIRTEL, HALOTEL] x-enumDescriptions: YAS: YAS (formerly Tigo) wallet tree VODACOM: Vodacom M-Pesa wallet tree AIRTEL: Airtel Money wallet tree HALOTEL: Halopesa wallet tree TransactionStatus: type: string description: Normalized transaction state. `SUCCESS`, `FAILED` and `REVERSED` are final. enum: - RECEIVED - AUTHENTICATED - VALIDATED - FUNDS_RESERVED - ROUTED - PENDING_FINAL - SUCCESS - FAILED - REVERSED x-enumDescriptions: RECEIVED: Request accepted by the API boundary. AUTHENTICATED: Security and client validation completed. VALIDATED: Business rules and payload validation completed. FUNDS_RESERVED: B2C only. Amount reserved from the provider disbursement wallet. ROUTED: Provider gateway accepted the request for processing. PENDING_FINAL: Final provider outcome is still pending. SUCCESS: Completed successfully and ledger posting applied. FAILED: Failed. Any reservation is released. REVERSED: A successful reversal was completed against the original transaction. Envelope: type: object description: Every response uses this envelope. required: [status, code, message] properties: status: type: string enum: [SUCCESS, FAILED] description: Whether the API call itself was processed. For the payment outcome, read `data.transactionStatus`. code: type: string description: Result code. `PGW-0000` means success. example: PGW-0000 message: type: string example: Request processed successfully requestId: type: string description: Echo of your request identifier. timestamp: type: string format: date-time description: ISO-8601 timestamp with timezone. data: description: Endpoint-specific payload. `null` on errors. type: [object, "null"] TokenRequest: type: object required: [grant_type, client_id, client_secret] properties: grant_type: type: string enum: [client_credentials] client_id: type: string description: Client ID issued during onboarding. client_secret: type: string description: Client secret issued during onboarding. Never expose it in a browser or mobile app. TokenResponse: type: object properties: access_token: type: string description: JWT bearer token. token_type: type: string example: Bearer expires_in: type: integer description: Lifetime of the token in seconds. example: 3600 scope: type: string example: payments:read payments:write TokenError: type: object properties: success: type: boolean status: type: string code: type: string message: type: string PaymentRequest: type: object required: [requestId, merchantId, providerCode, amount, currency, msisdn, reference] properties: requestId: type: string description: Your unique identifier for this request. Generate a new one for every payment. example: 6e3c1d3d-6b96-4e08-8a7d-c4968ea6905a merchantId: type: string description: Merchant identifier issued during onboarding. example: 0882eff7-da0f-4a6c-a581-9899a2a6e779 providerCode: $ref: "#/components/schemas/ProviderCode" amount: type: number exclusiveMinimum: 0 description: Amount to move. Must be greater than zero and within your merchant limits. No thousands separators. example: 25000.00 currency: type: string description: Transaction currency. default: TZS example: TZS msisdn: type: string description: Customer mobile number in international format, starting with `255`. pattern: "^255[0-9]{9}$" example: "255713123456" reference: type: string description: Your business reference, such as an invoice, order or payout number. Use one per payment. example: PAYOUT-1001 callbackUrl: type: string format: uri description: | HTTPS endpoint that receives the final result. Optional if a callback URL is configured on your merchant profile; the request value overrides it only if allowed by policy. example: https://merchant.example.com/api/payment-result narration: type: string description: Optional note or payment description. example: Customer refund DisbursementAck: type: object properties: transactionId: type: string description: Gateway-generated, immutable transaction identifier. providerCode: $ref: "#/components/schemas/ProviderCode" transactionStatus: $ref: "#/components/schemas/TransactionStatus" reservedAmount: type: number description: Amount reserved from your disbursement wallet. currency: type: string CollectionAck: type: object properties: transactionId: type: string description: Gateway-generated, immutable transaction identifier. providerCode: $ref: "#/components/schemas/ProviderCode" transactionStatus: $ref: "#/components/schemas/TransactionStatus" currency: type: string Transaction: type: object properties: transactionId: type: string providerCode: $ref: "#/components/schemas/ProviderCode" operation: type: string description: Type of operation. enum: [C2B_USSD_PUSH, B2C_DISBURSEMENT] transactionStatus: $ref: "#/components/schemas/TransactionStatus" amount: type: number currency: type: string msisdn: type: string reference: type: string providerTransactionId: type: [string, "null"] description: Transaction ID assigned by the mobile network. providerReceiptNo: type: [string, "null"] description: Receipt number from the mobile network. finalizedAt: type: [string, "null"] format: date-time description: When the transaction reached a final state. NameCheckResult: type: object properties: providerCode: $ref: "#/components/schemas/ProviderCode" msisdn: type: string recipientName: type: string description: Registered name of the wallet holder. resultCode: type: string resultMessage: type: string route: type: string