Client Class
The Client class provides an interface for interacting with the Paymenter API, allowing users to manage their support tickets and invoices.
Written By Cptcr
Last updated 12 months ago
Prerequisites
Node.js (>=14.x recommended)
A valid API key from your Paymenter panel
The base URL of your Paymenter panel
Setup Configuration
Before using the Client class, configure your panel URL and API key.
const { Client } = require("paymenter-api"); const panelUrl = "https://panel.example.com"; const apiKey = "YOUR_API_KEY"; Ticket Management
The Client.Ticket class provides methods for handling support tickets.
Create a Ticket
await Client.Ticket.create({ panel: panelUrl, apikey: apiKey, title: "Support Request", description: "I need help with my account.", priority: "high" }); Get Ticket by ID
const ticket = await Client.Ticket.getById({ panel: panelUrl, apikey: apiKey, ticketId: "123" }); Delete a Ticket by ID
await Client.Ticket.deleteById({ panel: panelUrl, apikey: apiKey, ticketId: "123" }); Reply to a Ticket
await Client.Ticket.reply({ panel: panelUrl, apikey: apiKey, ticketId: "123", message: "I still need assistance." }); Get All Tickets
const tickets = await Client.Ticket.getAll({ panel: panelUrl, apikey: apiKey }); Get All Messages from a Ticket
const messages = await Client.Ticket.getMessages({ panel: panelUrl, apikey: apiKey, ticketId: "123" }); Invoice Management
The Client.Invoice class provides methods for handling invoices.
Get Invoice by ID
const invoice = await Client.Invoice.getById({ panel: panelUrl, apikey: apiKey, invoiceId: "456" }); Get All Invoices
const invoices = await Client.Invoice.getAll({ panel: panelUrl, apikey: apiKey });