This API will receive a payment creation request with necessary information.

Introduction

The UddoktaPay Create Charge API enables you to receive payment creation requests and initiate payments. This documentation offers comprehensive guidance on utilizing this API effectively.

Request URL

To create a payment request, use the following API endpoint:

{base_URL}/api/checkout-v2

Where {base_URL} is the location of your UddoktaPay installation, such as https://pay.your-domain.com.

Request Headers

Include the following request headers:

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

Request Parameters

The API expects the following parameters in the request:

PropertyPresenceTypeDescription
full_nameMandatorystringUser's full name
emailMandatorystringUser's email
amountMandatorystringPayment amount
metadataMandatoryJSON objectA JSON object for additional project-specific data.
redirect_urlMandatorystringBase URL of the merchant's platform. UddoktaPay will generate separate callback URLs for success, failure, and canceled transactions based on this URL.
return_typeOptionalstring"POST" (default) or "GET." Specifies the return URL data format. In "POST" format, UddoktaPay sends the invoice_id with a POST request. In "GET" format, the invoice_id is sent as a query parameter.
cancel_urlMandatorystringURL for canceled transaction notifications.
webhook_urlOptionalstringIPN callback URL for manual data submission from the admin dashboard.

Success Response Parameters

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

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

Error Response Parameters

PropertyTypeDescription
statusboolFALSE
messagestringThe message associated with the status, explains 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',
    'return_type'   => 'GET',		 
    '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"
}