gwop-checkout 0.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 +119 -0
- package/dist/index.d.mts +346 -0
- package/dist/index.d.ts +346 -0
- package/dist/index.js +425 -0
- package/dist/index.mjs +393 -0
- package/package.json +52 -0
package/README.md
ADDED
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
# gwop-checkout
|
|
2
|
+
|
|
3
|
+
Stripe-like Gwop payment primitives for **self-hosted** stores.
|
|
4
|
+
|
|
5
|
+
Use this SDK when your catalog, fulfillment, and user model live in your own service, and you only want Gwop for checkout and settlement.
|
|
6
|
+
|
|
7
|
+
## Product boundary
|
|
8
|
+
|
|
9
|
+
Included:
|
|
10
|
+
- Merchant provisioning (`/v1/merchants/*`)
|
|
11
|
+
- Invoice lifecycle (`/v1/invoices*`)
|
|
12
|
+
- Webhook signature verification helper
|
|
13
|
+
|
|
14
|
+
Not included:
|
|
15
|
+
- Hosted storefront (`/store/*`, `/v1/merchants/store/*`)
|
|
16
|
+
- Hosted delivery recovery (`/v1/invoices/{id}/delivery`)
|
|
17
|
+
|
|
18
|
+
## Install
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install gwop-checkout
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Configuration
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Store backend env
|
|
28
|
+
GWOP_CHECKOUT_API_KEY=sk_m_xxx
|
|
29
|
+
GWOP_API_BASE=https://api.gwop.io
|
|
30
|
+
GWOP_WEBHOOK_SECRET=whsec_xxx
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Quick start
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import { randomUUID } from 'node:crypto';
|
|
37
|
+
import { GwopCheckout } from 'gwop-checkout';
|
|
38
|
+
|
|
39
|
+
const gwop = new GwopCheckout({
|
|
40
|
+
merchantApiKey: process.env.GWOP_CHECKOUT_API_KEY,
|
|
41
|
+
baseUrl: process.env.GWOP_API_BASE || 'https://api.gwop.io',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const created = await gwop.invoices.create(
|
|
45
|
+
{
|
|
46
|
+
amount_usdc: 10_000,
|
|
47
|
+
description: 'Speak credits: tts-5k',
|
|
48
|
+
metadata: { order_id: 'ord_123', sku: 'tts-5k' },
|
|
49
|
+
consumption_type: 'consumable',
|
|
50
|
+
},
|
|
51
|
+
{ idempotencyKey: randomUUID() },
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// Retrieve public payment fields for your client.
|
|
55
|
+
const invoice = await gwop.invoices.retrieve(created.id);
|
|
56
|
+
console.log(invoice.gwop_pay_url, invoice.payment_address);
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Store integration pattern (recommended)
|
|
60
|
+
|
|
61
|
+
1. Store receives `POST /buy` with `{ sku, quantity }`.
|
|
62
|
+
2. Store calculates amount and creates a Gwop invoice with `gwop.invoices.create(...)`.
|
|
63
|
+
3. Store retrieves invoice public fields with `gwop.invoices.retrieve(id)`.
|
|
64
|
+
4. Store returns `pay_url` + `invoice_id` + local `order_id` to the client/agent.
|
|
65
|
+
5. Gwop sends webhook (`invoice.paid|invoice.expired|invoice.canceled`) to store.
|
|
66
|
+
6. Store verifies signature with `Webhooks.constructEvent(...)` and updates local order state.
|
|
67
|
+
7. Store fulfills product in its own infrastructure.
|
|
68
|
+
|
|
69
|
+
This keeps checkout state in Gwop and business/fulfillment state in your store.
|
|
70
|
+
|
|
71
|
+
## Webhook verification
|
|
72
|
+
|
|
73
|
+
```ts
|
|
74
|
+
import { Webhooks } from 'gwop-checkout';
|
|
75
|
+
|
|
76
|
+
const webhooks = new Webhooks();
|
|
77
|
+
const event = webhooks.constructEvent(
|
|
78
|
+
rawBody, // exact raw request body string
|
|
79
|
+
req.headers['x-gwop-signature'] as string | undefined,
|
|
80
|
+
process.env.GWOP_WEBHOOK_SECRET!,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (event.event_type === 'invoice.paid') {
|
|
84
|
+
// mark order paid, allow fulfillment/claim
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## SDK methods
|
|
89
|
+
|
|
90
|
+
Merchants:
|
|
91
|
+
- `merchants.getInitPreflight()`
|
|
92
|
+
- `merchants.init(body, { idempotencyKey })`
|
|
93
|
+
- `merchants.getStatus()`
|
|
94
|
+
- `merchants.updateSettings(body)`
|
|
95
|
+
- `merchants.generateWebhookSecret()`
|
|
96
|
+
|
|
97
|
+
Invoices:
|
|
98
|
+
- `invoices.create(body, { idempotencyKey? })`
|
|
99
|
+
- `invoices.list(params?)`
|
|
100
|
+
- `invoices.retrieve(invoiceId)`
|
|
101
|
+
- `invoices.cancel(invoiceId)`
|
|
102
|
+
- `invoices.pay(invoiceId, body?)` (requires agent key)
|
|
103
|
+
- `invoices.verifyExternalPayment(invoiceId, { tx_signature })`
|
|
104
|
+
|
|
105
|
+
Client key setters:
|
|
106
|
+
- `setMerchantApiKey(sk_m_...)`
|
|
107
|
+
- `setAgentApiKey(sk_...)`
|
|
108
|
+
|
|
109
|
+
## Notes
|
|
110
|
+
|
|
111
|
+
- Recommended env var name: `GWOP_CHECKOUT_API_KEY`.
|
|
112
|
+
- Merchant-auth endpoints require `sk_m_*` keys.
|
|
113
|
+
- `invoices.pay` requires an `sk_*` agent key.
|
|
114
|
+
- `invoices.retrieve` and `invoices.verifyExternalPayment` are public endpoints.
|
|
115
|
+
|
|
116
|
+
## Package docs
|
|
117
|
+
|
|
118
|
+
- Contract (YAML): `packages/gwop-checkout/docs/gwop-checkout-profile.yaml`
|
|
119
|
+
- Contract summary (MD): `packages/gwop-checkout/docs/gwop-checkout-profile.md`
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
type Currency = 'USDC';
|
|
2
|
+
type InvoiceStatus = 'OPEN' | 'PAYING' | 'PAID' | 'EXPIRED' | 'CANCELED';
|
|
3
|
+
type ConsumptionType = 'redeliverable' | 'consumable';
|
|
4
|
+
interface GwopCheckoutConfig {
|
|
5
|
+
baseUrl?: string;
|
|
6
|
+
merchantApiKey?: string;
|
|
7
|
+
agentApiKey?: string;
|
|
8
|
+
}
|
|
9
|
+
interface PublicRequestOptions {
|
|
10
|
+
signal?: AbortSignal;
|
|
11
|
+
}
|
|
12
|
+
interface AuthenticatedRequestOptions extends PublicRequestOptions {
|
|
13
|
+
apiKey?: string;
|
|
14
|
+
}
|
|
15
|
+
interface IdempotentRequestOptions extends AuthenticatedRequestOptions {
|
|
16
|
+
idempotencyKey?: string;
|
|
17
|
+
}
|
|
18
|
+
interface RequiredIdempotencyRequestOptions extends PublicRequestOptions {
|
|
19
|
+
idempotencyKey: string;
|
|
20
|
+
}
|
|
21
|
+
interface ErrorResponse {
|
|
22
|
+
error: {
|
|
23
|
+
code: string;
|
|
24
|
+
message: string;
|
|
25
|
+
details?: Record<string, unknown>;
|
|
26
|
+
requestId?: string;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
interface FieldRequirement {
|
|
30
|
+
type: 'string' | 'email' | 'url';
|
|
31
|
+
required: boolean;
|
|
32
|
+
critical?: boolean;
|
|
33
|
+
min_length?: number;
|
|
34
|
+
max_length?: number;
|
|
35
|
+
pattern?: string;
|
|
36
|
+
guidance: string;
|
|
37
|
+
}
|
|
38
|
+
interface MerchantInitPreflight {
|
|
39
|
+
required_fields: {
|
|
40
|
+
email: FieldRequirement;
|
|
41
|
+
merchant_name: FieldRequirement;
|
|
42
|
+
merchant_description: FieldRequirement;
|
|
43
|
+
};
|
|
44
|
+
optional_fields: {
|
|
45
|
+
webhook_url: FieldRequirement;
|
|
46
|
+
};
|
|
47
|
+
warnings: string[];
|
|
48
|
+
checklist: string[];
|
|
49
|
+
example_request: {
|
|
50
|
+
method: string;
|
|
51
|
+
path: string;
|
|
52
|
+
headers: Record<string, unknown>;
|
|
53
|
+
body: Record<string, unknown>;
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
interface MerchantInitRequest {
|
|
57
|
+
email: string;
|
|
58
|
+
merchant_name: string;
|
|
59
|
+
merchant_description: string;
|
|
60
|
+
webhook_url?: string;
|
|
61
|
+
}
|
|
62
|
+
interface MerchantCapabilities {
|
|
63
|
+
create_invoices: boolean;
|
|
64
|
+
receive_payments: boolean;
|
|
65
|
+
create_products: boolean;
|
|
66
|
+
withdraw: boolean;
|
|
67
|
+
}
|
|
68
|
+
interface MerchantInitResponse {
|
|
69
|
+
status: 'ACTIVE';
|
|
70
|
+
wallet_address: string;
|
|
71
|
+
api_key: string;
|
|
72
|
+
claim_url: string;
|
|
73
|
+
claim_expires_at: string | null;
|
|
74
|
+
claim_email_sent: boolean;
|
|
75
|
+
help_endpoint: string;
|
|
76
|
+
capabilities: MerchantCapabilities;
|
|
77
|
+
agent_guidance: {
|
|
78
|
+
message?: string;
|
|
79
|
+
persist?: string[];
|
|
80
|
+
next_step?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface MerchantStatusResponse {
|
|
84
|
+
status: 'ACTIVE' | 'SUSPENDED';
|
|
85
|
+
claimed: boolean;
|
|
86
|
+
wallet_address: string;
|
|
87
|
+
merchant_name: string;
|
|
88
|
+
capabilities: MerchantCapabilities;
|
|
89
|
+
balance_usdc?: number;
|
|
90
|
+
pending_balance_usdc?: number;
|
|
91
|
+
claim_url?: string;
|
|
92
|
+
owner_email_verified?: boolean;
|
|
93
|
+
withdrawal_address?: string;
|
|
94
|
+
}
|
|
95
|
+
interface MerchantSettingsUpdateRequestPublic {
|
|
96
|
+
webhook_url?: string;
|
|
97
|
+
business_name?: string;
|
|
98
|
+
withdrawal_address?: string;
|
|
99
|
+
}
|
|
100
|
+
interface MerchantProfilePublic {
|
|
101
|
+
id: string;
|
|
102
|
+
email?: string | null;
|
|
103
|
+
business_name: string;
|
|
104
|
+
website?: string | null;
|
|
105
|
+
solana_address?: string | null;
|
|
106
|
+
withdrawal_address?: string | null;
|
|
107
|
+
webhook_url?: string | null;
|
|
108
|
+
webhook_secret_preview?: string | null;
|
|
109
|
+
status: 'PENDING_SETUP' | 'ACTIVE' | 'SUSPENDED';
|
|
110
|
+
verified_at?: string | null;
|
|
111
|
+
created_at: string;
|
|
112
|
+
}
|
|
113
|
+
interface WebhookSecretResponse {
|
|
114
|
+
secret: string;
|
|
115
|
+
preview: string;
|
|
116
|
+
note: string;
|
|
117
|
+
}
|
|
118
|
+
interface CreateInvoiceRequest {
|
|
119
|
+
amount_usdc: number;
|
|
120
|
+
description?: string;
|
|
121
|
+
metadata?: Record<string, unknown>;
|
|
122
|
+
metadata_public?: boolean;
|
|
123
|
+
expires_in_seconds?: number;
|
|
124
|
+
consumption_type?: ConsumptionType;
|
|
125
|
+
replay_window_seconds?: number;
|
|
126
|
+
max_replays?: number;
|
|
127
|
+
}
|
|
128
|
+
interface CreateInvoiceResponse {
|
|
129
|
+
id: string;
|
|
130
|
+
merchant_id: string;
|
|
131
|
+
amount_usdc: number;
|
|
132
|
+
currency: Currency;
|
|
133
|
+
status: InvoiceStatus;
|
|
134
|
+
description?: string;
|
|
135
|
+
metadata?: Record<string, unknown>;
|
|
136
|
+
metadata_public: boolean;
|
|
137
|
+
consumption_type?: ConsumptionType;
|
|
138
|
+
replay_window_seconds?: number;
|
|
139
|
+
max_replays?: number;
|
|
140
|
+
created_at: string;
|
|
141
|
+
expires_at: string;
|
|
142
|
+
}
|
|
143
|
+
interface ConsumptionGuidance {
|
|
144
|
+
type: 'redeliverable' | 'consumable' | 'unknown';
|
|
145
|
+
replay_safe: boolean;
|
|
146
|
+
max_replays?: number | null;
|
|
147
|
+
replay_window_expires_at?: string;
|
|
148
|
+
guidance: string;
|
|
149
|
+
}
|
|
150
|
+
interface AgentGuidancePayload {
|
|
151
|
+
message: string;
|
|
152
|
+
next_step?: string;
|
|
153
|
+
persist: {
|
|
154
|
+
action: 'create' | 'update';
|
|
155
|
+
path: string;
|
|
156
|
+
required_fields: string[];
|
|
157
|
+
persist_full_response: boolean;
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
interface InvoicePublic {
|
|
161
|
+
id: string;
|
|
162
|
+
status: InvoiceStatus;
|
|
163
|
+
amount_usdc: number;
|
|
164
|
+
currency: Currency;
|
|
165
|
+
payment_address?: string;
|
|
166
|
+
solana_pay_url?: string;
|
|
167
|
+
gwop_pay_url?: string;
|
|
168
|
+
reference_pubkey?: string;
|
|
169
|
+
verify_payment_endpoint?: string;
|
|
170
|
+
description?: string;
|
|
171
|
+
metadata?: Record<string, unknown>;
|
|
172
|
+
expires_at: string;
|
|
173
|
+
created_at: string;
|
|
174
|
+
paid_at?: string;
|
|
175
|
+
tx_signature?: string;
|
|
176
|
+
tx_url?: string;
|
|
177
|
+
merchant: {
|
|
178
|
+
name: string;
|
|
179
|
+
verified: boolean;
|
|
180
|
+
};
|
|
181
|
+
consumption: ConsumptionGuidance;
|
|
182
|
+
agent_guidance?: AgentGuidancePayload;
|
|
183
|
+
}
|
|
184
|
+
interface InvoiceListItem {
|
|
185
|
+
id: string;
|
|
186
|
+
status: InvoiceStatus;
|
|
187
|
+
amount_usdc: number;
|
|
188
|
+
currency: Currency;
|
|
189
|
+
description?: string;
|
|
190
|
+
metadata?: Record<string, unknown>;
|
|
191
|
+
expires_at: string;
|
|
192
|
+
created_at: string;
|
|
193
|
+
paid_at?: string;
|
|
194
|
+
tx_signature?: string;
|
|
195
|
+
}
|
|
196
|
+
interface Pagination {
|
|
197
|
+
total: number;
|
|
198
|
+
limit: number;
|
|
199
|
+
offset: number;
|
|
200
|
+
has_more: boolean;
|
|
201
|
+
}
|
|
202
|
+
interface InvoiceListResponse {
|
|
203
|
+
invoices: InvoiceListItem[];
|
|
204
|
+
pagination: Pagination;
|
|
205
|
+
}
|
|
206
|
+
interface InvoiceListParams {
|
|
207
|
+
limit?: number;
|
|
208
|
+
offset?: number;
|
|
209
|
+
status?: InvoiceStatus;
|
|
210
|
+
}
|
|
211
|
+
interface InvoiceCancelResponse {
|
|
212
|
+
id: string;
|
|
213
|
+
status: 'CANCELED';
|
|
214
|
+
canceled_at: string;
|
|
215
|
+
}
|
|
216
|
+
interface InvoicePayRequest {
|
|
217
|
+
otp_code?: string;
|
|
218
|
+
otp_challenge_id?: string;
|
|
219
|
+
}
|
|
220
|
+
interface InvoicePayResponse {
|
|
221
|
+
id: string;
|
|
222
|
+
status: 'PAID';
|
|
223
|
+
tx_signature: string;
|
|
224
|
+
tx_url: string;
|
|
225
|
+
paid_at: string;
|
|
226
|
+
payment_intent_id: string;
|
|
227
|
+
consumption: ConsumptionGuidance;
|
|
228
|
+
agent_guidance?: AgentGuidancePayload;
|
|
229
|
+
}
|
|
230
|
+
interface VerifyPaymentRequest {
|
|
231
|
+
tx_signature: string;
|
|
232
|
+
payer_address?: string;
|
|
233
|
+
}
|
|
234
|
+
interface VerifyPaymentResponse {
|
|
235
|
+
id: string;
|
|
236
|
+
status: 'PAID';
|
|
237
|
+
tx_signature: string;
|
|
238
|
+
tx_url: string;
|
|
239
|
+
paid_at: string;
|
|
240
|
+
payer_address: string;
|
|
241
|
+
paid_amount: number;
|
|
242
|
+
consumption: ConsumptionGuidance;
|
|
243
|
+
agent_guidance?: AgentGuidancePayload;
|
|
244
|
+
}
|
|
245
|
+
type CheckoutWebhookEventType = 'invoice.paid' | 'invoice.expired' | 'invoice.canceled';
|
|
246
|
+
interface CheckoutWebhookEventData {
|
|
247
|
+
invoice_id: string;
|
|
248
|
+
status: 'PAID' | 'EXPIRED' | 'CANCELED';
|
|
249
|
+
amount_usdc: number | string;
|
|
250
|
+
currency: Currency;
|
|
251
|
+
tx_signature?: string;
|
|
252
|
+
paid_at?: string;
|
|
253
|
+
payer_wallet?: string;
|
|
254
|
+
}
|
|
255
|
+
interface CheckoutWebhookEvent {
|
|
256
|
+
event_id: string;
|
|
257
|
+
event_type: CheckoutWebhookEventType;
|
|
258
|
+
event_version: number;
|
|
259
|
+
created_at: string;
|
|
260
|
+
data: CheckoutWebhookEventData;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
type AuthMode = 'public' | 'merchant' | 'agent';
|
|
264
|
+
interface RequestConfig {
|
|
265
|
+
auth: AuthMode;
|
|
266
|
+
path: string;
|
|
267
|
+
method: 'GET' | 'POST';
|
|
268
|
+
query?: Record<string, string | number | boolean | undefined>;
|
|
269
|
+
body?: unknown;
|
|
270
|
+
options?: PublicRequestOptions | AuthenticatedRequestOptions | IdempotentRequestOptions;
|
|
271
|
+
}
|
|
272
|
+
declare class CheckoutHttpClient {
|
|
273
|
+
private readonly baseUrl;
|
|
274
|
+
private merchantApiKey?;
|
|
275
|
+
private agentApiKey?;
|
|
276
|
+
constructor(config?: GwopCheckoutConfig);
|
|
277
|
+
setMerchantApiKey(apiKey: string): void;
|
|
278
|
+
setAgentApiKey(apiKey: string): void;
|
|
279
|
+
request<T>(config: RequestConfig): Promise<T>;
|
|
280
|
+
private resolveAuthKey;
|
|
281
|
+
private toApiError;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
declare class InvoicesResource {
|
|
285
|
+
private readonly client;
|
|
286
|
+
constructor(client: CheckoutHttpClient);
|
|
287
|
+
create(body: CreateInvoiceRequest, options?: IdempotentRequestOptions): Promise<CreateInvoiceResponse>;
|
|
288
|
+
list(params?: InvoiceListParams, options?: AuthenticatedRequestOptions): Promise<InvoiceListResponse>;
|
|
289
|
+
retrieve(invoiceId: string, options?: PublicRequestOptions): Promise<InvoicePublic>;
|
|
290
|
+
cancel(invoiceId: string, options?: AuthenticatedRequestOptions): Promise<InvoiceCancelResponse>;
|
|
291
|
+
pay(invoiceId: string, body?: InvoicePayRequest, options?: AuthenticatedRequestOptions): Promise<InvoicePayResponse>;
|
|
292
|
+
verifyExternalPayment(invoiceId: string, body: VerifyPaymentRequest, options?: PublicRequestOptions): Promise<VerifyPaymentResponse>;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
declare class MerchantsResource {
|
|
296
|
+
private readonly client;
|
|
297
|
+
constructor(client: CheckoutHttpClient);
|
|
298
|
+
getInitPreflight(options?: PublicRequestOptions): Promise<MerchantInitPreflight>;
|
|
299
|
+
init(body: MerchantInitRequest, options: RequiredIdempotencyRequestOptions): Promise<MerchantInitResponse>;
|
|
300
|
+
getStatus(options?: AuthenticatedRequestOptions): Promise<MerchantStatusResponse>;
|
|
301
|
+
updateSettings(body: MerchantSettingsUpdateRequestPublic, options?: AuthenticatedRequestOptions): Promise<MerchantProfilePublic>;
|
|
302
|
+
generateWebhookSecret(options?: AuthenticatedRequestOptions): Promise<WebhookSecretResponse>;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
interface ConstructEventOptions {
|
|
306
|
+
tolerance?: number;
|
|
307
|
+
}
|
|
308
|
+
declare class Webhooks {
|
|
309
|
+
constructEvent(payload: string | Buffer, signature: string | undefined, secret: string, options?: ConstructEventOptions): CheckoutWebhookEvent;
|
|
310
|
+
generateTestSignature(payload: string, secret: string, timestamp?: number): string;
|
|
311
|
+
private parseSignatureHeader;
|
|
312
|
+
private secureCompare;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
declare class GwopCheckoutError extends Error {
|
|
316
|
+
readonly code: string;
|
|
317
|
+
readonly statusCode: number;
|
|
318
|
+
readonly details?: Record<string, unknown> | undefined;
|
|
319
|
+
readonly requestId?: string | undefined;
|
|
320
|
+
readonly raw?: unknown | undefined;
|
|
321
|
+
constructor(message: string, code: string, statusCode: number, details?: Record<string, unknown> | undefined, requestId?: string | undefined, raw?: unknown | undefined);
|
|
322
|
+
}
|
|
323
|
+
declare class AuthenticationError extends GwopCheckoutError {
|
|
324
|
+
constructor(message?: string, requestId?: string, raw?: unknown);
|
|
325
|
+
}
|
|
326
|
+
declare class InvalidRequestError extends GwopCheckoutError {
|
|
327
|
+
constructor(message: string, code?: string, details?: Record<string, unknown>, requestId?: string, raw?: unknown);
|
|
328
|
+
}
|
|
329
|
+
declare class NotFoundError extends GwopCheckoutError {
|
|
330
|
+
constructor(message?: string, code?: string, requestId?: string, raw?: unknown);
|
|
331
|
+
}
|
|
332
|
+
declare class RateLimitError extends GwopCheckoutError {
|
|
333
|
+
constructor(message?: string, retryAfterSeconds?: number, requestId?: string, raw?: unknown);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
declare class GwopCheckout {
|
|
337
|
+
readonly merchants: MerchantsResource;
|
|
338
|
+
readonly invoices: InvoicesResource;
|
|
339
|
+
readonly webhooks: Webhooks;
|
|
340
|
+
private readonly client;
|
|
341
|
+
constructor(config?: GwopCheckoutConfig);
|
|
342
|
+
setMerchantApiKey(apiKey: string): void;
|
|
343
|
+
setAgentApiKey(apiKey: string): void;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export { type AgentGuidancePayload, type AuthenticatedRequestOptions, AuthenticationError, type CheckoutWebhookEvent, type CheckoutWebhookEventData, type CheckoutWebhookEventType, type ConsumptionGuidance, type ConsumptionType, type CreateInvoiceRequest, type CreateInvoiceResponse, type Currency, type ErrorResponse, type FieldRequirement, GwopCheckout, type GwopCheckoutConfig, GwopCheckoutError, type IdempotentRequestOptions, InvalidRequestError, type InvoiceCancelResponse, type InvoiceListItem, type InvoiceListParams, type InvoiceListResponse, type InvoicePayRequest, type InvoicePayResponse, type InvoicePublic, type InvoiceStatus, type MerchantCapabilities, type MerchantInitPreflight, type MerchantInitRequest, type MerchantInitResponse, type MerchantProfilePublic, type MerchantSettingsUpdateRequestPublic, type MerchantStatusResponse, NotFoundError, type Pagination, type PublicRequestOptions, RateLimitError, type RequiredIdempotencyRequestOptions, type VerifyPaymentRequest, type VerifyPaymentResponse, type WebhookSecretResponse };
|