gembapay 1.0.1 → 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 CHANGED
@@ -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/ORDER-123
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gembapay",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
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",
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.0.0';
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 payment details
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>} Payment details
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
- return this._request('GET', `/api/customer/payment/${encodeURIComponent(orderId)}`);
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/customer/payment/${encodeURIComponent(orderId)}/status`);
80
+ return this._request('GET', `/api/merchant/payment-status/${encodeURIComponent(orderId)}`);
78
81
  }
79
82
 
80
83
  // ── Merchant ─────────────────────────────────────────