M-Pesa B2B Payment

Processar pagamentos de negócio para negócio via M-Pesa

M-Pesa B2B Payment

AI-generated

Overview

This node facilitates Business-to-Business (B2B) payments using the M-Pesa platform. It enables users to transfer funds from one business account to another securely and efficiently. Typical use cases include inter-company settlements, supplier payments, or any scenario where businesses need to send money directly to other businesses via M-Pesa.

For example, a company can automate payments to its suppliers by specifying transaction details such as amount, references, and party codes, streamlining financial workflows and reducing manual intervention.

Properties

Name Meaning
Transaction Reference Reference for the transaction (e.g., card number, invoice reference).
Amount The monetary value of the transaction.
Third Party Reference Unique reference from the third-party system identifying the transaction.
Primary Party Code Code of the business from which funds will be debited.
Receiver Party Code Code of the business to which funds will be credited.
Auto Generate Reference Whether to auto-generate the third party reference instead of providing it manually.

Output

The node outputs JSON data containing:

  • The full response from the M-Pesa API call.
  • The original request parameters used for the payment.
  • A success boolean indicating if the payment was successful (true if the response code equals "INS-0").
  • A timestamp marking when the response was processed.

If an error occurs and "Continue On Fail" is enabled, the output will contain an error message for that item.

No binary data is produced by this node.

Dependencies

  • Requires valid credentials for accessing the M-Pesa API, including an API key or token configured in n8n.
  • Uses an internal helper class to handle API requests and generate/validate references.
  • The node expects the environment to have network access to the M-Pesa API endpoints.

Troubleshooting

  • Invalid Amount Error: If the amount is not a positive number, the node throws an error stating the amount is invalid. Ensure the amount is a positive numeric string.
  • Reference Length Error: The third party reference must not exceed 20 characters. Shorten the reference or enable auto-generation.
  • Missing Party Codes: Both primary and receiver party codes are mandatory. Verify these codes are correctly provided.
  • Identical Party Codes: The source and destination business codes cannot be the same. Use distinct codes for each.
  • API Request Failures: Network issues or invalid credentials may cause request failures. Confirm credentials and connectivity.
  • Auto Generation of Reference: If enabled, the node generates a unique reference automatically; otherwise, you must provide a valid third party reference.

Links and References

Discussion