gembapay 1.2.0 → 1.3.0
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 +2 -2
- package/package.json +1 -1
- package/src/index.d.ts +8 -3
- package/src/index.js +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Accept credit cards (via Stripe) and PayPal through a single API. Funds settle d
|
|
|
13
13
|
|
|
14
14
|
- **One API, two payment methods** — Stripe (cards/Apple Pay/Google Pay) and PayPal
|
|
15
15
|
- **Direct settlement** — Payments route straight into your own Stripe or PayPal account
|
|
16
|
-
- **
|
|
16
|
+
- **51+ currencies** — Price in any supported currency
|
|
17
17
|
- **Test mode built-in** — Stripe and PayPal sandbox environments for development
|
|
18
18
|
- **TypeScript support** — Full type definitions included
|
|
19
19
|
- **Zero dependencies** — Uses only Node.js built-in modules
|
|
@@ -71,7 +71,7 @@ res.redirect(payment.paymentUrl);
|
|
|
71
71
|
const status = await gembapay.getPaymentStatus('ORDER-456');
|
|
72
72
|
|
|
73
73
|
console.log(status.status); // 'completed'
|
|
74
|
-
console.log(status.network); // '
|
|
74
|
+
console.log(status.network); // 'stripe', 'paypal'
|
|
75
75
|
```
|
|
76
76
|
|
|
77
77
|
### Webhook Verification
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ declare module 'gembapay' {
|
|
|
15
15
|
orderId: string;
|
|
16
16
|
/** Payment amount */
|
|
17
17
|
amount: number;
|
|
18
|
-
/** Currency code —
|
|
18
|
+
/** Currency code — 51+ supported (default: 'USD') */
|
|
19
19
|
currency?: string;
|
|
20
20
|
/** Payment description */
|
|
21
21
|
description?: string;
|
|
@@ -39,22 +39,27 @@ declare module 'gembapay' {
|
|
|
39
39
|
network: 'stripe' | 'paypal';
|
|
40
40
|
paymentProvider: 'stripe' | 'paypal';
|
|
41
41
|
payment?: {
|
|
42
|
-
|
|
42
|
+
reference?: string;
|
|
43
43
|
tokenSymbol?: string;
|
|
44
44
|
tokenAmount?: string;
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
/** Stripe may add other values over time - treat unknown ones like 'card'. */
|
|
49
|
+
export type PaymentMethod = 'card' | 'apple_pay' | 'google_pay' | 'link' | (string & {});
|
|
50
|
+
|
|
48
51
|
export interface WebhookEvent {
|
|
49
52
|
event: 'payment.completed' | 'payment.failed';
|
|
50
53
|
testMode?: boolean;
|
|
51
54
|
payment: {
|
|
52
55
|
orderId: string;
|
|
53
|
-
|
|
56
|
+
reference?: string;
|
|
54
57
|
network: string;
|
|
55
58
|
usdAmount: number;
|
|
56
59
|
tokenAmount?: string;
|
|
57
60
|
paymentProvider?: string;
|
|
61
|
+
/** How the customer paid. null for PayPal and payments recorded before 2026-10-21. */
|
|
62
|
+
paymentMethod?: PaymentMethod | null;
|
|
58
63
|
};
|
|
59
64
|
timestamp: string;
|
|
60
65
|
}
|
package/src/index.js
CHANGED
|
@@ -43,7 +43,7 @@ class GembaPay {
|
|
|
43
43
|
* @param {Object} params
|
|
44
44
|
* @param {string} params.orderId - Your unique order identifier
|
|
45
45
|
* @param {number} params.amount - Payment amount
|
|
46
|
-
* @param {string} [params.currency='USD'] - Currency code (
|
|
46
|
+
* @param {string} [params.currency='USD'] - Currency code (51+ supported)
|
|
47
47
|
* @param {string} [params.description] - Payment description
|
|
48
48
|
* @returns {Promise<Object>} Payment request with paymentUrl
|
|
49
49
|
*/
|