pesapal-node-sdk
Version:
Node.js SDK for integrating with Pesapal payment gateway. Provides a simple interface for processing payments, checking status, and handling callbacks.
24 lines • 902 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.PaymentService = void 0;
class PaymentService {
constructor(auth, http, config) {
this.auth = auth;
this.http = http;
this.config = config;
}
async submitOrder(payment) {
const token = await this.auth.authenticate();
return this.http.post('/v3/api/Transactions/SubmitOrderRequest', {
...payment,
callback_url: payment.callbackUrl || this.config.callbackUrl,
notification_id: payment.notificationId || this.config.ipnUrl
}, token);
}
async getPaymentStatus(orderId) {
const token = await this.auth.authenticate();
return this.http.get(`/v3/api/Transactions/GetTransactionStatus?orderId=${orderId}`, token);
}
}
exports.PaymentService = PaymentService;
//# sourceMappingURL=PaymentService.js.map