Payment Page (Donation) API endpoint enables you to create a PayPage with (donation mode). Donation Mode PayPage is based on not providing a fixed amount as a purchase, it will be a range between x and y, which will give the client the ability to choose the amount to be paid (donate) from his side within this predefined x-y range. You may have the same functionality available via  How to manage PayLinks on PayTabs Dashboard? solution article. Also, this can be done via the normal "Hosted Payment Page".


In this article you will be going to know about:


Postman Collection


For the purposes of this article, you will need to use the following postman collection for testing and integrating, for proceeding with this please click here.




You can simply create a donation PayLink/PayPage to your customers by following the below example

Sample Request Payload


Post

https://{{domain}}/payment/request

 

{
    "profile_id": {{profile_id}},
    "tran_type": "sale",
    "tran_class": "ecom",
    "cart_id": "cart_22222",
    "cart_currency": "{{currency}}",
    "cart_amount": 12.3,
    "cart_description": "Description of the items/services",
    "paypage_lang": "en",
    "customer_details": {
        "name": "first last",
        "email": "[email protected]",
        "phone": "0522222222",
        "street1": "address street",
        "city": "dubai",
        "state": "du",
        "country": "AE",
        "zip": "12345"
    },
    "shipping_details": {
        "name": "name1 last1",
        "email": "[email protected]",
        "phone": "971555555555",
        "street1": "street2",
        "city": "dubai",
        "state": "dubai",
        "country": "AE",
        "zip": "54321"
    },
    "callback": "{{callback_url}}",
    "return": "{{return_url}}",
    "donation_mode":true,
    "cart_min":5,
    "cart_max":10
}


Sample Response Payload


{
    "tran_ref": "TST22222211110000",
    "tran_type": "Sale",
    "cart_id": "cart_22222",
    "cart_description": "Description of the items/services",
    "cart_currency": "USD",
    "cart_amount": "0.00",
    "callback": "https://webhook.site/53aba5b2-2e8d-0000-af30-34976b2fd57d",
    "return": "https://webhook.site/53aba5b2-2e8d-0000-af30-34976b2fd57d",
    "redirect_url": "https://secure-egypt.paytabs.com/payment/page/5B37B5C182E412DE649D0FC14E6BAAAAAAAABBBBBBBBCCCCCCC3BF099B58F5",
    "customer_details": {
        "name": "first last",
        "email": "[email protected]",
        "phone": "0522222222",
        "street1": "address street",
        "city": "dubai",
        "state": "DU",
        "country": "AE"
    },
    "shipping_details": {
        "name": "name1 last1",
        "email": "[email protected]",
        "phone": "971555555555",
        "street1": "street2",
        "city": "dubai",
        "state": "DU",
        "country": "AE"
    },
    "serviceId": 2,
    "trace": "PMNT0403.00000A00000.0002C193"
}