Verify transactions and confirm payment status with PayChangu
Click on any sample transaction reference below to test verification:
// Import the Verification SDK
import { VerificationSDK } from 'paychangu-js';
// Get transaction reference from input
const txRef = document.getElementById('txRefInput').value;
// Verify the transaction
const verificationResponse = await VerificationSDK.verifyTransaction(txRef);
// Handle the response
if (verificationResponse.status === 'success') {
console.log('Transaction verified:', verificationResponse.data);
// Update UI to show verified status
} else {
console.error('Verification failed:', verificationResponse.message);
}
{
"status": "success",
"message": "Transaction verified successfully",
"data": {
"tx_ref": "PC-LZ9K2X-A3F8B2M1",
"amount": 1000,
"currency": "MWK",
"customer": {
"email": "customer@example.com",
"first_name": "John",
"last_name": "Doe"
},
"payment_status": "success", // success, pending, failed
"payment_date": "2024-01-15T10:30:00Z",
"payment_method": "mobile_money",
"transaction_id": "TXN_1234567890"
}
}
// Error Response:
{
"status": "error",
"message": "Transaction not found",
"error_code": "TX_NOT_FOUND"
}
| Status | Description | Action |
|---|---|---|
| success | Payment completed successfully | Deliver goods/service |
| pending | Payment is being processed | Wait for webhook or retry verification |
| failed | Payment failed | Notify customer, offer retry |
| not_found | Transaction reference doesn't exist | Check TX Ref for errors |