Get the FREE Ultimate OpenClaw Setup Guide →

mom-factura-payments

npx machina-cli add skill ithustle/momenu-skills/mom-factura-payments --openclaw
Files (1)
SKILL.md
5.1 KB

Mom Factura Payments Integration

Process payments for Angolan payment methods with automatic SAFT-AO invoice generation.

Base URL: https://api.momenu.online

Authentication

All requests require the x-api-key header.

Content-Type: application/json
x-api-key: <MERCHANT_API_KEY>

Optional headers:

  • x-env-qa: true - QA test environment (any origin)
  • x-dev-mode: true - Bypass domain validation (localhost only)

Payment Methods

1. Multicaixa Express (MCX) - Immediate

POST /api/payment/mcx

Immediate payment. Creates order as PAID and generates invoice on success.

Required body:

  • paymentInfo.amount (number) - Kwanzas
  • paymentInfo.phoneNumber (string) - Format: 244XXXXXXXXX

Optional body:

  • products (array) - Items for detailed invoice
  • products[].id (string), products[].productName (string), products[].productPrice (number), products[].productQuantity (number)
  • products[].iva (number) - IVA rate 0-14, default 14
  • customer (object) - name (string), nif (string), phone (string)
  • simulateResult (string) - QA only: success, insufficient_balance, timeout, rejected, invalid_number

Success (200):

{
  "success": true,
  "transactionId": "abc123...",
  "invoiceUrl": "https://invoice-momenu.toquemedia.net/invoices/..."
}

2. E-kwanza - Deferred

POST /api/payment/ekwanza

Deferred payment. Creates order as OPEN, returns QR code. Payment confirmation is delivered via webhook.

Required: paymentInfo.amount, paymentInfo.phoneNumber Optional: products, customer (same as MCX)

Success (200):

{
  "success": true,
  "code": "EKZ123456",
  "qrCode": "data:image/png;base64,...",
  "expirationDate": "2024-01-15T12:00:00Z",
  "paymentTimeout": 180
}

Payment confirmation arrives via webhook. Use code with status endpoint as fallback.

3. Bank Reference - Deferred

POST /api/payment/reference

Generates bank reference. Client pays via ATM or Internet Banking.

Required: paymentInfo.amount Optional: products, customer (same as MCX)

Success (200):

{
  "success": true,
  "operationId": "op-123...",
  "referenceNumber": "123456789",
  "entity": "12345",
  "dueDate": "2024-01-20"
}

Amount Validation

If both paymentInfo.amount and products are provided, they must match:

  • total = SUM(productPrice * productQuantity) for all products
  • Mismatch returns error AMOUNT_MISMATCH
  • Providing only one is valid (amount OR products)
  • Providing neither returns AMOUNT_MISMATCH

Webhook (Payment Confirmation)

All deferred payments (Bank Reference and E-kwanza) are confirmed via webhook. Configure the webhook URL in your apiConfigs document.

When a payment is confirmed, the API sends two sequential events:

Event 1: payment.confirmed — Sent immediately after order status is updated to PAID:

{
  "event": "payment.confirmed",
  "merchantTransactionId": "abc123...",
  "ekwanzaTransactionId": "EKZ456...",
  "operationStatus": "1",
  "operationData": { ... }
}

Event 2: invoice.created — Sent after invoice PDF is generated and uploaded:

{
  "event": "invoice.created",
  "merchantTransactionId": "abc123...",
  "ekwanzaTransactionId": "EKZ456...",
  "operationStatus": "1",
  "operationData": { ... },
  "invoiceUrl": "https://invoice-momenu.toquemedia.net/invoices/..."
}

Non-paid events (operationStatus 3, 4, 5) are sent without the event field for backward compatibility.

operationStatus values: "1" Paid · "3" Cancelled/Expired · "4" Failed/Refused · "5" Error

Fallback (status endpoints):

E-kwanza: GET /api/payment/ekwanza/status/:code - Returns status: "paid" or "pending" Reference: GET /api/payment/reference/status/:operationId - Returns payment.status

