This API will receive a payment creation request with necessary information.
Through this API, a payment creation request is received by UddoktaPay. Upon validation of user transaction information, UddoktaPay will send an IPN notification with payment data to webhook_url and the user will redirect to redirect_url.
Request URL: {base_URL}/api/checkout
**base_URL is UddoktaPay installation location (eg: pay.your-domain.com)
Request Headers
Header Name | Value |
---|---|
Content-Type | "application/json" |
Accept | "application/json" |
RT-UDDOKTAPAY-API-KEY | Collect API KEY From Dashboard |
Request Parameters
Property | Presence | Type | Description |
---|---|---|---|
full_name | Mandatory | string | User Full Name |
Mandatory | string | User Email | |
amount | Mandatory | string | Amount of the payment to be made. |
metadata | Mandatory | json object | Here you can pass any extra data according to your project needs |
redirect_url | Mandatory | string | The success callback URL where UddoktaPay will inform user about the transaction result in case of a successful transaction. |
cancel_url | Mandatory | string | The cancelled callback URL where UddoktaPay will inform user about the transaction result in case of a cancelled transaction. |
webhook_url | Mandatory | string | The IPN callback URL where UddoktaPay will send all data with CURL request about user transaction. |
Success Response Parameters
Property | Type | Description |
---|---|---|
status | bool | TRUE |
message | string | Message associated with the status, explaining the status. |
payment_url | string | The URL of UddoktaPay where the customer should be forwarded to complate his payment. Example: https://sandbox.uddoktapay.com/payment/64c0d6077f0be49801bdd142a05518193574d31d |
Error Response Parameters
Property | Type | Description |
---|---|---|
status | bool | FALSE |
message | string | Message associated with the status, explaining the status. |
Sample Request
<?php
$baseURL = 'https://sandbox.uddoktapay.com/';
$apiKEY = '982d381360a69d419689740d9f2e26ce36fb7a50';
$fields = [
'full_name' => 'John Doe',
'email' => '[email protected]',
'amount' => '100',
'metadata' => [
'user_id' => '10',
'order_id' => '50'
],
'redirect_url' => 'https://your-domain.com/success.php',
'cancel_url' => 'https://your-domain.com/cancel.php',
'webhook_url' => 'https://your-domain.com/ipn.php'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $baseURL . "api/checkout",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($fields),
CURLOPT_HTTPHEADER => [
"RT-UDDOKTAPAY-API-KEY: " . $apiKEY,
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
curl --request POST \
--url https://sandbox.uddoktapay.com/api/checkout \
--header 'RT-UDDOKTAPAY-API-KEY: 982d381360a69d419689740d9f2e26ce36fb7a50' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"full_name": "John Doe",
"email": "[email protected]",
"amount": "100",
"metadata": {
"user_id": "10",
"order_id": "50"
},
"redirect_url": "https://your-domain.com/success",
"cancel_url": "https://your-domain.com/cancel",
"webhook_url": "https://your-domain.com/ipn"
}
'
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://sandbox.uddoktapay.com/api/checkout',
headers: {
accept: 'application/json',
'RT-UDDOKTAPAY-API-KEY': '982d381360a69d419689740d9f2e26ce36fb7a50',
'content-type': 'application/json'
},
data: {
full_name: 'John Doe',
email: '[email protected]',
amount: '100',
metadata: {user_id: '10', order_id: '50'},
redirect_url: 'https://your-domain.com/success',
cancel_url: 'https://your-domain.com/cancel',
webhook_url: 'https://your-domain.com/ipn'
}
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
import requests
url = "https://sandbox.uddoktapay.com/api/checkout"
payload = {
"full_name": "John Doe",
"email": "[email protected]",
"amount": "100",
"metadata": {
"user_id": "10",
"order_id": "50"
},
"redirect_url": "https://your-domain.com/success",
"cancel_url": "https://your-domain.com/cancel",
"webhook_url": "https://your-domain.com/ipn"
}
headers = {
"accept": "application/json",
"RT-UDDOKTAPAY-API-KEY": "982d381360a69d419689740d9f2e26ce36fb7a50",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
Sample Response
{
"status": true,
"message": "Payment Url",
"payment_url": "https://sandbox.uddoktapay.com/payment/254663aa2a6a4a5df2aa8dc9f28aa1744a8bae9f"
}