M-Pesa C2B Payment icon

M-Pesa C2B Payment

Standard customer-to-business transaction for mobile money payments

Overview

This node implements an M-Pesa Customer to Business (C2B) payment transaction. It facilitates mobile money payments where a customer sends funds directly to a business or service provider. This is commonly used in scenarios such as utility bill payments, purchasing goods or services via mobile money, or any situation requiring a secure and traceable transfer of funds from a customer's mobile wallet to a business account.

Practical examples include:

  • A customer paying their electricity bill by entering their smartcard number and amount.
  • A user topping up their prepaid internet account using their mobile phone.
  • Businesses collecting payments for services rendered through mobile money.

Properties

Name Meaning
Transaction Reference Reference identifier for the transaction related to the customer or business (e.g., smartcard number, utility bill reference).
Customer MSISDN The mobile phone number (MSISDN) of the customer making the payment.
Amount The monetary amount to be transferred in the transaction.
Third Party Reference Unique reference from the third-party system to track this specific transaction.
Service Provider Code Shortcode identifying the business or service provider that will receive the funds.

Output

The node outputs JSON data representing the response from the M-Pesa API after attempting the C2B payment. This typically includes transaction status, confirmation details, and any error messages if the transaction failed. There is no binary data output.

Dependencies

  • Requires an API key credential for authenticating with the M-Pesa API.
  • Needs configuration of base URL and service provider shortcode within credentials.
  • The node makes HTTP POST requests to the M-Pesa endpoint /ipg/v1x/c2bPayment/singleStage/ with JSON payloads.

Troubleshooting

  • Common issues:
    • Invalid or missing API credentials can cause authentication failures.
    • Incorrect MSISDN format or invalid transaction references may lead to rejected transactions.
    • Network connectivity problems can prevent successful API calls.
  • Error messages:
    • Authentication errors indicate issues with the provided API key or credentials.
    • Validation errors usually specify which input property is incorrect or missing.
    • Timeout or network errors suggest connectivity issues; retrying or checking network settings is advised.

Links and References

Discussion