Not every Pakistani business website runs on a framework -- plenty are built in plain PHP, and the integration basics for accepting payments are the same regardless of framework.
The core pieces you need
1. A way to create a payment request
A PHP script that calls the gateway's API (using cURL or file_get_contents with a stream context) with the order amount, a unique order reference, and your API credentials, and receives back either a hosted checkout URL or a payment token.
2. A success/return page
Where the customer lands after paying -- but this page should only ever show a "thank you" message, never mark the order as paid by itself.
3. A webhook/IPN receiver script
A separate PHP file (e.g. webhook.php) that the gateway calls directly, server-to-server, when the payment status changes. This script verifies the signature/hash sent by the gateway and is the only place that should actually mark an order as paid in your database.
A common mistake in plain PHP sites
Because plain PHP sites often skip a proper routing/middleware layer, it is easy to accidentally expose the webhook endpoint without signature verification, or to mark orders paid directly from the return page. Both leave the store open to someone manually visiting a "success" URL to fake a paid order -- always verify server-side before trusting a payment is real.
Frequently asked questions
Can I accept JazzCash/Easypaisa on a plain PHP site without a framework?
Yes -- the integration pattern (create payment via API call, redirect, verify via webhook) does not require a framework, just careful separation between the "thank you" page and the actual payment-verification script.
What is the single most important security step?
Verify the webhook/IPN signature server-side before marking any order as paid -- never trust the customer's browser redirect alone.
Start accepting payments with SwichPay
Open a merchant account, connect your website with one API and get notified the moment a customer pays.
