Admin Class

The Admin class provides an interface for interacting with the Paymenter API, allowing administrators to manage 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 Admin class, configure your panel URL and API key.

const { Admin } = require("paymenter-api"); const panelUrl = "https://panel.example.com"; const apiKey = "YOUR_API_KEY"; 

Ticket Management

The Admin.Ticket class provides methods for handling support tickets.

Create a Ticket

await Admin.Ticket.create({ panel: panelUrl, apikey: apiKey, title: "Support Request", message: "I need help with my account.", priority: "high", userId: 21 }); 

Get Ticket by ID

const ticket = await Admin.Ticket.getById({ panel: panelUrl, apikey: apiKey, ticketId: "123" }); 

Reply to a Ticket

await Admin.Ticket.reply({ panel: panelUrl, apikey: apiKey, ticketId: "123", message: "We have resolved your issue." }); 

Change Ticket Status

await Admin.Ticket.changeStatus({ panel: panelUrl, apikey: apiKey, ticketId: "123", status: "closed" }); 

Get All Tickets

const tickets = await Admin.Ticket.getAll({ panel: panelUrl, apikey: apiKey }); 

Get All Messages from a Ticket

const messages = await Admin.Ticket.getAllMessages({ panel: panelUrl, apikey: apiKey, ticketId: "123" }); 

Invoice Management

The Admin.Invoice class provides methods for handling invoices.

Get Invoice by ID

const invoice = await Admin.Invoice.getById({ panel: panelUrl, apikey: apiKey, invoiceId: "456" }); 

Pay an Invoice

await Admin.Invoice.pay({ panel: panelUrl, apikey: apiKey, invoiceId: "456", payment_method: "credit_card" }); 

Get All Invoices

const invoices = await Admin.Invoice.getAll({ panel: panelUrl, apikey: apiKey });