Loading...
Loading...
Test and debug Mom Factura Payment API integrations using QA environment and payment simulation. Use when setting up test environments, simulating payment outcomes (success, failure, timeout), debugging API errors, or validating integration before production.
npx skill4agent add ithustle/momenu-skills mom-factura-testinghttps://api.momenu.onlinex-env-qa: truex-dev-mode: trueContent-Type: application/json
x-api-key: YOUR_API_KEY
x-env-qa: true
x-dev-mode: truesimulateResultx-env-qa: true| Value | Behavior |
|---|---|
| Payment succeeds, returns transactionId and invoiceUrl |
| Fails: client has no balance |
| Fails: no response from provider |
| Fails: payment explicitly rejected |
| Fails: phone not registered |
curl -X POST https://api.momenu.online/api/payment/mcx \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-env-qa: true" \
-d '{"paymentInfo":{"amount":1000,"phoneNumber":"244923456789"},"simulateResult":"success"}'curl -X POST https://api.momenu.online/api/payment/mcx \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-env-qa: true" \
-d '{"paymentInfo":{"amount":5000,"phoneNumber":"244923456789"},"simulateResult":"insufficient_balance"}'curl -X POST https://api.momenu.online/api/payment/mcx \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-env-qa: true" \
-d '{"paymentInfo":{"amount":2500,"phoneNumber":"244923456789"},"products":[{"id":"1","productName":"P","productPrice":3000,"productQuantity":1}],"simulateResult":"success"}'{ "success": false, "code": "AMOUNT_MISMATCH" }curl -X POST https://api.momenu.online/api/payment/ekwanza \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-env-qa: true" \
-d '{"paymentInfo":{"amount":2000,"phoneNumber":"244923456789"}}'curl -X POST https://api.momenu.online/api/payment/reference \
-H "Content-Type: application/json" \
-H "x-api-key: YOUR_API_KEY" \
-H "x-env-qa: true" \
-d '{"paymentInfo":{"amount":10000}}'const API = "https://api.momenu.online";
const headers = {
"Content-Type": "application/json",
"x-api-key": "YOUR_API_KEY",
"x-env-qa": "true"
};
async function testMCX(simulateResult = "success") {
const res = await fetch(`${API}/api/payment/mcx`, {
method: "POST", headers,
body: JSON.stringify({
paymentInfo: { amount: 1000, phoneNumber: "244923456789" },
simulateResult
})
});
return res.json();
}
// Run all scenarios
for (const s of ["success","insufficient_balance","timeout","rejected","invalid_number"]) {
testMCX(s).then(r => console.log(s, r.success ? "PASS" : "FAIL", r));
}import requests
API = "https://api.momenu.online"
headers = {"Content-Type": "application/json", "x-api-key": "YOUR_API_KEY", "x-env-qa": "true"}
def test_mcx(simulate="success"):
r = requests.post(f"{API}/api/payment/mcx", json={
"paymentInfo": {"amount": 1000, "phoneNumber": "244923456789"},
"simulateResult": simulate
}, headers=headers)
return r.json()
for s in ["success", "insufficient_balance", "timeout", "rejected", "invalid_number"]:
result = test_mcx(s)
print(f"{s}: {'PASS' if result.get('success') else 'FAIL'} - {result}")| Error | Cause | Fix |
|---|---|---|
| DOMAIN_NOT_ALLOWED | Origin not registered | Add |
| MISSING_API_KEY | Header missing | Check header is |
| AMOUNT_MISMATCH | amount != products total | Verify SUM(price*qty) == amount, or send only one |
| MISSING_PHONE | No phone for MCX/E-kwanza | Add |
| simulateResult ignored | Not in QA mode | Add header |
| simulateResult ignored | Wrong endpoint | Only works on MCX, not E-kwanza or Reference |
x-env-qa: truex-dev-mode: truesimulateResult