tbc-rando-sdk 0.1.0 → 0.2.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
@@ -1,244 +1,311 @@
1
- # tbc-rando-sdk
2
-
3
- TypeScript SDK for the [TBC Bank Checkout (TPAY) API](https://developers.tbcbank.ge/docs/checkout-api-overview) — card payments, **installments** and **subscriptions** (recurring payments) for Node.js and Next.js.
4
-
5
- - Zero runtime dependencies (uses the built-in `fetch`, Node ≥ 18.17)
6
- - Automatic access-token caching and refresh (single token request even under concurrent load, transparent retry on 401)
7
- - Typed request/response models with client-side validation before anything hits the network
8
- - Handles TBC's wire-format quirks for you (`returnurl` lowercase, PascalCase `installmentProducts`)
9
- - Webhook/callback helper that plugs straight into a Next.js App Router route
10
-
11
- ## Install
12
-
13
- ```bash
14
- npm install tbc-rando-sdk
15
- ```
16
-
17
- ## Setup
18
-
19
- Credentials come from [developers.tbcbank.ge](https://developers.tbcbank.ge) (app `apikey`) and your TBC E-Commerce merchant dashboard (`client_id` / `client_secret`):
20
-
21
- ```ts
22
- import { TbcCheckoutClient } from 'tbc-rando-sdk';
23
-
24
- const tbc = new TbcCheckoutClient({
25
- apiKey: process.env.TBC_API_KEY!,
26
- clientId: process.env.TBC_CLIENT_ID!,
27
- clientSecret: process.env.TBC_CLIENT_SECRET!,
28
- });
29
- ```
30
-
31
- Create the client once (e.g. in a module) and reuse it — the ~24h access token is cached inside the instance. Server-side only: never expose these credentials to the browser. In Next.js use it in route handlers, server actions or server components.
32
-
33
- ## 1. Standard payment
34
-
35
- ```ts
36
- import { getRedirectUrl } from 'tbc-rando-sdk';
37
-
38
- const payment = await tbc.payments.create({
39
- amount: { currency: 'GEL', total: 49.9 },
40
- returnUrl: 'https://shop.example.ge/checkout/return',
41
- callbackUrl: 'https://shop.example.ge/api/tbc/callback',
42
- merchantPaymentId: 'ORDER-1042',
43
- description: 'Order #1042',
44
- language: 'EN',
45
- });
46
-
47
- // Send the customer to the hosted TBC checkout page:
48
- const checkoutUrl = getRedirectUrl(payment);
49
- ```
50
-
51
- Then check the outcome (from your callback handler or by polling):
52
-
53
- ```ts
54
- import { isFinalPaymentStatus, PaymentStatus } from 'tbc-rando-sdk';
55
-
56
- const details = await tbc.payments.retrieve(payment.payId);
57
- if (details.status === PaymentStatus.Succeeded) {
58
- // fulfill the order
59
- }
60
- isFinalPaymentStatus(details.status); // stop polling when true
61
- ```
62
-
63
- Refunds / cancellations and pre-authorizations:
64
-
65
- ```ts
66
- await tbc.payments.cancel(payId); // full refund
67
- await tbc.payments.cancel(payId, { amount: 10.5 }); // partial refund
68
-
69
- // preAuth: true on create blocks the amount for up to 30 days…
70
- await tbc.payments.completePreAuth(payId, 45.0); // …then capture (≤ blocked amount)
71
- ```
72
-
73
- ## 2. Installments
74
-
75
- Installments are checkout payments restricted to payment method 8. Your merchant account needs an installment `campaignId`/`merchantKey` configured in the TBC back office. The customer picks the terms on TBC's page.
76
-
77
- ```ts
78
- const payment = await tbc.installments.create({
79
- returnUrl: 'https://shop.example.ge/checkout/return',
80
- callbackUrl: 'https://shop.example.ge/api/tbc/callback',
81
- merchantPaymentId: 'ORDER-1043',
82
- products: [
83
- { name: 'Laptop', price: 2199, quantity: 1 },
84
- { name: 'Mouse', price: 89.5, quantity: 2 },
85
- ],
86
- // total is computed as sum(price × quantity) = 2378.00; currency defaults to GEL
87
- });
88
-
89
- const checkoutUrl = getRedirectUrl(payment);
90
- ```
91
-
92
- The SDK validates product lines, computes the total with proper money rounding, and serializes products to the PascalCase wire format TBC expects (`{ Name, Price, Quantity }`).
93
-
94
- ## 3. Subscriptions (recurring payments)
95
-
96
- TBC subscriptions are built on saved cards (card saving must be enabled for your merchant by TBC):
97
-
98
- **Step 1 — the customer pays once and the card is saved:**
99
-
100
- ```ts
101
- const first = await tbc.subscriptions.start({
102
- amount: { currency: 'GEL', total: 9.99 },
103
- returnUrl: 'https://app.example.ge/subscribe/return',
104
- callbackUrl: 'https://app.example.ge/api/tbc/callback',
105
- description: 'Monthly plan',
106
- saveCardToDate: '1230', // optional MMYY limit
107
- });
108
- // redirect the customer to getRedirectUrl(first)
109
- ```
110
-
111
- **Step 2 — after the payment succeeds, persist the card token:**
112
-
113
- ```ts
114
- const details = await tbc.payments.retrieve(first.payId);
115
- const recId = details.recurringCard?.recId; // store this against the subscriber
116
- ```
117
-
118
- **Step 3 — bill on your own schedule (cron, queue, etc.), no customer interaction:**
119
-
120
- ```ts
121
- const charge = await tbc.subscriptions.charge({
122
- recId,
123
- amount: 9.99,
124
- currency: 'GEL',
125
- initiator: 'merchant', // merchant-initiated (unattended) billing
126
- merchantPaymentId: 'SUB-1042-2026-08',
127
- });
128
-
129
- if (charge.status === 'Succeeded') {
130
- // extend the subscription
131
- }
132
- ```
133
-
134
- **Cancel the subscription (deletes the saved card):**
135
-
136
- ```ts
137
- await tbc.subscriptions.cancel(recId);
138
- ```
139
-
140
- ## Callbacks (webhooks) in Next.js
141
-
142
- TBC POSTs a `PaymentId` to your `callbackUrl` when a payment reaches a final status. The body carries no status — the handler fetches the authoritative payment details from the API before invoking your listener, so forged callbacks can't inject a fake status.
143
-
144
- ```ts
145
- // app/api/tbc/callback/route.ts
146
- import { tbc } from '@/lib/tbc'; // your shared TbcCheckoutClient instance
147
-
148
- export const POST = tbc.webhooks.handler(async (payment) => {
149
- switch (payment.status) {
150
- case 'Succeeded':
151
- await fulfillOrder(payment.payId);
152
- break;
153
- case 'Failed':
154
- case 'Expired':
155
- await markOrderFailed(payment.payId);
156
- break;
157
- }
158
- });
159
- ```
160
-
161
- Lower-level pieces if you're not on the App Router:
162
-
163
- ```ts
164
- import { parseCallbackBody, TBC_CALLBACK_IPS } from 'tbc-rando-sdk';
165
-
166
- // pages/api/tbc-callback.ts
167
- export default async function handler(req, res) {
168
- const { payment } = await tbc.webhooks.resolveCallback(req.body);
169
- // ...handle payment.status
170
- res.status(200).send('OK');
171
- }
172
- ```
173
-
174
- `TBC_CALLBACK_IPS` lists the four IPs TBC sends callbacks from, for firewall whitelisting; the route helper can also enforce them via `{ verifySourceIp: true }` (only when `X-Forwarded-For` is set by your own proxy).
175
-
176
- ## Error handling
177
-
178
- ```ts
179
- import { TbcApiError, TbcAuthError, TbcValidationError } from 'tbc-rando-sdk';
180
-
181
- try {
182
- await tbc.subscriptions.charge({ recId, amount: 9.99, currency: 'GEL', initiator: 'merchant' });
183
- } catch (error) {
184
- if (error instanceof TbcApiError) {
185
- error.status; // HTTP status
186
- error.resultCode; // e.g. 'decline_not_sufficient_funds', 'decline_expired_card'
187
- error.systemCode; // TBC problem code, e.g. 'tpay.400.012'
188
- }
189
- }
190
- ```
191
-
192
- - `TbcValidationError` — thrown client-side before any request is sent
193
- - `TbcAuthError` — HTTP 401 (bad `apikey` or token; the SDK already retried once with a fresh token)
194
- - `TbcApiError` — any other non-2xx API response, with `resultCode` for business declines ([reference](https://developers.tbcbank.ge/docs/result-code))
195
-
196
- Decline codes are available as constants:
197
-
198
- ```ts
199
- import { ResultCode } from 'tbc-rando-sdk';
200
-
201
- if (error instanceof TbcApiError && error.resultCode === ResultCode.DeclineNotSufficientFunds) {
202
- // ask the customer for another card
203
- }
204
- ```
205
-
206
- ## Constants
207
-
208
- `PaymentMethod`, `PaymentStatus`, `ResultCode`, `Currency` and `Language` are exported as enum-style `as const` objects (each name is also the matching TypeScript type). Unlike real TS `enum`s, plain strings stay assignable — `status === 'Succeeded'` and `status === PaymentStatus.Succeeded` both type-check, and the objects tree-shake cleanly.
209
-
210
- ## Payment methods
211
-
212
- Restrict the checkout page via `methods`:
213
-
214
- ```ts
215
- import { PaymentMethod } from 'tbc-rando-sdk';
216
-
217
- await tbc.payments.create({
218
- amount: { currency: 'GEL', total: 20 },
219
- returnUrl: '…',
220
- methods: [PaymentMethod.Card, PaymentMethod.ApplePay, PaymentMethod.GooglePay],
221
- });
222
- ```
223
-
224
- | Constant | ID | Notes |
225
- | --- | --- | --- |
226
- | `PaymentMethod.WebQr` | 4 | QR / BNPL, needs back-office activation |
227
- | `PaymentMethod.Card` | 5 | enabled by default |
228
- | `PaymentMethod.InternetBank` | 7 | needs activation |
229
- | `PaymentMethod.Installment` | 8 | needs campaign config; use `tbc.installments` |
230
- | `PaymentMethod.ApplePay` | 9 | needs activation |
231
- | `PaymentMethod.GooglePay` | 14 | needs activation |
232
-
233
- ## Development
234
-
235
- ```bash
236
- npm test # vitest (56 tests, fully mocked — no network)
237
- npm run typecheck # tsc --noEmit
238
- npm run build # tsup → dist/ (ESM + CJS + d.ts)
239
- ```
240
-
241
- ## Notes & limitations
242
-
243
- - TBC has no public sandbox; testing happens on production with small amounts ([docs](https://developers.tbcbank.ge/docs/checkout-testing-on-production)). `baseUrl` is configurable for mock servers.
244
- - The split-payment endpoint (`/tpay/payments` with split) isn't wrapped yet; use `tbc.request()` directly if you need it.
1
+ # tbc-rando-sdk
2
+
3
+ TypeScript SDK for the [TBC Bank Checkout (TPAY) API](https://developers.tbcbank.ge/docs/checkout-api-overview) — card payments, **installments** (checkout and the standalone Online Installments API), **QR payments** and **subscriptions** (recurring payments) for Node.js and Next.js.
4
+
5
+ - Zero runtime dependencies (uses the built-in `fetch`, Node ≥ 18.17)
6
+ - Automatic access-token caching and refresh (single token request even under concurrent load, transparent retry on 401)
7
+ - Typed request/response models with client-side validation before anything hits the network
8
+ - Handles TBC's wire-format quirks for you (`returnurl` lowercase, PascalCase `installmentProducts`)
9
+ - Webhook/callback helper that plugs straight into a Next.js App Router route
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm install tbc-rando-sdk
15
+ ```
16
+
17
+ ## Setup
18
+
19
+ Credentials come from [developers.tbcbank.ge](https://developers.tbcbank.ge) (app `apikey`) and your TBC E-Commerce merchant dashboard (`client_id` / `client_secret`):
20
+
21
+ ```ts
22
+ import { TbcCheckoutClient } from 'tbc-rando-sdk';
23
+
24
+ const tbc = new TbcCheckoutClient({
25
+ apiKey: process.env.TBC_API_KEY!,
26
+ clientId: process.env.TBC_CLIENT_ID!,
27
+ clientSecret: process.env.TBC_CLIENT_SECRET!,
28
+ });
29
+ ```
30
+
31
+ Create the client once (e.g. in a module) and reuse it — the ~24h access token is cached inside the instance. Server-side only: never expose these credentials to the browser. In Next.js use it in route handlers, server actions or server components.
32
+
33
+ ## 1. Standard payment
34
+
35
+ ```ts
36
+ import { getRedirectUrl } from 'tbc-rando-sdk';
37
+
38
+ const payment = await tbc.payments.create({
39
+ amount: { currency: 'GEL', total: 49.9 },
40
+ returnUrl: 'https://shop.example.ge/checkout/return',
41
+ callbackUrl: 'https://shop.example.ge/api/tbc/callback',
42
+ merchantPaymentId: 'ORDER-1042',
43
+ description: 'Order #1042',
44
+ language: 'EN',
45
+ });
46
+
47
+ // Send the customer to the hosted TBC checkout page:
48
+ const checkoutUrl = getRedirectUrl(payment);
49
+ ```
50
+
51
+ Then check the outcome (from your callback handler or by polling):
52
+
53
+ ```ts
54
+ import { isFinalPaymentStatus, PaymentStatus } from 'tbc-rando-sdk';
55
+
56
+ const details = await tbc.payments.retrieve(payment.payId);
57
+ if (details.status === PaymentStatus.Succeeded) {
58
+ // fulfill the order
59
+ }
60
+ isFinalPaymentStatus(details.status); // stop polling when true
61
+ ```
62
+
63
+ Refunds / cancellations and pre-authorizations:
64
+
65
+ ```ts
66
+ await tbc.payments.cancel(payId); // full refund
67
+ await tbc.payments.cancel(payId, { amount: 10.5 }); // partial refund
68
+
69
+ // preAuth: true on create blocks the amount for up to 30 days…
70
+ await tbc.payments.completePreAuth(payId, 45.0); // …then capture (≤ blocked amount)
71
+ ```
72
+
73
+ ## 2. Installments
74
+
75
+ Installments are checkout payments restricted to payment method 8. Your merchant account needs an installment `campaignId`/`merchantKey` configured in the TBC back office. The customer picks the terms on TBC's page.
76
+
77
+ ```ts
78
+ const payment = await tbc.installments.create({
79
+ returnUrl: 'https://shop.example.ge/checkout/return',
80
+ callbackUrl: 'https://shop.example.ge/api/tbc/callback',
81
+ merchantPaymentId: 'ORDER-1043',
82
+ products: [
83
+ { name: 'Laptop', price: 2199, quantity: 1 },
84
+ { name: 'Mouse', price: 89.5, quantity: 2 },
85
+ ],
86
+ // total is computed as sum(price × quantity) = 2378.00; currency defaults to GEL
87
+ });
88
+
89
+ const checkoutUrl = getRedirectUrl(payment);
90
+ ```
91
+
92
+ The SDK validates product lines, computes the total with proper money rounding, and serializes products to the PascalCase wire format TBC expects (`{ Name, Price, Quantity }`).
93
+
94
+ ### Online Installments API (standalone)
95
+
96
+ TBC also has a separate [Online Installments API](https://developers.tbcbank.ge/docs/installment-api-integration) with its own lifecycle (you confirm or cancel each application) and its own credentials: the developer app `apikey` + **secret**, and the `merchantKey` TBC gives you for the installments module. It has a real test environment.
97
+
98
+ ```ts
99
+ import {
100
+ TbcOnlineInstallmentsClient,
101
+ InstallmentStatus,
102
+ ONLINE_INSTALLMENTS_TEST_BASE_URL,
103
+ } from 'tbc-rando-sdk';
104
+
105
+ const installments = new TbcOnlineInstallmentsClient({
106
+ apiKey: process.env.TBC_API_KEY!,
107
+ apiSecret: process.env.TBC_API_SECRET!,
108
+ merchantKey: process.env.TBC_INSTALLMENT_MERCHANT_KEY!,
109
+ campaignId: '1', // optional default
110
+ // baseUrl: ONLINE_INSTALLMENTS_TEST_BASE_URL, // https://test-api.tbcbank.ge
111
+ });
112
+
113
+ // 1. Start the application and send the customer to TBC
114
+ const { sessionId, redirectUrl } = await installments.create({
115
+ invoiceId: 'ORDER-1043',
116
+ products: [{ name: 'Laptop', price: 2199, quantity: 1 }], // priceTotal is computed
117
+ });
118
+
119
+ // 2. Check where it is (save sessionId against the order)
120
+ const status = await installments.getStatus(sessionId);
121
+
122
+ // 3. When the customer has accepted the contract, confirm (or cancel) it
123
+ if (status.statusId === InstallmentStatus.WaitingForMerchantDecision) {
124
+ await installments.confirm(sessionId); // or installments.cancel(sessionId)
125
+ }
126
+ ```
127
+
128
+ This API has no callback. Either poll `getStatus()`, or pull every change in batches:
129
+
130
+ ```ts
131
+ const batch = await installments.getStatusChanges({ take: 50 });
132
+ for (const change of batch.statusChanges) {
133
+ // update the order for change.sessionId / change.statusId
134
+ }
135
+ await installments.syncStatusChanges(batch.synchronizationRequestId); // acknowledge the batch
136
+ ```
137
+
138
+ `installments.createQr({ priceTotal, invoiceId })` starts an application the customer opens by scanning a QR image (`qrCode`) instead of a redirect.
139
+
140
+ `getStatus()` and `getStatusChanges()` need the Node.js runtime (not the Edge runtime): TBC defines them as GET requests with a JSON body, which `fetch` cannot send, so the SDK uses `node:https` for those two calls.
141
+
142
+ ## QR payments
143
+
144
+ Show a QR code that the customer scans with the TBC app. Same client and credentials as checkout; you need a terminal number from TBC, and only GEL is supported.
145
+
146
+ ```ts
147
+ const qr = await tbc.qr.create({
148
+ amount: 49.9,
149
+ terminalNo: process.env.TBC_TERMINAL_NO!,
150
+ merchantPaymentId: 'ORDER-1044',
151
+ callbackUrl: 'https://shop.example.ge/api/tbc/callback',
152
+ });
153
+ // Render qr.qrCode (a URL string) as a QR image with any QR library.
154
+
155
+ const details = await tbc.qr.retrieve(qr.payId); // poll until Succeeded | Failed | Expired
156
+ ```
157
+
158
+ The callback body is the same `{"PaymentId": "..."}` as for checkout, but the payment must be read with `tbc.qr.retrieve()`. Use `parseCallbackBody()` in your route instead of `tbc.webhooks.handler()`, which looks the payment up as a checkout payment.
159
+
160
+ ## 3. Subscriptions (recurring payments)
161
+
162
+ TBC subscriptions are built on saved cards (card saving must be enabled for your merchant by TBC):
163
+
164
+ **Step 1 — the customer pays once and the card is saved:**
165
+
166
+ ```ts
167
+ const first = await tbc.subscriptions.start({
168
+ amount: { currency: 'GEL', total: 9.99 }, // use total: 0 to save the card without charging
169
+ returnUrl: 'https://app.example.ge/subscribe/return',
170
+ callbackUrl: 'https://app.example.ge/api/tbc/callback',
171
+ description: 'Monthly plan',
172
+ saveCardToDate: '1230', // optional MMYY limit
173
+ });
174
+ // redirect the customer to getRedirectUrl(first)
175
+ ```
176
+
177
+ **Step 2 — after the payment succeeds, persist the card token:**
178
+
179
+ ```ts
180
+ const details = await tbc.payments.retrieve(first.payId);
181
+ const recId = details.recurringCard?.recId; // store this against the subscriber
182
+ ```
183
+
184
+ **Step 3 — bill on your own schedule (cron, queue, etc.), no customer interaction:**
185
+
186
+ ```ts
187
+ const charge = await tbc.subscriptions.charge({
188
+ recId,
189
+ amount: 9.99,
190
+ currency: 'GEL',
191
+ initiator: 'merchant', // merchant-initiated (unattended) billing
192
+ merchantPaymentId: 'SUB-1042-2026-08',
193
+ });
194
+
195
+ if (charge.status === 'Succeeded') {
196
+ // extend the subscription
197
+ }
198
+ ```
199
+
200
+ **Cancel the subscription (deletes the saved card):**
201
+
202
+ ```ts
203
+ await tbc.subscriptions.cancel(recId);
204
+ ```
205
+
206
+ ## Callbacks (webhooks) in Next.js
207
+
208
+ TBC POSTs a `PaymentId` to your `callbackUrl` when a payment reaches a final status. The body carries no status — the handler fetches the authoritative payment details from the API before invoking your listener, so forged callbacks can't inject a fake status.
209
+
210
+ ```ts
211
+ // app/api/tbc/callback/route.ts
212
+ import { tbc } from '@/lib/tbc'; // your shared TbcCheckoutClient instance
213
+
214
+ export const POST = tbc.webhooks.handler(async (payment) => {
215
+ switch (payment.status) {
216
+ case 'Succeeded':
217
+ await fulfillOrder(payment.payId);
218
+ break;
219
+ case 'Failed':
220
+ case 'Expired':
221
+ await markOrderFailed(payment.payId);
222
+ break;
223
+ }
224
+ });
225
+ ```
226
+
227
+ Lower-level pieces if you're not on the App Router:
228
+
229
+ ```ts
230
+ import { parseCallbackBody, TBC_CALLBACK_IPS } from 'tbc-rando-sdk';
231
+
232
+ // pages/api/tbc-callback.ts
233
+ export default async function handler(req, res) {
234
+ const { payment } = await tbc.webhooks.resolveCallback(req.body);
235
+ // ...handle payment.status
236
+ res.status(200).send('OK');
237
+ }
238
+ ```
239
+
240
+ `TBC_CALLBACK_IPS` lists the four IPs TBC sends callbacks from, for firewall whitelisting; the route helper can also enforce them via `{ verifySourceIp: true }` (only when `X-Forwarded-For` is set by your own proxy).
241
+
242
+ ## Error handling
243
+
244
+ ```ts
245
+ import { TbcApiError, TbcAuthError, TbcValidationError } from 'tbc-rando-sdk';
246
+
247
+ try {
248
+ await tbc.subscriptions.charge({ recId, amount: 9.99, currency: 'GEL', initiator: 'merchant' });
249
+ } catch (error) {
250
+ if (error instanceof TbcApiError) {
251
+ error.status; // HTTP status
252
+ error.resultCode; // e.g. 'decline_not_sufficient_funds', 'decline_expired_card'
253
+ error.systemCode; // TBC problem code, e.g. 'tpay.400.012'
254
+ }
255
+ }
256
+ ```
257
+
258
+ - `TbcValidationError` — thrown client-side before any request is sent
259
+ - `TbcAuthError` — HTTP 401 (bad `apikey` or token; the SDK already retried once with a fresh token)
260
+ - `TbcApiError` — any other non-2xx API response, with `resultCode` for business declines ([reference](https://developers.tbcbank.ge/docs/result-code))
261
+
262
+ Decline codes are available as constants:
263
+
264
+ ```ts
265
+ import { ResultCode } from 'tbc-rando-sdk';
266
+
267
+ if (error instanceof TbcApiError && error.resultCode === ResultCode.DeclineNotSufficientFunds) {
268
+ // ask the customer for another card
269
+ }
270
+ ```
271
+
272
+ ## Constants
273
+
274
+ `PaymentMethod`, `PaymentStatus`, `ResultCode`, `Currency` and `Language` are exported as enum-style `as const` objects (each name is also the matching TypeScript type). Unlike real TS `enum`s, plain strings stay assignable — `status === 'Succeeded'` and `status === PaymentStatus.Succeeded` both type-check, and the objects tree-shake cleanly.
275
+
276
+ ## Payment methods
277
+
278
+ Restrict the checkout page via `methods`:
279
+
280
+ ```ts
281
+ import { PaymentMethod } from 'tbc-rando-sdk';
282
+
283
+ await tbc.payments.create({
284
+ amount: { currency: 'GEL', total: 20 },
285
+ returnUrl: '…',
286
+ methods: [PaymentMethod.Card, PaymentMethod.ApplePay, PaymentMethod.GooglePay],
287
+ });
288
+ ```
289
+
290
+ | Constant | ID | Notes |
291
+ | --- | --- | --- |
292
+ | `PaymentMethod.WebQr` | 4 | QR / BNPL, needs back-office activation |
293
+ | `PaymentMethod.Card` | 5 | enabled by default |
294
+ | `PaymentMethod.InternetBank` | 7 | needs activation |
295
+ | `PaymentMethod.Installment` | 8 | needs campaign config; use `tbc.installments` |
296
+ | `PaymentMethod.ApplePay` | 9 | needs activation |
297
+ | `PaymentMethod.GooglePay` | 14 | needs activation |
298
+
299
+ ## Development
300
+
301
+ ```bash
302
+ npm test # vitest (mocked fetch + a local HTTP server — no real network)
303
+ npm run typecheck # tsc --noEmit
304
+ npm run build # tsup → dist/ (ESM + CJS + d.ts)
305
+ ```
306
+
307
+ ## Notes & limitations
308
+
309
+ - Developing the SDK needs Node ≥ 22.12 (vitest 5). On Windows, run the tests from a path with an uppercase drive letter (`C:\…`); a lowercase `c:\…` working directory makes vitest fail every suite.
310
+ - TBC Checkout has no public sandbox; testing happens on production with small amounts ([docs](https://developers.tbcbank.ge/docs/checkout-testing-on-production)). `baseUrl` is configurable for mock servers.
311
+ - The split-payment endpoint (`/tpay/payments` with split) isn't wrapped yet; use `tbc.request()` directly if you need it.