Facilitate the process of gathering payments on your website by utilizing the simplest method available.

Payment Inline

With Inline you have the possibility to process transactions in several ways:

  • Make a redirection after initiating the transaction
  • Display directly the payment interface on the same page to your customer with a Popup

Redirect Method

The process entails:

  1. Requesting the creation of a payment utilizing your server and specifying payment details.
  2. We furnish you with a payment page link, which directs your customer to complete payment.
  3. Once the transaction is finalized, the customer is redirected to your page.

Step 1: Collect payment information

In order to commence the transaction, certain information such as email, phone, name, amount, reference, etc., must be queued. Email and amount are mandatory. Additional information can be passed using the metadata object field. Customer details may be obtained from a pre-existing database, session/cookie or form submission, as demonstrated in the example below.

<form action="/process-payment" method="POST"> 
    <input type="hidden" name="user_email" value="hello@notchpay.co"> 
    <input type="hidden" name="amount" value="1000"> 
    <input type="hidden" name="cart_reference" value="cart_12dh3ds6hs2s8sha"> 
    <button type="submit" name="make_payment" id="make-payment" title="Make payment">Make payment</button>

Step 2: Initialize payment

Upon a customer selecting the payment action button, initiate a transaction through submission of a POST request to our API, specifically directed to the Initialize Notch Pay Payment API endpoint, which should include relevant parameters such as email, amount, currency and any additional requisite parameters.

Important notes

  1. The amount field must be consistent with the currency you wish to use. If for example you use XAF, this value must not contain a decimal value
  2. The cart_reference obtained from the aforementioned form served as our reference for the transaction. It is recommended that a unique transaction identifier from your system is utilized as the reference instead.
  3. The callback was established within the payment data array.
  4. In the event that a callback URL is not specified on the dashboard or within the code, users will not be redirected to your site subsequent to payment.
  5. Test transactions may employ test callback URLs, while live transactions can utilize live callback URLs.
    $url = "https://api.notchpay.co/payments/initialize";

    $fields = [
        'email' => "customer@email.com",
        'amount' => "1000",
        'currency' => "XAF",
        'description' => "Payment description", // this field is optional
        'reference' => 'your_unique_reference' // this param is optional but recommended

    //open connection
    $ch = curl_init();
    //set the url, number of POST vars, POST data
    curl_setopt($ch,CURLOPT_URL, $url);
    curl_setopt($ch,CURLOPT_POST, true);
    curl_setopt($ch,CURLOPT_POSTFIELDS, $fields);
    curl_setopt($ch, CURLOPT_HTTPHEADER, array(
        "Authorization: PUBLIC_KEY",
        "Cache-Control: no-cache",
    //So that curl_exec returns the contents of the cURL; rather than echoing it
    curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); 
    //execute post
    $result = curl_exec($ch);
    echo $result;

Step 3: Verify Transaction

Notch Pay redirects the user to a callback with the transaction reference appended in the URL after a successful transaction. For instance, http://your_website.com/afterpayment_callback.php?trxref=YOUR_REFERENCE&reference=NOTCHPAY_REFERENCE&status=PAYMENT_STATUS

Retrieve the reference from the URL parameter to call the verify endpoint to confirm the transaction status. Verify transactions before delivering value since simply visiting the callback does not prove transaction success. To learn more, check out verification reference. Note that for verification you should use Notch Pay reference not your merchant_reference or trxref.

Bonus: Handle Webhook

Upon the successful completion of a payment, Notch Pay will transmit a payment.complete webhook event to the designated webhook URL that you have provided. Additional information regarding the usage and implementation of webhooks is available for your reference.