A Node.js API wrapper for interacting with the Paymenter API. This package provides an easy-to-use interface for managing tickets, invoices, and other related features for both clients and admins.
You can install this wrapper via npm:
npm install @cptcr/paymenter-api
import { Admin, Client } from "@cptcr/paymenter-api";
// Example: Create a new ticket as a client
const newTicket = await Client.Ticket.create({
panel: "https://yourshop.com", // The domain for your Paymenter shop
apikey: "clientApiKey", // Your client API key
title: "Test Ticket", // The title of the ticket
description: "Hello, this is a test ticket.", // First message in the ticket
priority: "high" // Ticket priority (high, low, or medium)
});
console.log(newTicket); // Logs the response from the API after creating the ticket
// Import the Paymenter API wrapper
const { Admin, Client } = require("@cptcr/paymenter-api");
// Example: Create a new ticket as a client
Client.Ticket.create({
panel: "https://yourshop.com", // The domain for your Paymenter shop
apikey: "clientApiKey", // Your client API key
title: "Test Ticket", // The title of the ticket
description: "Hello, this is a test ticket.", // First message in the ticket
priority: "high" // Ticket priority (high, low, or medium)
}).then(newTicket => {
console.log(newTicket); // Logs the response from the API
});
const newAdminTicket = await Admin.Ticket.create({
panel: "https://yourshop.com", // Shop domain URL
apikey: "adminApiKey", // Admin API key
title: "New Admin Ticket", // Ticket title
message: "This is an admin-created ticket.", // First message
priority: "medium", // Priority level
userId: 1234 // User ID creating the ticket
});
console.log(newAdminTicket); // Logs the response from the API
const ticketDetails = await Admin.Ticket.getById({
panel: "https://yourshop.com", // Shop domain URL
apikey: "adminApiKey", // Admin API key
ticketId: "ticket1234" // Ticket ID to retrieve
});
console.log(ticketDetails); // Logs ticket details retrieved from the API
const replyResponse = await Admin.Ticket.reply({
panel: "https://yourshop.com", // Shop domain URL
apikey: "adminApiKey", // Admin API key
ticketId: "ticket1234", // Ticket ID to reply to
message: "This is an admin reply." // Message content
});
console.log(replyResponse); // Logs the reply response from the API
const changeStatusResponse = await Admin.Ticket.changeStatus({
panel: "https://yourshop.com", // Shop domain URL
apikey: "adminApiKey", // Admin API key
ticketId: "ticket1234", // Ticket ID to change status
status: "closed" // New status ("open" or "closed")
});
console.log(changeStatusResponse); // Logs the response from the API
const allTickets = await Admin.Ticket.getAll({
panel: "https://yourshop.com", // Shop domain URL
apikey: "adminApiKey" // Admin API key
});
console.log(allTickets); // Logs a list of all tickets from the API
const messages = await Admin.Ticket.getAllMessages({
panel: "https://yourshop.com", // Shop domain URL
apikey: "adminApiKey", // Admin API key
ticketId: "ticket1234" // Ticket ID
});
console.log(messages); // Logs all messages from the ticket
This package is developed and maintained by cptcr and is not affiliated with the official Paymenter API.