UNPKG

node-beamcheckout

Version:
22 lines (21 loc) 949 B
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; } }