Collection Webhooks

Collection webhooks are sent to your server via the collection webhook url specified on your dashboard. As soon as a transaction is confirmed Marasoft Pay sends you a webhook that contains all the data for that transaction.


How to Integrate

1. Set up your server for receiving webhooks

Code Sample
    <?php

    // Retrieve the request's body and parse it as JSON
        $input = @file_get_contents("php://input");
        $event = json_decode($input);

    // Do something with $event
        http_response_code(200); // PHP 5.4 or greater
    ?>
    // Using Express
        app.post("/my/webhook/url", function(req, res) {

    // Retrieve the request's body
        var event = req.body;

    // Do something with event
        res.send(200);
    });

2. Set the collection webhook url on your dashboard to the endpoint that was set up


3. Sample webhook response for checkout collection ( dynamic account, cards and USSD )

Sample Response
    {
        "account_number": "8021829356",
        "transaction_amount": "1000",
        "expected_amount": "1000",
        "settled_amount": "1000",
        "merchant_ref": "77bgg89gfesc7",
        "msft_ref": "ref_VG0N06QFYME16693684516168861", 
        "source_account_number":"0230926956", 
        "source_account_name": "ADEKUNLE DAVID ADEYEYE", 
        "source_bank_name":  "WEMA BANK", 
        "channel": "CHECKOUT_COLLECTIONS",
        "narration": "ALAT TRANSFER TO FARMNTRADE-", 
        "status": "success", 
        "transaction_type": "TRANSFER", 
        "ipaddress": "105.112.57.167", 
        "created_at": "2022-11-25 10:27:45"
    }