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, the create payment request will be confirmed by the Verify Payment API request.

Request URL: {base_URL}/api/checkout-v2
**base_URL is UddoktaPay installation location (eg: pay.your-domain.com)

Request Headers

Header NameValue
Content-Type"application/json"
Accept"application/json"
RT-UDDOKTAPAY-API-KEYCollect API KEY From Dashboard

Request Parameters

PropertyPresenceTypeDescription
full_nameMandatorystringUser Full Name
emailMandatorystringUser Email
amountMandatorystringAmount of the payment to be made.
metadataMandatoryjson objectHere you can pass any extra data according to your project needs
redirect_urlMandatorystringThe base URL of merchant's platform based on which UddoktaPay will generate seperate callback URLs for success, failure and cancelled transactions. UddoktaPay will send transaction verification result in these URLs based on the the result.
return_typeOptionalstringPOST or GET
Default: POST

You can define return_url data format.
In POST format UddoktaPay will send invoice_id with POST format .
In GET format UddoktaPay will send invoice_id with Query Parameter
cancel_urlMandatorystringThe cancelled callback URL where UddoktaPay will inform user about the transaction result in case of a cancelled transaction.
webhook_urlOptionalstringThe IPN callback URL where admin can manually send all data with CURL request about user transaction from admin dashboard.

Success Response Parameters

PropertyTypeDescription
statusboolTRUE
messagestringMessage associated with the status, explaining the status.
payment_urlstringThe URL of UddoktaPay where the customer should be forwarded to complate his payment.

Example:
https://sandbox.uddoktapay.com/payment/64c0d6077f0be49801bdd142a05518193574d31d

Error Response Parameters

PropertyTypeDescription
statusboolFALSE
messagestringMessage 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-v2",
  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-v2 \
     --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-v2',
  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-v2"

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"
}