KiraPay API with Next.js
1. Setup Next.js Project
npx create-next-app@latest kirapay-api
cd kirapay-api2. 🔑 API Key Configuration
NEXT_PUBLIC_KIRAPAY_API_KEY=your_api_key_here3. 📦 Create Type Definitions
export interface CreateLinkRequest {
currency: string;
receiver: string;
price: number;
name: string;
redirectUrl?: string;
}
export interface CreateLinkResponse {
message: string;
data: {
url: string;
};
}
export interface PaymentLink {
_id: string;
code: string;
price: number;
name: string;
url: string;
receiver: string;
createdAt: string;
}
export interface GetLinksResponse {
message: string;
data: {
links: PaymentLink[];
total: number;
page: number;
totalPages: number;
};
}
export interface GetLinkByCodeResponse {
message: string;
data: PaymentLink;
}
export interface Transaction {
_id: string;
transaction_hash: string;
status: "PENDING" | "COMPLETED" | "FAILED" | "CANCELLED";
amount: number;
createdAt: string;
}
export interface GetTransactionsResponse {
message: string;
data: {
transactions: Transaction[];
total: number;
};
}4. ⚙️ API Functions
🔹 Create Payment Link
🔹 Get All Payment Links
🔹 Get Payment Link by Code
🔹 Get Transactions
✅ Complete API File
5. 💻 Create Simple UI
6. ▶️ Run the Application
📘 API Endpoints Summary
Endpoint
Method
Auth Required
Description
Last updated
Was this helpful?