quara-sdk
v0.73.0
Published
quara-sdk node.js SDK helps with the quara checkout API integration.
Readme
Quara checkout integration nodejs SDK
quara-sdk node.js SDK helps with the quara checkout API integration.
Installation
Install online package from https://www.npmjs.com
npm install quara-sdk --save
Configuration
Create configuration for sdk
Create a config.json file with below keys:
{
"baseUrl": "quara base url",
"client_id": "client id supplied by quara",
"client_secret": "client password supplied by quara"
}- baseUrl: Domain url of quara checkout API.
- client_id: Will be supplied by quara support.
- client_secret: Will be supplied by quara support.Usage:
1. Initialize the QuaraApiClient using the QuaraApiClientFactory:
Use QuaraApiClientFactory with sample code:
import apiConfiguration from './config.json'
import { QuaraApiClient, QuaraApiClientFactory } from 'quara-sdk';
public client: QuaraApiClient;
QuaraApiClientFactory.createApiClient(apiConfiguration).then((resp) => this.client = resp);2. Calling the required sdk function over the QuaraApiClient:
this.client.getOrderStatus("referenceId").then((response: any) => {
});
API Support:
- quaraCheckout --- api/order/merchant/checkout
- getOrderStatus --- api/order/merchant/reference/{referenceId}/status
- checkoutRefund --- api/order/merchant/refund
- orderConfirmation --- api/order/merchant/orderConfirmation
- downloadPO --- api/order/merchant/downloadPO/{referenceId}
1. quaraCheckout
Following is the sample code to get the checkoutUrl. quaraCheckout Request body
{
"referenceNumber": "",
"invoiceNumber": "",
"items": [
{
"id": 0,
"type": "",
"name": "",
"category": "",
"quantity": 0,
"unitPrice": {
"amount": "",
"currency": "SAR",
"vat": ""
}
}
],
"quantity": "",
"TotalAmount": {
"amount": "",
"currency": "SAR",
"vat": ""
}
}reference:- A unique reference identifier for the transaction.invoiceNumber:- The invoice number associated with the transaction.items:- List of items in the order, each containing: Â Â Â Â Â Â Â Âid:- Unique identifier for the item. Â Â Â Â Â Â Â Âtype:- Type of the item (e.g., "Physical"). Â Â Â Â Â Â Â Âname:- Name of the item. Â Â Â Â Â Â Â Âcategory:- Category of the item. Â Â Â Â Â Â Â Âquantity:- Quantity of the item. Â Â Â Â Â Â Â ÂunitPrice:- Unit price details, including amount, currency, and VAT.quantity:- Total quantity of items in the order.totalAmount:- Total amount details, including amount, currency, and VAT.
quaraCheckout Response Body :
{
"Error": {},
"Response": {
"reference": "",
"orderId": "",
"checkoutUrl": "",
"poNumber": "",
"message": ""
}
}reference:- A unique reference identifier for the transaction.orderId:- The order ID associated with the transaction.checkoutUrl:- The URL for the checkout, used for redirecting the user to the payment page.poNumber:- The purchase order number associated with the transaction.message:- If there are any error.
2. getOrderStatus
getOrderStatus response Body :
{
"Error": { },
"Response": {
"orderId": "",
"status": "",
"statusCode": "",
"subStatus": "",
"statusUpdateDate": "",
"createDate": ""
}
}orderID:- The order ID associated with the transaction.status:- Different stages status like (PENDING, PROCESSING,COMPLETED,ETC).statusCode:- This is associated with the status in which the current order is there.subStatus:- Detailed description of the current status exactly in which stage the order is there.statusUpdateDate:- Last status updated date.createDate:- When the order was created.
3. checkoutRefund
checkoutRefund Body :
{
"reference": "",
"orderId": "",
"remarks": "",
"refundInvoiceDoc": ""
}reference:- A unique reference identifier for the transaction.orderId:- The order ID associated with the transaction.remarks:- Reason for the order cancellation.refundInvoiceDoc:- Base64 pdf doc.
checkoutRefund response Body:
{
"Error": {},
"Response": {
"reference": "",
"orderId": "",
"refundStatus": "",
"error": "",
"status": ""
}
}reference:- A unique reference identifier for the transaction.orderId:- The order ID associated with the transaction.refundStatus:- Whether the refund was successful or not.error: Error occurred when the refund request was made.status:- Refund Status.
4.orderConfirmation
orderConfirmation request body:
{
"referenceNumber": "",
"invoiceNumber": ""
}referenceNumber:- A unique reference identifier for the order.orderId:- The order ID associated with the transaction.
orderConfirmation response body:
{
"Error":{},
"Response":{
"referenceNumber": "",
"invoiceNumber": "",
"totalPrice": "",
"contractSigned": true,
"promissoryNoteAccepted": true,
"errorMessage": {}
}
}referenceNumber:- A unique reference identifier for the transaction.invoiceNumber:- The invoiceNumber associated with the transaction.totalPrice:- Total order price.errorMessage: Error object occurred when the confirmation request was made.contractSigned:- boolean field to check if contract was signed.promissoryNoteAccepted:- boolean field to check if EPromissory note was accepted.
4.downloadPO
downloadPO request url: {{app_url}}/api/order/merchant/downloadPO/{referenceNumber}
referenceNumber:- A unique reference identifier for the transaction.
downloadPO response body:
{
"Error":{},
"Response":{
{
"PONumber": "",
"PODocument": "",
"error": {},
"status": ""
}
}
}PONumber:- A unique PO number received while creating the order.PODocument:- Base64 string of PO pdf document.status: Status of the transaction.
Versions:
1.0.0