When paid, both return invoiceUrl.

Error Codes

CodeDescription
MISSING_API_KEYx-api-key header missing
INVALID_API_KEYKey invalid or inactive
DOMAIN_NOT_ALLOWEDOrigin not registered
INVALID_AMOUNTInvalid amount
AMOUNT_MISMATCHamount != SUM(products)
MISSING_PHONEPhone required (MCX/E-kwanza)
MISSING_RESTAURANT_IDMerchant not identified
RATE_LIMIT_EXCEEDED100 req/min exceeded
PAYMENT_RATE_LIMIT_EXCEEDED20 payment req/min exceeded
INTERNAL_ERRORServer error

Error format: { "success": false, "error": "message", "code": "ERROR_CODE" }

Fees

2% processing fee on all payments: feeAmount = totalAmount * 0.02

Notes

  • Phone format: 244XXXXXXXXX (12 digits)
  • IVA defaults to 14%. Use 0 for exempt.
  • Invoice PDFs hosted on CDN, returned as invoiceUrl
  • MCX is immediate; Reference and E-kwanza are confirmed via webhook (status polling as fallback)

Source

git clone https://github.com/ithustle/momenu-skills/blob/main/skills/mom-factura-payments/SKILL.mdView on GitHub

Overview

Integrates the Mom Factura Payments API to process Angolan payment methods (Multicaixa Express, E-kwanza, Bank Reference) and auto-generates SAFT-AO compliant invoices. It supports both immediate and deferred payments within checkout flows and product-based billing that includes IVA tax.

How This Skill Works

Authenticate with x-api-key to https://api.momenu.online. For MCX, POST /api/payment/mcx with amount, phoneNumber, and optional products/customer to mark the order as PAID and generate an invoice. For E-kwanza, POST /api/payment/ekwanza with similar fields to create an OPEN order and return a QR code; payment confirmation comes via webhook. For Bank Reference, POST /api/payment/reference to generate a bank reference and due date. Enforce amount validation when both amount and products are provided; use webhooks to confirm deferred payments with events payment.confirmed and invoice.created.

When to Use It

  • Implementing a checkout flow for Angolan customers that accepts MCX payments.
  • Offering deferred payment options (E-kwanza or Bank Reference) with QR or bank references.
  • Automatically generating SAFT-AO compliant invoices upon successful payments.
  • Billing product-based orders with IVA tax and itemized invoice data.
  • Testing or QA workflows using QA headers (x-env-qa) or localhost mode (x-dev-mode) and simulateResult

Quick Start

  1. Step 1: Obtain merchant API key and set base URL https://api.momenu.online; include Content-Type: application/json and x-api-key in headers.
  2. Step 2: Implement a payment path by selecting MCX, EKwanza, or Reference and send paymentInfo (amount, phoneNumber) plus optional products and customer data.
  3. Step 3: Configure webhook endpoint to receive payment.confirmed and invoice.created events; validate responses and handle invoice URLs for MCX.

Best Practices

  • Always include the x-api-key header for every request.
  • If both paymentInfo.amount and products are provided, ensure total matches the sum(productPrice * productQuantity); handle AMOUNT_MISMATCH.
  • Provide detailed invoice data via products (id, productName, productPrice, productQuantity) and IVA rate per item.
  • Securely handle webhooks: verify payloads, process payment.confirmed and invoice.created in order, and update order status accordingly.
  • Test in QA using x-env-qa or x-dev-mode and use simulateResult to simulate success, timeout, or errors.

Example Use Cases

  • Angolan e-commerce checkout processing a MCX payment and returning an invoice URL on success.
  • Deferred E-kwanza flow generating a QR code and confirming via webhook when paid.
  • Bank Reference payment flow delivering a bank reference and due date for customer payment.
  • IVA-aware product billing with itemized lines for SAFT-AO compliant invoicing.
  • QA workflow validating payment and webhook sequences with simulateResult scenarios.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers