node-beamcheckout
Version:
Package for Beam Checkout
22 lines (21 loc) • 949 B
JavaScript
import axios from "axios";
export class BeamCheckout {
constructor(merchantId, apiKey) {
this.merchantId = merchantId;
this.apiKey = apiKey;
}
merchantId;
apiKey;
async createPayment(args) {
const { data } = await axios.post(`https://partner-api.beamdata.co/purchases/${this.merchantId}`, args, { auth: { username: this.merchantId, password: this.apiKey } });
return data;
}
async getPayment(purchaseId) {
const { data } = await axios.get(`https://partner-api.beamdata.co/purchases/${this.merchantId}/${purchaseId}/detail`, { auth: { username: this.merchantId, password: this.apiKey } });
return data;
}
async disablePayment(purchaseId) {
const { data } = await axios.post(`https://partner-api.beamdata.co/purchases/${this.merchantId}/${purchaseId}/disable`, {}, { auth: { username: this.merchantId, password: this.apiKey } });
return data;
}
}