gembapay 1.0.0 → 1.1.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 +9 -8
- package/package.json +2 -2
- package/src/index.js +10 -7
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
**Unified payment gateway for crypto, cards, and PayPal.**
|
|
4
4
|
|
|
5
|
-
Accept ETH, BNB, POL, USDC, USDT, credit cards (via Stripe), and PayPal through a single API. Non-custodial crypto payments — funds go directly to your wallet via smart
|
|
5
|
+
Accept ETH, BNB, POL, USDC, USDT, credit cards (via Stripe), and PayPal through a single API. Non-custodial crypto payments — funds go directly to your wallet via smart contract.
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/gembapay)
|
|
8
8
|
[](https://opensource.org/licenses/MIT)
|
|
@@ -43,7 +43,7 @@ const payment = await gembapay.createPayment({
|
|
|
43
43
|
});
|
|
44
44
|
|
|
45
45
|
console.log(payment.paymentUrl);
|
|
46
|
-
// → https://payment.gembapay.com/checkout/
|
|
46
|
+
// → https://payment.gembapay.com/checkout/3f9c1e7a-2b4d-4c8e-9f10-a2b3c4d5e6f7
|
|
47
47
|
|
|
48
48
|
console.log(payment.allowedMethods);
|
|
49
49
|
// → ['crypto', 'stripe', 'paypal']
|
|
@@ -62,6 +62,7 @@ const payment = await gembapay.createPayment({
|
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
// Redirect customer to unified checkout
|
|
65
|
+
// Redirect to payment.paymentUrl as-is (unguessable token, not your orderId)
|
|
65
66
|
res.redirect(payment.paymentUrl);
|
|
66
67
|
```
|
|
67
68
|
|
|
@@ -134,7 +135,7 @@ const gembapay = new GembaPay({
|
|
|
134
135
|
console.log(gembapay.isTestMode); // true
|
|
135
136
|
```
|
|
136
137
|
|
|
137
|
-
Claim free test tokens at [Developer Resources](https://
|
|
138
|
+
Claim free test tokens at [Developer Resources](https://gembapay.com/developers).
|
|
138
139
|
|
|
139
140
|
## Express.js Example
|
|
140
141
|
|
|
@@ -178,7 +179,7 @@ app.listen(3000);
|
|
|
178
179
|
|
|
179
180
|
| Option | Type | Required | Description |
|
|
180
181
|
|--------|------|----------|-------------|
|
|
181
|
-
| `apiKey` | `string` | ✓ | API key from [Merchant Dashboard](https://merchant.gembapay.com) |
|
|
182
|
+
| `apiKey` | `string` | ✓ | API key from [Merchant Dashboard](https://merchant-dashboard.gembapay.com) |
|
|
182
183
|
| `webhookSecret` | `string` | | Webhook signing secret |
|
|
183
184
|
| `baseUrl` | `string` | | Custom API URL (default: `https://api.gembapay.com`) |
|
|
184
185
|
| `timeout` | `number` | | Request timeout in ms (default: `30000`) |
|
|
@@ -206,11 +207,11 @@ app.listen(3000);
|
|
|
206
207
|
|
|
207
208
|
## Links
|
|
208
209
|
|
|
209
|
-
- [Documentation](https://
|
|
210
|
-
- [Merchant Dashboard](https://merchant.gembapay.com)
|
|
211
|
-
- [Integration Guide](https://
|
|
210
|
+
- [Documentation](https://gembapay.com/docs)
|
|
211
|
+
- [Merchant Dashboard](https://merchant-dashboard.gembapay.com)
|
|
212
|
+
- [Integration Guide](https://gembapay.com/integration)
|
|
212
213
|
- [GitHub](https://github.com/ivanovslavy/gembapay)
|
|
213
|
-
- [Developer Resources](https://
|
|
214
|
+
- [Developer Resources](https://gembapay.com/developers)
|
|
214
215
|
|
|
215
216
|
## Support
|
|
216
217
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gembapay",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "GembaPay — Unified payment gateway for crypto (ETH, BNB, POL, USDC, USDT), Stripe, and PayPal. Non-custodial
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "GembaPay — Unified payment gateway for crypto (ETH, BNB, POL, USDC, USDT), Stripe, and PayPal. Non-custodial payments.",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "src/index.d.ts",
|
|
7
7
|
"files": [
|
package/src/index.js
CHANGED
|
@@ -4,7 +4,7 @@ const https = require('https');
|
|
|
4
4
|
const crypto = require('crypto');
|
|
5
5
|
|
|
6
6
|
const BASE_URL = 'https://api.gembapay.com';
|
|
7
|
-
const VERSION = '1.
|
|
7
|
+
const VERSION = '1.1.0';
|
|
8
8
|
|
|
9
9
|
class GembaPayError extends Error {
|
|
10
10
|
constructor(message, statusCode, code) {
|
|
@@ -58,23 +58,26 @@ class GembaPay {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
/**
|
|
61
|
-
* Get
|
|
61
|
+
* Get full order details for one of YOUR orders (authenticated, ownership-scoped).
|
|
62
|
+
* Includes customerEmail + metadata. Returns 404 for orders that aren't yours.
|
|
63
|
+
* (The public /api/customer/payment endpoint is for the checkout page and omits customer PII.)
|
|
62
64
|
* @param {string} orderId - Order identifier
|
|
63
|
-
* @returns {Promise<Object>}
|
|
65
|
+
* @returns {Promise<Object>} The order (orderId, status, amountUsd, customerEmail, metadata, payment, …)
|
|
64
66
|
*/
|
|
65
67
|
async getPayment(orderId) {
|
|
66
68
|
if (!orderId) throw new GembaPayError('orderId is required', null, 'missing_param');
|
|
67
|
-
|
|
69
|
+
const res = await this._request('GET', `/api/merchant/payment/${encodeURIComponent(orderId)}`);
|
|
70
|
+
return res.order || res;
|
|
68
71
|
}
|
|
69
72
|
|
|
70
73
|
/**
|
|
71
|
-
* Check payment status
|
|
74
|
+
* Check payment status for one of YOUR orders (authenticated, ownership-scoped).
|
|
72
75
|
* @param {string} orderId - Order identifier
|
|
73
|
-
* @returns {Promise<Object>} Payment status
|
|
76
|
+
* @returns {Promise<Object>} Payment status ({ status, orderId, amountUsd, network, completedAt, isTestMode })
|
|
74
77
|
*/
|
|
75
78
|
async getPaymentStatus(orderId) {
|
|
76
79
|
if (!orderId) throw new GembaPayError('orderId is required', null, 'missing_param');
|
|
77
|
-
return this._request('GET', `/api/
|
|
80
|
+
return this._request('GET', `/api/merchant/payment-status/${encodeURIComponent(orderId)}`);
|
|
78
81
|
}
|
|
79
82
|
|
|
80
83
|
// ── Merchant ─────────────────────────────────────────
|