This is a JavaScript wrapper for the Paymenter API, providing easy access to various endpoints for managing tickets and invoices.
To use this wrapper, you can include it in your project using npm:
npm install paymenterjs
const { PaymenterAPI } = require('paymenterjs');
const paymenterApi = new PaymenterAPI(process.env.PANEL, process.env.APIKEY); // Panel URL & API Key
Get all tickets.
const tickets = await paymenterApi.getTickets();
console.log(tickets);
{
"success": true,
"message": "Ticket successfully retrieved.",
"data": {
"ticket": {
"id": 2,
"title": "New ticket",
"status": "open",
"priority": "high",
"order_id": null,
"assigned_to": null,
"created_at": "2023-04-15T12:35:21.000000Z",
"updated_at": "2023-04-15T12:35:21.000000Z"
}
}
}
Get a ticket by ID.
const ticket = await paymenterApi.getTicket(ticketId);
console.log(ticket);
{
"id": 2,
"title": "New ticket",
"status": "open",
"priority": "high",
"order_id": null,
"assigned_to": null,
"created_at": "2023-04-15T12:35:21.000000Z",
"updated_at": "2023-04-15T12:35:21.000000Z"
}
Post a response to an active ticket.
const response = await paymenterApi.replyToTicket(ticketId, message);
console.log(response);
{
"success": true,
"message": "Message successfully sent."
}
Create a new ticket.
const response = await paymenterApi.createTicket(title, message, priority);
console.log(response);
{
"success": true,
"message": "Ticket successfully created.",
"data": {
"ticket": {
"id": 2,
"title": "New ticket",
"status": "open",
"priority": "high",
"order_id": null,
"assigned_to": null,
"created_at": "2023-04-15T12:35:21.000000Z",
"updated_at": "2023-04-15T12:35:21.000000Z"
}
}
}
Get messages from a ticket.
const messages = await paymenterApi.getTicketMessages(ticketId);
console.log(messages);
Delete a ticket.
const response = await paymenterApi.deleteTicket(ticketId);
console.log(response);
Get all invoices.
const invoices = await paymenterApi.getAllInvoices();
console.log(invoices);
Get an invoice by ID.
const invoice = await paymenterApi.getInvoice(invoiceId);
console.log(invoice);
Pay an invoice.
const response = await paymenterApi.payInvoice(invoiceId, method);
console.log(response);
Get token permissions .
const response = await paymenterApi.getPermissions();
console.log(response);
This project is licensed under the MIT License - see the LICENSE file for details.