@busha/commerce-js 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -2
- package/dist/types.d.ts +3 -0
- package/package.json +1 -1
- package/src/types.ts +4 -0
package/README.md
CHANGED
|
@@ -32,7 +32,7 @@ import BushaCommerce from "@busha/commerce-js";
|
|
|
32
32
|
|
|
33
33
|
```javascript
|
|
34
34
|
const payload = {
|
|
35
|
-
reference: `ref_${new Date().getTime()}`, // optional
|
|
35
|
+
reference: `ref_${new Date().getTime()}`, // optional; will be auto-generated if nothing is passed
|
|
36
36
|
public_key: "[YOUR PUBLISHABLE KEY]",
|
|
37
37
|
quote_amount: "2000", // required: amount to charge
|
|
38
38
|
quote_currency: "NGN", // required: currency for the quote amount (e.g., "NGN", "USD")
|
|
@@ -40,13 +40,15 @@ const payload = {
|
|
|
40
40
|
source_currency: "NGN", // required: source currency
|
|
41
41
|
callback_url: "https://your-domain.com/callback", // optional: webhook callback URL
|
|
42
42
|
meta: { email: "email@example.com", name: "Busha" }, // optional: customer info
|
|
43
|
-
devMode: true, // optional
|
|
43
|
+
devMode: true, // optional; defaults to false
|
|
44
44
|
onClose: (d) => {
|
|
45
45
|
console.log("Payment cancelled!", d);
|
|
46
46
|
},
|
|
47
47
|
onSuccess: (d) => {
|
|
48
48
|
console.log(d);
|
|
49
49
|
},
|
|
50
|
+
source: "payment-link", // optional
|
|
51
|
+
source_id: "18937r13gufbqwe", // optional
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
BushaCommerce(payload);
|
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export type MessageType = {
|
|
|
2
2
|
status: string;
|
|
3
3
|
data?: any;
|
|
4
4
|
};
|
|
5
|
+
export type SourceType = "payment-link";
|
|
5
6
|
export interface BushaCommercePayload {
|
|
6
7
|
quote_amount: string;
|
|
7
8
|
quote_currency: string;
|
|
@@ -16,4 +17,6 @@ export interface BushaCommercePayload {
|
|
|
16
17
|
devMode?: boolean;
|
|
17
18
|
onClose?: (d?: any) => void;
|
|
18
19
|
onSuccess: (d?: any) => void;
|
|
20
|
+
source?: SourceType;
|
|
21
|
+
source_id?: string;
|
|
19
22
|
}
|
package/package.json
CHANGED
package/src/types.ts
CHANGED
|
@@ -3,6 +3,8 @@ export type MessageType = {
|
|
|
3
3
|
data?: any;
|
|
4
4
|
};
|
|
5
5
|
|
|
6
|
+
export type SourceType = "payment-link";
|
|
7
|
+
|
|
6
8
|
export interface BushaCommercePayload {
|
|
7
9
|
quote_amount: string;
|
|
8
10
|
quote_currency: string;
|
|
@@ -17,4 +19,6 @@ export interface BushaCommercePayload {
|
|
|
17
19
|
devMode?: boolean;
|
|
18
20
|
onClose?: (d?: any) => void;
|
|
19
21
|
onSuccess: (d?: any) => void;
|
|
22
|
+
source?: SourceType;
|
|
23
|
+
source_id?: string;
|
|
20
24
|
}
|