APIs
This section describes the available APIs and their usage.
Create Checkout
The create-checkout
API allows you to create a new checkout.
Endpoint: /create-checkout
Method: POST
Request Body
The request body should include the following parameters:
amount
(number): The amount for the checkout. It should be a numeric value greater than zero.currency
(string): The currency for the checkout. It should be one of the allowed request currencies ("USD" OR "EUR").itemName
(string, optional): The name of the item associated with the checkout.itemId
(string, optional): The ID of the item associated with the checkout.note
(string, optional): Additional note for the checkout.clientId
(string, optional): The ID of the client associated with the checkout.items
(array): Array of item included in checkout.
Example Request:
const createCheckout = async () => {
try {
const response = await axiosnInstance.post("/create-checkout", {
amount: 250,
apiKey:"684315e5-7f83-446a-bb8b-64fc95c0fc4d",
currency:"USD",
itemName:"Ginger Tea",
note: "Additional note",
itemId: "xyz123",
items:[
{
itemName: "Test Item",
price: 50,
qty: 5,
taxRate: 1.5
}
]
note:"Test payment"
});
console.log(response.data);
} catch (error) {
console.error(error);
}
};
createCheckout();
Example Response:
The API will respond with the created checkout details.
{
"message": "checkout created",
"data": {
"quotes": [
{
"currencyId": "AC90FA93-754C-4B36-9E62-A3AAD96B27ED",
"currencyName": "XDC",
"currencyType": "wallet",
"currencyFullName": "XinFin Network",
"network": null,
"feePercent": 1,
"amount": 6114.8674452,
"fee": 61.14867445,
"total": 6176.01611965
}
],
"payments": [],
"items": [
{
"itemName": "Test Item",
"price": 50,
"qty": 5,
"taxRate": 1.5,
"taxAmount": 3.75,
"subTotal": 250,
"total": 253.75
}
],
"requestCurrency": "USD",
"requestCurrencyAmount": 253.75,
"requestCurrencyPriceUsd": 1,
"amountInUSD": 253.75,
"duration": 1800000,
"checkoutTime": "2023-10-19T11:41:50.181Z",
"expiryTime": "2023-10-19T12:11:50.181Z",
"note": "Test payment",
"clientId": null,
"itemId": null,
"itemName": "Ginger Tea",
"status": "pending",
"checkoutId": "63adb2cb-27a8-45b1-ab1a-f47ecde31ae8"
}
}
Generate Address
The generate-address
API allows you to generate an address for a specific checkout.
Endpoint: /generate-address
Method: POST
Request Body
The request body should include the following parameters:
currencyId
(string): The ID of the currency associated with the checkout.checkoutId
(string): The ID of the checkout for which the address is generated.network
(string, optional): The network for the address (if applicable).
Example Request:
const generateAddress = async () => {
try {
const response = await axiosnInstance.post("generate-address", {
currencyId: "c123",
checkoutId: "checkout123",
network: "Ethereum"
});
console.log(response.data);
} catch (error) {
console.error(error);
}
};
generateAddress();
Example Response:
The API will respond with the generated address details.
{
"message": "successfully got the address",
"data": {
"address": "xdc85d4485040b5870c2f3b8a66cef7d08fe9c8dec1",
"destinationTag": null
}
}
Cancel Checkout
The cancel-checkout
API allows you to generate an address for a specific checkout.
Endpoint: /cancel-checkout
Method: POST
Request Body
The request body should include the following parameters:
checkoutId
(string): The ID of the checkout to cancel.
Example Request:
const cancelCheckout = async () => {
try {
const response = await axiosnInstance.post("cancel-checkout", {
checkoutId: "checkout123"
});
console.log(response.data);
} catch (error) {
console.error(error);
}
};
cancelCheckout();
Example Response:
The API will respond with the cancel checkout message.
{
"message": "checkout cancelled"
}
Get Checkout Details
The get-checkout-details
API allows you to generate an address for a specific checkout.
Endpoint: /get-checkout-details
Method: POST
Request Body
The request body should include the following parameters:
checkoutId
(string): The ID of the checkout to retrieve details.
Example Request:
const getCheckoutDetails = async () => {
try {
const response = await axiosnInstance.post("get-checkout-details", {
apiKey: "API_KEY",
checkoutId: "63adb2cb-27a8-45b1-ab1a-f47ecde31ae8",
});
console.log(response.data);
} catch (error) {
console.error(error);
}
};
getCheckoutDetails();
Example Response:
The API will respond with the checkout details.
{
"data": {
"quotes": [...],
"payments": [],
"store": {
"logo": "https://uatmerchantapi.globiance.com/merchant-dashboard-api-service/merchant-logo/9da84c8f-dbd6-4392-a418-4ce1025fb3f3.png",
"labelName": "Mega Store",
"apiKey": "684315e5-7f83-446a-bb8b-64fc95c0fc4d",
"isActive": true,
"taxId": null,
"showTaxId": false,
"taxRate": 0
},
"items": [
{
"itemName": "Test Item",
"itemId": null,
"price": 50,
"qty": 5,
"taxRate": 1.5,
"taxAmount": 3.75,
"subTotal": 250,
"total": 253.75
}
],
"requestCurrency": "USD",
"requestCurrencyAmount": 253.75,
"requestCurrencyPriceUsd": 1,
"amountInUSD": 253.75,
"duration": 1800000,
"checkoutTime": "2023-10-19T11:41:50.181Z",
"expiryTime": "2023-10-19T12:11:50.181Z",
"note": "Test payment",
"clientId": null,
"itemId": null,
"itemName": "Ginger Tea",
"status": "pending",
"checkoutId": "63adb2cb-27a8-45b1-ab1a-f47ecde31ae8"
}
}
Get Payment Details
The get-payment-details
API allows you to generate an address for a specific checkout.
Endpoint: /get-payment-details
Method: POST
Request Body
The request body should include the following parameters:
paymentId
(string): The ID of the payment to retrieve details.
Example Request:
const getPaymentDetails = async () => {
try {
const response = await axiosnInstance.post("get-payment-details", {
paymentId: "payment123"
});
console.log(response.data);
} catch (error) {
console.error(error);
}
};
getPaymentDetails();
Example Response:
The API will respond with the payment details.
{
"data": {
"paymentId": "a596ef60-ffb1-11ed-b395-4318d66a581b",
"currencyId": "AC90FA93-754C-4B36-9E62-A3AAD96B27ED",
"currencyName": "XDC",
"createdAt": "2023-05-31T12:49:57.078Z",
"amount": 328.19740551062,
"status": "confirmed",
"isUnderDispute": false,
"disputeType": null,
"transactionType": "wallet",
"transactionDetail": {
"amount": 328.19740551062,
"payerUserId": "4C5ABF65-0A54-4BC6-93F7-4B10689BC780",
"payerEmail": "gb***************"
},
"paymenStatusHistory": [
{
"paymentId": "a596ef60-ffb1-11ed-b395-4318d66a581b",
"action": "processing",
"metadata": null,
"createdAt": "2023-05-31T12:49:57.089Z"
},
{
"paymentId": "a596ef60-ffb1-11ed-b395-4318d66a581b",
"action": "confirmed",
"metadata": null,
"createdAt": "2023-05-31T12:49:57.095Z"
},
{
"paymentId": "a596ef60-ffb1-11ed-b395-4318d66a581b",
"action": "settled",
"metadata": null,
"createdAt": "2023-05-31T12:49:57.271Z"
}
]
}
}