@spot-flow/vue-spotflow-checkout
Version:
This **Spotflow Vue.js library** wraps around the [inline library](https://github.com/Spotflow-One/spotflow-checkout-inline), which enables users to make payments seamlessly. It integrates smoothly into your Vue.js application, providing a streamlined ch
84 lines (83 loc) • 1.96 kB
JavaScript
import { openBlock as i, createElementBlock as l, renderSlot as u } from "vue";
const s = {
name: "VueSpotflow",
props: {
merchantKey: {
type: String,
required: !0
},
email: {
type: String,
required: !0
},
amount: {
type: Number,
required: !0
},
encryptionKey: {
type: String,
required: !0
},
planId: {
type: String,
required: !0
},
currency: {
type: String
},
localCurrency: {
type: String
},
metadata: {
type: Object
},
callBackUrl: {
type: String
}
},
beforeMount() {
function t() {
const e = document.createElement("script"), r = "https://dr4h9151gox1m.cloudfront.net/dist/checkout-inline.js";
e.src = r, e.onload = () => {
}, document.querySelector(`[src="${r}"]`) || document.head.appendChild(e);
}
t();
},
methods: {
makePayment() {
if (this.merchantKey === void 0 || this.email === void 0 || this.encryptionKey === void 0)
throw new Error("Merchant key, Email and Encryption key are required");
const t = window.SpotflowCheckout;
if (t) {
const e = {
merchantKey: this.merchantKey,
encryptionKey: this.encryptionKey,
planId: this.planId,
email: this.email,
amount: this.amount || 0,
currency: this.currency,
localCurrency: this.localCurrency,
metadata: this.metadata,
callBackUrl: this.callBackUrl
};
new t.CheckoutForm(e).setup(e);
}
}
}
}, y = (t, e) => {
const r = t.__vccOpts || t;
for (const [n, o] of e)
r[n] = o;
return r;
};
function d(t, e, r, n, o, c) {
return i(), l("button", {
onClick: e[0] || (e[0] = (...a) => c.makePayment && c.makePayment(...a))
}, [
u(t.$slots, "default")
]);
}
const m = /* @__PURE__ */ y(s, [["render", d]]);
export {
m as default
};