This section assumes you have connected your payment gateways, set your smart routing rules, and configured your webhook in Archefusion.
Here is how it works:
→ Customer initiates a payment on your platform.
→ Archefusion checks your configured smart routing rule and live provider health to determine the best gateway to process the payment.
For example, if Paystack is configured as the first payment gateway to handle card payments between ₦100 and ₦100,000 but is currently unavailable, Archefusion automatically skips it and selects Flutterwave (your fallback gateway) instead.
→ You send the user to the selected gateway’s checkout page. For most gateways this means redirecting to the session’s
redirectUrl; see payment session for how to handle checkout for each gateway.
→ Customer completes payment and is redirected back to your platform via the redirect URL.
→ Archefusion sends a notification with the payment outcome to your server.
If a payment fails on the checkout page, for example, due to insufficient funds or a declined card, it is marked as failed. This is outside Archefusion’s control.
How to accept payments on Archefusion
Step 1: Collect customers’ payment information.
To initiate a payment, you need to pass information such as email, amount, payment method, currency, phone number, etc. Amount is a required field. You can also pass any additional information in themetadata object field.
The customer data can be retrieved from your database, session, or from an HTML form in the example below:
Step 2: Initiate payment.
When a customer clicks the pay button, your server initiates a payment by sending a POST request to the Archefusioninitiate payment endpoint with your customer’s payment details.
View code example
View code example
View response
View response
- Payment method is an optional field; however, if not provided, Archefusion cannot match your smart routing rules and will fall back to a default provider order.
-
If you do not provide a
redirectUrl, customers will be redirected to the one set on your dashboard. Setting it in the code allows you to be flexible if you need to. - If you do not set a redirect URL on the dashboard or on the code, customers will not be redirected back to your site after payment.
-
Ensure
merchantOrderIdis unique for every payment request. In the example above, we use UUID to generate a unique order ID automatically.
Verify transaction
Once the transaction is successful, the customer is redirected back to the redirectUrl you set. However, it is very important that you confirm the status of the transaction before you deliver value. Archefusion provides two ways to do this:-
Webhook notifications (recommended): Archefusion sends a
payment.succeededorpayment.failedevent to your webhook URL automatically when a payment outcome is determined. This is the preferred approach as it does not require additional API calls from your server. - Verify endpoint: You can also call the verify endpoint to check the transaction status manually.

