Authentication

Discover how to incorporate accurate information into your API requests, enabling you to execute calls for your synchronized accounts.

Make request for Synced accounts

To make API calls for your synchronized accounts server-side, include the X-Sync header in each request along with the Sync account identifier (prefixed with "sync.").

Example request

    $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
        'callback' => 'your_callback_url'
    ];

    //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",
        "X-Sync: YOUR_SELLER_SYNC_ID",
        "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;

Example response

{
  "status": "Accepted",
  "message": "Payment initialized",
  "code": 201,
  "transaction": {
    "amount": 1000,
    "amount_total": 1000,
    "sandbox": false,
    "fee": 0,
    "converted_amount": 1000,
    "customer": "cus.40jRRfanz7tKgZrl",
    "reference": "trx.DzoxEW60jLOfd9eB8sb43r1z",
    "status": "pending",
    "currency": "XAF",
    "callback": "https://notchpay.co",
    "geo": "129.0.189.24",
    "created_at": "2024-04-25T04:04:22.000000Z",
    "updated_at": "2024-04-25T04:04:22.000000Z"
  },
  "authorization_url": "https://pay.notchpay.co/l5v1X6gfxTnbHC3DvQAaACiemgsZzfw9Css6Nzozq44aW4nXkO5Lix7qiKPYkEulnWTOCemfaEnZZprWszZvxOnp42hSJA6tAIkRiewFisEp1AiUwDdhCM5EBOrNbRLojUFpQpnj1iDfFoiTWhw614kR3rZaRbPj41tNtC9aUA6ZRd4jQM0Tr8bQPPvL2z4O"
}

Copyright © 2024 Notch Pay