Response Handling
After a payment completes, the XDK returns a JSON string with the transaction result. Parse this on your app and verify it on your backend before fulfilling the order.
Standard Payment Result
{
"status_code": "00",
"amount": "1.01",
"chksum": "34a9ec11a5b79f31a15176ffbcac76cd",
"pInstruction": 0,
"msgType": "C6",
"paydate": 1459240430,
"order_id": "3q3rux7dj",
"err_desc": "",
"channel": "Credit",
"app_code": "439187",
"txn_ID": "6936766",
"mp_secured_verified": false
}
Key Fields
| Field | Description |
|---|---|
status_code | "00" = Success, "11" = Failed, "22" = Pending (cash channels only) |
amount | Transaction amount |
paydate | Transaction date (Unix timestamp) |
order_id | Your order ID |
channel | Payment channel used |
txn_ID | Transaction ID generated by Fiuu |
chksum | Checksum for server-side verification |
msgType | Message type (used in checksum calculation) |
mp_secured_verified | Built-in checksum validation result (see note below) |
Google Pay Result
Google Pay returns a slightly different format:
{
"StatCode": "00",
"StatName": "captured",
"TranID": "30959687",
"Amount": "1.10",
"Domain": "",
"VrfKey": "",
"Channel": "credit",
"OrderID": "1741853136969",
"Currency": "MYR",
"ErrorCode": null,
"ErrorDesc": null,
"ProcessorResponseCode": "00",
"3DSVersion": "2.2"
}
| Field | Description |
|---|---|
StatCode | "00" = Success, "11" = Failed, "22" = Pending |
TranID | Transaction ID generated by Fiuu |
Amount | Transaction amount |
OrderID | Your order ID |
Channel | Card type used |
Domain | Your Merchant ID |
VrfKey | Verify key: md5(Amount + secret_key + Domain + TranID + StatCode) |
Error Results
Communication Error
{"Error": "Communication Error"}
Possible causes:
- Internet not available
- Invalid API credentials (
mp_username,mp_password,mp_merchant_ID,mp_verification_key) - Fiuu server offline
Format Error
{
"status": false,
"error_code": "P03",
"error_desc": "Your payment info format not correct."
}
Possible causes:
- Required parameters missing or incorrectly formatted
mp_extended_vcodenot set totruewhen extended Verify Payment is enabled
Google Pay Token Error
{
"error_code": "A01",
"error_desc": "Fail to detokenize Google Pay Token given",
"status": 0
}
Possible causes:
- Misconfigured Google Pay setup
- Invalid API credentials
- Payment server offline
Contact Fiuu support if the error persists.
Checksum Verification
Standard Payment
chksum = MD5(mp_merchant_ID + msgType + txn_ID + amount + status_code + secret_key)
Private Secret Key (Recommended)
chksum = MD5(mp_merchant_ID + results.msgType + results.txn_ID + results.amount + results.status_code + merchant_private_secret_key)
Your secret_key is available in the Fiuu Merchant Portal.
Built-in Validator Caveat
All XDK builds include a built-in checksum validator that returns the result in mp_secured_verified. If you use the private secret key (recommended), this will always return false. In that case, ignore mp_secured_verified and verify the checksum on your server.
Handling Results by Framework
Flutter
String result = await MobileXDK.start(paymentDetails);
print("Result: $result");
// Parse JSON and verify on your backend
React Native
The fiuu-mobile-xdk-reactnative JavaScript wrapper normalizes native responses to plain objects before invoking your callbacks. Android returns JSON strings internally; iOS returns dictionaries — both are parsed so you can access fields directly (result.StatCode, result.txn_ID, etc.).
Two result formats depending on the payment flow:
| Flow | Status field | Verify with |
|---|---|---|
Standard XDK checkout (mp_channel set) | status_code | chksum — see Standard Payment Result |
Google Pay (omit mp_channel) / Apple Pay | StatCode | VrfKey — see Google Pay Result |
Always provide both successCallback and errorCallback. successCallback fires for StatCode "00". Pending ("22") and failed ("11") backend payloads arrive as objects in errorCallback; pre-flight validation errors (missing credentials, unlinked native module) arrive as plain strings.
import fiuupayment from 'fiuu-mobile-xdk-reactnative';
fiuupayment.startFiuu(
paymentDetails,
(result) => {
// Plain object — status_code/StatCode "00" (success)
const code = result.StatCode ?? result.status_code;
console.log('Success:', code, result.TranID ?? result.txn_ID);
// Verify on your backend
},
(error) => {
if (typeof error === 'object') {
const code = error.StatCode ?? error.status_code;
if (code) {
// Failed backend payload
console.log('Failed:', error.ErrorCode ?? error.err_desc, error.ErrorDesc ?? error.err_desc);
}
} else {
// Pre-flight validation error or user cancellation — plain string
console.log('Error:', error);
}
}
);
Expo
startMolpay(paymentDetails, (result) => {
console.log('Fiuu Payment Result:', result);
// Parse JSON and verify on your backend
});
Android (Java/Kotlin)
ActivityResultLauncher<Intent> paymentActivityResultLauncher = registerForActivityResult(
new ActivityResultContracts.StartActivityForResult(),
result -> {
if (result.getData() != null) {
String transactionResult = result.getData()
.getStringExtra(PaymentActivity.XDKTransactionResult);
Log.d(PaymentActivity.logXDK, "transaction result = " + transactionResult);
}
}
);
Swift
vc.startXDK { result in
switch result {
case .success(let data):
print("RESULTS: \(data)")
case .failure:
print("ERROR!")
}
}
Best Practices
- Never trust client-side success alone — always verify the checksum on your backend.
- Use unique order IDs for every transaction to prevent duplicates.
- Handle all status codes — including pending (
"22") for cash channels. - Log errors with the full result JSON for troubleshooting.
- Match credentials to environment — Sandbox credentials with
mp_core_env = "4", production credentials otherwise.