Create Charge API V1 Guideline

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 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 success callback URL where UddoktaPay will inform user about the transaction result in case of a successful transaction.
cancel_urlMandatorystringThe cancelled callback URL where UddoktaPay will inform user about the transaction result in case of a cancelled transaction.
webhook_urlMandatorystringThe IPN callback URL where UddoktaPay will send all data with CURL request about user transaction.

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