@edutecka-mz/edpay-sdk 1.0.1 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +12 -1
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -50,14 +50,25 @@ console.log(payment);
50
50
 
51
51
  By default, the client uses `https://api-pay.edutecka.com`; set `baseUrl` only when EDPay provides a different API host for your account. Sandbox or production access is determined by the API keys. The client sends `X-EDPay-Public-Key` and `X-EDPay-Private-Key` headers. `idempotencyKey` is sent as the `Idempotency-Key` header. Payment amounts are expressed in minor currency units. The `method` is dynamic and should be an identifier returned by `GET /v1/public/payment-methods` or otherwise supported for the account; do not hard-code a particular gateway into a multi-gateway flow.
52
52
 
53
- Browser checkout helpers are available from the frontend-only entry point. Use a public key only; never bundle a private key into browser code:
53
+ ### Browser checkout (frontend only)
54
+
55
+ `EDPay` is the browser checkout helper. It is separate from the server-side `EDPayClient` instance named `edpay` above. Use a public key only; never bundle a private key into browser code. Pass the checkout token created by your server:
54
56
 
55
57
  ```typescript
56
58
  import { EDPay } from "@edutecka-mz/edpay-sdk/frontend";
59
+
60
+ const checkoutClient = new EDPay({
61
+ publicKey: process.env.NEXT_PUBLIC_EDPAY_PUBLIC_KEY!,
62
+ environment: "sandbox",
63
+ });
64
+
65
+ checkoutClient.checkout({ token: checkoutToken, mode: "redirect" });
57
66
  ```
58
67
 
59
68
  To retrieve a payment:
60
69
 
70
+ Use the server-side `edpay` (`EDPayClient`) instance created in the first example:
71
+
61
72
  ```typescript
62
73
  const payment = await edpay.payments.retrieve("PAYMENT_ID");
63
74
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edutecka-mz/edpay-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Official EDPay SDK for Node.js and TypeScript with multi-gateway payments, hosted checkout, and webhook verification.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",