Confirm Methods
Confirm methods are payment types where users input their charge data (like bank card details, mobile money number, etc.) directly during the checkout process.
How it Works
- User Input: The customer provides their payment details on the checkout page.
- Processing: The payment is processed immediately.
- Confirmation: The payment may need to be confirmed by the bank or mobile operator (e.g., via an USSD prompt on their phone or an OTP). No additional actions are required from the user outside of this immediate confirmation flow.
API Usage for Merchants
For Confirm methods (excluding Cards), merchants can process payments directly after creating a payment link. This is done by passing the charge data along with the paymentLinkId to the confirm endpoint.
Note: This direct confirmation flow via API is described in the Payments documentation.
Examples
Here are examples of how to confirm a payment using different clients and methods.
Curl
curl -X POST https://paysgator.com/api/v1/payment/confirm \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"paymentLinkId": "YOUR_PAYMENT_LINK_ID",
"paymentMethod": "MPESA",
"payment_fields": {
"phoneNumber": "841234567"
}
}'
JavaScript (Fetch)
const response = await fetch('https://paysgator.com/api/v1/payment/confirm', {
method: 'POST',
headers: {
'X-Api-Key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
paymentLinkId: 'YOUR_PAYMENT_LINK_ID',
paymentMethod: 'MPESA',
payment_fields: {
phoneNumber: '841234567'
}
})
});
const data = await response.json();
console.log(data);
Node.js Client
const confirmation = await client.payments.confirm({
paymentLinkId: 'payment_link_id',
paymentMethod: 'MPESA',
payment_fields: {
phoneNumber: '841234567'
}
});
console.log('Payment Confirmed:', confirmation.data.transactionId);
PHP Client
try {
$confirmation = $client->payments()->confirm([
'paymentLinkId' => 'payment_uuid',
'paymentMethod' => 'MPESA',
'payment_fields' => ['phoneNumber' => '841234567']
]);
print_r($confirmation);
} catch (\Exception $e) {
echo "Error: " . $e->getMessage();
}
Python Client
# Confirm a payment (Server-side)
confirmation = client.payments.confirm(
payment_link_id="payment_link_uuid",
payment_method="MPESA",
payment_fields={"phoneNumber": "841234567"}
)
print(f"Confirmed Transaction: {confirmation.data.transaction_id}")
Supported Confirm Methods
EMOLA (MZN)
- Description: Process payment through Movitel Emola mobile money.
- Required Fields:
phoneNumber - Format: A 9-digit number starting with 86 or 87.
MKESH (MZN)
- Description: Process payment through Tmcel Mkesh mobile money.
- Required Fields:
phoneNumber - Format: A 9-digit number starting with 82 or 83.
MPESA MOZAMBIQUE (MZN)
- Description: Process payment through M-Pesa mobile money.
- Required Fields:
phoneNumber - Format: A 9-digit number starting with 84 or 85.
MULTICAIXA EXPRESS (AOA)
- Description: Confirm payment method from the Angolan MULTICAIXA network.
- Required Fields:
phoneNumber - Format: A 9-digit number starting with 92, 93, or 94.
BANK CARD (MZN, AOA, USD, EUR, ZAR)
- Description: Supports many card networks like VISA, Mastercard, American Express, and more.
- Note: While classified as a "Confirm" method, card payments follows a strict security flow and generally adhere to specific PCI compliance standards.