Skip to content

A Node.js API wrapper for interacting with the https://paymenter.org. This package provides an easy-to-use interface for managing tickets, invoices, and other related features for both clients and admins.

License

Notifications You must be signed in to change notification settings

cptcr/paymenter-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Paymenter API Wrapper

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.

Official Documentation

Installation

You can install this wrapper via npm:

npm install @cptcr/paymenter-api

Usage

TypeScript Example

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

JavaScript Example

// 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
});

More Usage Examples

Admin: Ticket Operations

1. Create a New Ticket (Admin)

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

2. Get Ticket by ID (Admin)

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

3. Reply to a Ticket (Admin)

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

4. Change Ticket Status (Admin)

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

5. Get All Tickets (Admin)

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

6. Get All Messages from a Ticket (Admin)

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

Disclaimer

This package is developed and maintained by cptcr and is not affiliated with the official Paymenter API.

About

A Node.js API wrapper for interacting with the https://paymenter.org. This package provides an easy-to-use interface for managing tickets, invoices, and other related features for both clients and admins.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published