bởi pip

Official Node.js SDK for integrating Xendit's REST API, supporting invoices, payment requests, refunds, payouts, and more. Ideal for backend developers building payment flows in Node or TypeScript.
This block provides the official Xendit Node.js/TypeScript SDK (user@example.com), wrapping Xendit's REST API for payments, invoices, customers, refunds, payouts, and transactions. It ships typed API classes for every product domain and is aimed at Node.js backend services processing payments in Southeast Asian markets.
.github/ - CI workflows for release tagging and status updatesbalance_and_transaction/ - Balance and Transaction API classes plus typed modelscustomer/ - Customer API class and full customer/identity modelsdocs/ - Markdown API reference for each product moduleimages/ - Static assets for documentationinvoice/ - Invoice API class and modelspayment_method/ - PaymentMethod API class and modelspayment_request/ - PaymentRequest API class and modelspayout/ - Payout API class and modelsrefund/ - Refund API class and models.eslintrc.json - ESLint configuration for the SDK sourceREADME.md - Installation, authorization, and module indexindex.ts - Root entry: exports Xendit class and all sub-clientspackage.json - Package manifest and build metadataruntime.ts - Shared HTTP runtime used by all API classestsconfig.json - TypeScript compiler configurationnpm install user@example.com
No native modules, no pod install, no Android linking, no Expo prebuild steps required. Node 18.0 or later is required.
source/ directory into your project, e.g. src/xendit/.tsconfig.json, ensure your paths or baseUrl resolves the source root if you are importing locally rather than from node_modules:
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"xendit-node": ["src/xendit/index.ts"]
}
}
}
Khởi chạy sandbox cách ly và chạy phía máy chủ — không cần cài đặt cục bộ.
Tetrees AI Review cho phiên bản này
This TypeScript cli / script completed archive review with strong static results. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Quy trình avcp-2026-08-04.1 · SHA-256 1f6eb9acba5e32d3…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Đã đánh giá 4 thg 8, 2026
Đưa sản phẩm này thẳng vào AI IDE, trình tạo web hoặc cloud IDE của bạn.
Kết nối Tetrees với AI IDE tương thích để liệt kê sản phẩm bạn sở hữu và nhận ZIP đã xác minh mà không cấp quyền tải lên của người bán.
Chưa có đánh giá.
Sign in to join the discussion
Loading discussion…
export XENDIT_SECRET_KEY=xnd_production_xxxxxxxxxxxx
lib/xendit.ts):
import { Xendit } from 'xendit-node';
export const xendit = new Xendit({
secretKey: process.env.XENDIT_SECRET_KEY!,
});
const { Invoice, Customer, PaymentRequest } = xendit;
export interface XenditOpts {
secretKey: string;
xenditURL?: string;
}
export class Xendit {
opts: XenditOpts;
Customer: Customer;
PaymentRequest: PaymentRequest;
Transaction: Transaction;
Balance: Balance;
PaymentMethod: PaymentMethod;
Refund: Refund;
Payout: Payout;
Invoice: Invoice;
constructor(opts: XenditOpts): Xendit;
}
The root class. Instantiate it once with your secret key and access all product clients as properties. Pass xenditURL to override the default https://api.xendit.co endpoint (useful for local mock servers or staging environments).
export class Balance {
// Exported as BalanceApi internally, re-exported as Balance
}
import { Balance } from 'xendit-node';
Provides access to the merchant's account balance. Use xendit.Balance to retrieve available, pending, and held balance figures without constructing the class manually.
export class Transaction {
// Exported as TransactionApi internally, re-exported as Transaction
}
import { Transaction } from 'xendit-node';
Provides transaction listing and retrieval. Use xendit.Transaction to query transaction history with date-range filters, channel categories, and pagination — model types like TransactionResponse and TransactionsResponse are exported from balance_and_transaction/models/.
export class Customer {
// Exported as CustomerApi internally, re-exported as Customer
}
import { Customer } from 'xendit-node';
Manages end-customer records including KYC documents, identity accounts, and address data. Use xendit.Customer to create, retrieve, patch, and look up customers by reference ID.
Create one shared Xendit instance and fetch the merchant's balance. This is typically done in a health-check endpoint or a billing dashboard.
import { Xendit } from 'xendit-node';
const xendit = new Xendit({
secretKey: process.env.XENDIT_SECRET_KEY!,
});
async function getBalance() {
const balance = await xendit.Balance.getBalance({
currency: 'IDR',
});
console.log('Available balance:', balance);
}
getBalance().catch(console.error);
Before processing a payment request you may need to register a customer. Use the Customer client to create and later retrieve the record by your own reference ID.
import { Xendit } from 'xendit-node';
import type { CustomerRequest } from 'xendit-node';
const xendit = new Xendit({
secretKey: process.env.XENDIT_SECRET_KEY!,
});
async function createCustomer() {
const payload: CustomerRequest = {
referenceId: 'cust-001',
type: 'INDIVIDUAL',
individualDetail: {
givenNames: 'Jane',
surname: 'Doe',
},
email: 'jane.doe@example.com',
mobileNumber: '+6281234567890',
};
const customer = await xendit.Customer.createCustomer({
customerRequest: payload,
});
console.log('Created customer ID:', customer.id);
return customer;
}
createCustomer().catch(console.error);
Fetch a page of transactions between two dates, filtered by type. Use this in reconciliation jobs or finance reporting features.
import { Xendit } from 'xendit-node';
const xendit = new Xendit({
secretKey: process.env.XENDIT_SECRET_KEY!,
xenditURL: process.env.XENDIT_URL ?? 'https://api.xendit.co',
});
async function listTransactions() {
const response = await xendit.Transaction.getAllTransactions({
currency: 'IDR',
afterId: undefined,
beforeId: undefined,
limit: 20,
types: ['PAYMENT'],
statuses: ['SUCCESS'],
channelCategories: ['VIRTUAL_ACCOUNT'],
referenceId: undefined,
productId: undefined,
accountIdentifier: undefined,
amount: undefined,
from: new Date('2024-01-01'),
to: new Date('2024-01-31'),
});
for (const tx of response.data ?? []) {
console.log(tx.id, tx.status, tx.amount, tx.currency);
}
}
listTransactions().catch(console.error);
index.ts - Root barrel: instantiates Xendit class, wires all sub-clients, and re-exports every public symbol.runtime.ts - Shared HTTP fetch/configuration layer used internally by every API class; not called directly by consumers.package.json - Declares package name xendit-node, version 7.0.0, entry points, and TypeScript typings.tsconfig.json - TypeScript config targeting the SDK build; extend or reference this when consuming source directly.balance_and_transaction/ - Contains BalanceApi and TransactionApi classes plus all balance/transaction model types.customer/ - Contains CustomerApi and the full suite of customer, KYC, and identity account models.invoice/ - Contains InvoiceApi and invoice-related request/response models.payment_method/ - Contains PaymentMethodApi for creating and managing stored payment methods.payment_request/ - Contains PaymentRequestApi for initiating payment flows.payout/ - Contains PayoutApi for disbursement operations.refund/ - Contains RefundApi for issuing and tracking refunds.docs/ - Per-module Markdown references (Invoice.md, Balance.md, etc.) documenting available methods.xnd_development_ or xnd_production_; any other prefix logs an error and calls may be rejected. Double-check .env values.fetch; running on Node 16 or below will throw. Pin "node": ">=18" in engines and use nvm use 18."type": "module", ensure your bundler or ts-node config handles the SDK's CJS output; use "esModuleInterop": true in tsconfig.json.xenditURL not overriding in tests - Pass xenditURL explicitly to the constructor; the default is hard-coded to https://api.xendit.co and environment variables do not override it automatically.node_modules, add the paths mapping in tsconfig.json as shown in Project Setup, otherwise import { Xendit } from 'xendit-node' will resolve the npm package instead of your local copy.instanceof checks. Use discriminant properties instead.I have dropped the xendit-node SDK source into `src/xendit/` in my project.
Read `src/xendit/USAGE.md` and `src/xendit/index.ts` carefully.
The upstream npm package is `user@example.com`.
Please integrate the Xendit SDK into my project step by step:
1. Add a shared Xendit client in `src/lib/xendit.ts` using the `Xendit` class
exported from `src/xendit/index.ts`, reading the secret key from
`process.env.XENDIT_SECRET_KEY`.
2. Wire `tsconfig.json` paths so `import ... from 'xendit-node'` resolves to
`src/xendit/index.ts`.
3. Create a service file for the feature I describe below, importing only
the relevant domain client (e.g. `xendit.Invoice`, `xendit.Customer`).
4. Add proper TypeScript types using the model interfaces exported by the SDK.
5. Handle errors thrown by the SDK and return structured error responses.
Feature to implement: [DESCRIBE YOUR FEATURE HERE]
Do not invent any method names or model shapes. Only use symbols visible in
`src/xendit/index.ts` and the relevant `*/apis/*.ts` and `*/models/*.ts` files.
See source/LICENSE if present for the full license text. This block is based on the official xendit-node package version 7.0.0 published by Xendit. Refer to the Xendit API Reference and Xendit Docs for endpoint-level documentation.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
Hướng dẫn cài đặt đầy đủ và prompt tích hợp sẽ mở khóa sau khi mua.
Automation, Utilities & Developer Tools
Miễn phí