@siglume/direct-request-payment 0.1.0 → 0.3.1
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/CHANGELOG.md +61 -0
- package/LICENSE +21 -21
- package/README.md +317 -148
- package/dist/index.cjs +257 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +134 -1
- package/dist/index.d.ts +134 -1
- package/dist/index.js +257 -1
- package/dist/index.js.map +1 -1
- package/docs/announcement-ja.md +69 -0
- package/docs/api-reference.md +280 -65
- package/docs/merchant-quickstart.md +180 -139
- package/docs/pricing.md +73 -56
- package/docs/security.md +110 -85
- package/examples/express-checkout.ts +106 -105
- package/examples/setup-merchant.ts +17 -0
- package/package.json +71 -57
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
|
|
2
2
|
declare const DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME = "siglume-external-402-v1";
|
|
3
|
+
declare const DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME = "siglume-external-402-recurring-v1";
|
|
3
4
|
declare const DIRECT_REQUEST_PAYMENT_MODE = "external_402";
|
|
4
5
|
declare const DIRECT_REQUEST_PAYMENT_RECEIPT_KIND = "api_store_direct_payment";
|
|
5
6
|
declare const DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND = "api_store_direct_payment_allowance";
|
|
@@ -29,6 +30,29 @@ interface ParsedDirectRequestPaymentChallenge {
|
|
|
29
30
|
nonce: string;
|
|
30
31
|
signature: string;
|
|
31
32
|
}
|
|
33
|
+
/** "monthly" authorizes a Siglume-swept subscription; "daily" authorizes
|
|
34
|
+
* merchant-triggered scheduled autopay. It is an approval tag, not a
|
|
35
|
+
* run-count limiter. */
|
|
36
|
+
type DirectRequestPaymentRecurringCadence = "monthly" | "daily";
|
|
37
|
+
interface DirectRequestPaymentRecurringChallengeInput {
|
|
38
|
+
merchant: string;
|
|
39
|
+
amount_minor: number;
|
|
40
|
+
currency: DirectRequestPaymentCurrency | string;
|
|
41
|
+
cadence: DirectRequestPaymentRecurringCadence | string;
|
|
42
|
+
secret: string;
|
|
43
|
+
nonce?: string;
|
|
44
|
+
}
|
|
45
|
+
interface DirectRequestPaymentRecurringChallenge {
|
|
46
|
+
scheme: typeof DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME;
|
|
47
|
+
merchant: string;
|
|
48
|
+
amount_minor: number;
|
|
49
|
+
currency: DirectRequestPaymentCurrency;
|
|
50
|
+
cadence: DirectRequestPaymentRecurringCadence;
|
|
51
|
+
nonce: string;
|
|
52
|
+
signature: string;
|
|
53
|
+
challenge: string;
|
|
54
|
+
challenge_hash: string;
|
|
55
|
+
}
|
|
32
56
|
interface Web3TransactionRequest {
|
|
33
57
|
network?: string;
|
|
34
58
|
chain_id?: number;
|
|
@@ -109,6 +133,78 @@ interface DirectRequestPaymentClientOptions {
|
|
|
109
133
|
timeout_ms?: number;
|
|
110
134
|
user_agent?: string;
|
|
111
135
|
}
|
|
136
|
+
type DirectRequestPaymentBillingPlan = "launch" | "free" | "starter" | "growth" | "pro";
|
|
137
|
+
interface DirectRequestPaymentMerchantAccount {
|
|
138
|
+
merchant_account_id: string;
|
|
139
|
+
merchant: string;
|
|
140
|
+
merchant_user_id: string;
|
|
141
|
+
user_wallet_id?: string | null;
|
|
142
|
+
billing_mandate_id?: string | null;
|
|
143
|
+
display_name?: string | null;
|
|
144
|
+
status?: string | null;
|
|
145
|
+
billing_status?: string | null;
|
|
146
|
+
billing_plan?: string | null;
|
|
147
|
+
billing_currency?: string | null;
|
|
148
|
+
token_symbol?: string | null;
|
|
149
|
+
monthly_fee_minor?: number | null;
|
|
150
|
+
settlement_fee_bps?: number | null;
|
|
151
|
+
settlement_fee_min_minor?: number | null;
|
|
152
|
+
included_monthly_payments?: number | null;
|
|
153
|
+
metadata_jsonb?: Record<string, unknown>;
|
|
154
|
+
[key: string]: unknown;
|
|
155
|
+
}
|
|
156
|
+
interface DirectRequestPaymentMerchantSetupInput {
|
|
157
|
+
merchant: string;
|
|
158
|
+
display_name?: string;
|
|
159
|
+
billing_plan?: DirectRequestPaymentBillingPlan | string;
|
|
160
|
+
billing_currency?: DirectRequestPaymentCurrency | string;
|
|
161
|
+
allowed_currencies?: Record<string, string> | Array<DirectRequestPaymentCurrency | string>;
|
|
162
|
+
webhook_callback_url?: string;
|
|
163
|
+
billing_mandate_cap_minor?: number;
|
|
164
|
+
max_amount_minor?: number;
|
|
165
|
+
}
|
|
166
|
+
interface DirectRequestPaymentMerchantBillingMandateInput {
|
|
167
|
+
currency?: DirectRequestPaymentCurrency | string;
|
|
168
|
+
billing_currency?: DirectRequestPaymentCurrency | string;
|
|
169
|
+
max_amount_minor?: number;
|
|
170
|
+
}
|
|
171
|
+
interface DirectRequestPaymentMerchantResponse {
|
|
172
|
+
merchant_account: DirectRequestPaymentMerchantAccount;
|
|
173
|
+
challenge_secret?: string | null;
|
|
174
|
+
challenge_secret_created?: boolean;
|
|
175
|
+
created?: boolean | null;
|
|
176
|
+
listing_id?: string | null;
|
|
177
|
+
mandate?: Record<string, unknown> | null;
|
|
178
|
+
next_steps?: Record<string, unknown>;
|
|
179
|
+
}
|
|
180
|
+
interface DirectRequestPaymentWebhookSubscriptionInput {
|
|
181
|
+
callback_url: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
event_types?: string[];
|
|
184
|
+
metadata?: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
interface DirectRequestPaymentWebhookSubscription {
|
|
187
|
+
webhook_subscription_id?: string;
|
|
188
|
+
subscription_id?: string;
|
|
189
|
+
id?: string;
|
|
190
|
+
callback_url?: string;
|
|
191
|
+
signing_secret?: string;
|
|
192
|
+
status?: string;
|
|
193
|
+
event_types?: string[];
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
interface DirectRequestPaymentCheckoutSetupInput extends DirectRequestPaymentMerchantSetupInput {
|
|
197
|
+
create_webhook_subscription?: boolean;
|
|
198
|
+
prepare_billing_mandate?: boolean;
|
|
199
|
+
webhook_event_types?: string[];
|
|
200
|
+
webhook_description?: string;
|
|
201
|
+
}
|
|
202
|
+
interface DirectRequestPaymentCheckoutSetupResult {
|
|
203
|
+
merchant: DirectRequestPaymentMerchantResponse;
|
|
204
|
+
billing_mandate?: DirectRequestPaymentMerchantResponse | null;
|
|
205
|
+
webhook_subscription?: DirectRequestPaymentWebhookSubscription | null;
|
|
206
|
+
env: Record<string, string>;
|
|
207
|
+
}
|
|
112
208
|
interface SiglumeEnvelopeMeta {
|
|
113
209
|
request_id?: string | null;
|
|
114
210
|
trace_id?: string | null;
|
|
@@ -177,6 +273,21 @@ declare class DirectRequestPaymentClient {
|
|
|
177
273
|
}): Promise<Web3PreparedTransactionExecuteResult>;
|
|
178
274
|
request<T>(method: string, path: string, json_body?: unknown): Promise<T>;
|
|
179
275
|
}
|
|
276
|
+
declare class DirectRequestPaymentMerchantClient {
|
|
277
|
+
readonly auth_token: string;
|
|
278
|
+
readonly base_url: string;
|
|
279
|
+
readonly timeout_ms: number;
|
|
280
|
+
readonly user_agent: string;
|
|
281
|
+
private readonly fetch_impl;
|
|
282
|
+
constructor(options?: DirectRequestPaymentClientOptions);
|
|
283
|
+
setupMerchant(input: DirectRequestPaymentMerchantSetupInput): Promise<DirectRequestPaymentMerchantResponse>;
|
|
284
|
+
getMerchant(merchant: string): Promise<DirectRequestPaymentMerchantResponse>;
|
|
285
|
+
rotateChallengeSecret(merchant: string): Promise<DirectRequestPaymentMerchantResponse>;
|
|
286
|
+
prepareBillingMandate(merchant: string, input?: DirectRequestPaymentMerchantBillingMandateInput): Promise<DirectRequestPaymentMerchantResponse>;
|
|
287
|
+
createWebhookSubscription(input: DirectRequestPaymentWebhookSubscriptionInput): Promise<DirectRequestPaymentWebhookSubscription>;
|
|
288
|
+
setupCheckout(input: DirectRequestPaymentCheckoutSetupInput): Promise<DirectRequestPaymentCheckoutSetupResult>;
|
|
289
|
+
request<T>(method: string, path: string, json_body?: unknown): Promise<T>;
|
|
290
|
+
}
|
|
180
291
|
declare function createDirectRequestPaymentChallenge(input: DirectRequestPaymentChallengeInput): Promise<DirectRequestPaymentChallenge>;
|
|
181
292
|
declare function createDirectRequestPaymentChallengeSignature(secret: string, input: {
|
|
182
293
|
merchant: string;
|
|
@@ -185,6 +296,26 @@ declare function createDirectRequestPaymentChallengeSignature(secret: string, in
|
|
|
185
296
|
nonce: string;
|
|
186
297
|
}): Promise<string>;
|
|
187
298
|
declare function parseDirectRequestPaymentChallenge(challenge: string): ParsedDirectRequestPaymentChallenge;
|
|
299
|
+
/** Merchant-side, ONE-TIME approval of a recurring authorization: amount +
|
|
300
|
+
* currency + cadence are bound into the HMAC. Recurring charges afterwards
|
|
301
|
+
* are deliberately challenge-free; the recurring authorization and the
|
|
302
|
+
* buyer's mandate/budget caps are the per-charge integrity checks. Cadence
|
|
303
|
+
* "monthly" = subscription, "daily" = scheduled autopay approval tag. */
|
|
304
|
+
declare function createDirectRequestPaymentRecurringChallenge(input: DirectRequestPaymentRecurringChallengeInput): Promise<DirectRequestPaymentRecurringChallenge>;
|
|
305
|
+
declare function createDirectRequestPaymentRecurringChallengeSignature(secret: string, input: {
|
|
306
|
+
merchant: string;
|
|
307
|
+
amount_minor: number;
|
|
308
|
+
currency: DirectRequestPaymentCurrency | string;
|
|
309
|
+
cadence: DirectRequestPaymentRecurringCadence | string;
|
|
310
|
+
nonce: string;
|
|
311
|
+
}): Promise<string>;
|
|
312
|
+
declare function verifyDirectRequestPaymentRecurringChallenge(secret: string, input: {
|
|
313
|
+
merchant: string;
|
|
314
|
+
amount_minor: number;
|
|
315
|
+
currency: DirectRequestPaymentCurrency | string;
|
|
316
|
+
cadence: DirectRequestPaymentRecurringCadence | string;
|
|
317
|
+
challenge: string;
|
|
318
|
+
}): Promise<boolean>;
|
|
188
319
|
declare function verifyDirectRequestPaymentChallenge(secret: string, input: {
|
|
189
320
|
merchant: string;
|
|
190
321
|
amount_minor: number;
|
|
@@ -231,5 +362,7 @@ declare function verifyDirectRequestPaymentWebhook(signing_secret: string, body:
|
|
|
231
362
|
}>;
|
|
232
363
|
declare const createExternal402Challenge: typeof createDirectRequestPaymentChallenge;
|
|
233
364
|
declare const verifyExternal402Challenge: typeof verifyDirectRequestPaymentChallenge;
|
|
365
|
+
declare const createExternal402RecurringChallenge: typeof createDirectRequestPaymentRecurringChallenge;
|
|
366
|
+
declare const verifyExternal402RecurringChallenge: typeof verifyDirectRequestPaymentRecurringChallenge;
|
|
234
367
|
|
|
235
|
-
export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentVerifyInput, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookEvent, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createExternal402Challenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyWebhookSignature };
|
|
368
|
+
export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentVerifyInput, type DirectRequestPaymentBillingPlan, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, type DirectRequestPaymentCheckoutSetupInput, type DirectRequestPaymentCheckoutSetupResult, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentMerchantAccount, type DirectRequestPaymentMerchantBillingMandateInput, DirectRequestPaymentMerchantClient, type DirectRequestPaymentMerchantResponse, type DirectRequestPaymentMerchantSetupInput, type DirectRequestPaymentRecurringCadence, type DirectRequestPaymentRecurringChallenge, type DirectRequestPaymentRecurringChallengeInput, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookEvent, type DirectRequestPaymentWebhookSubscription, type DirectRequestPaymentWebhookSubscriptionInput, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createDirectRequestPaymentRecurringChallenge, createDirectRequestPaymentRecurringChallengeSignature, createExternal402Challenge, createExternal402RecurringChallenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentRecurringChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyExternal402RecurringChallenge, verifyWebhookSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
declare const DEFAULT_SIGLUME_API_BASE = "https://siglume.com/v1";
|
|
2
2
|
declare const DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME = "siglume-external-402-v1";
|
|
3
|
+
declare const DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME = "siglume-external-402-recurring-v1";
|
|
3
4
|
declare const DIRECT_REQUEST_PAYMENT_MODE = "external_402";
|
|
4
5
|
declare const DIRECT_REQUEST_PAYMENT_RECEIPT_KIND = "api_store_direct_payment";
|
|
5
6
|
declare const DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND = "api_store_direct_payment_allowance";
|
|
@@ -29,6 +30,29 @@ interface ParsedDirectRequestPaymentChallenge {
|
|
|
29
30
|
nonce: string;
|
|
30
31
|
signature: string;
|
|
31
32
|
}
|
|
33
|
+
/** "monthly" authorizes a Siglume-swept subscription; "daily" authorizes
|
|
34
|
+
* merchant-triggered scheduled autopay. It is an approval tag, not a
|
|
35
|
+
* run-count limiter. */
|
|
36
|
+
type DirectRequestPaymentRecurringCadence = "monthly" | "daily";
|
|
37
|
+
interface DirectRequestPaymentRecurringChallengeInput {
|
|
38
|
+
merchant: string;
|
|
39
|
+
amount_minor: number;
|
|
40
|
+
currency: DirectRequestPaymentCurrency | string;
|
|
41
|
+
cadence: DirectRequestPaymentRecurringCadence | string;
|
|
42
|
+
secret: string;
|
|
43
|
+
nonce?: string;
|
|
44
|
+
}
|
|
45
|
+
interface DirectRequestPaymentRecurringChallenge {
|
|
46
|
+
scheme: typeof DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME;
|
|
47
|
+
merchant: string;
|
|
48
|
+
amount_minor: number;
|
|
49
|
+
currency: DirectRequestPaymentCurrency;
|
|
50
|
+
cadence: DirectRequestPaymentRecurringCadence;
|
|
51
|
+
nonce: string;
|
|
52
|
+
signature: string;
|
|
53
|
+
challenge: string;
|
|
54
|
+
challenge_hash: string;
|
|
55
|
+
}
|
|
32
56
|
interface Web3TransactionRequest {
|
|
33
57
|
network?: string;
|
|
34
58
|
chain_id?: number;
|
|
@@ -109,6 +133,78 @@ interface DirectRequestPaymentClientOptions {
|
|
|
109
133
|
timeout_ms?: number;
|
|
110
134
|
user_agent?: string;
|
|
111
135
|
}
|
|
136
|
+
type DirectRequestPaymentBillingPlan = "launch" | "free" | "starter" | "growth" | "pro";
|
|
137
|
+
interface DirectRequestPaymentMerchantAccount {
|
|
138
|
+
merchant_account_id: string;
|
|
139
|
+
merchant: string;
|
|
140
|
+
merchant_user_id: string;
|
|
141
|
+
user_wallet_id?: string | null;
|
|
142
|
+
billing_mandate_id?: string | null;
|
|
143
|
+
display_name?: string | null;
|
|
144
|
+
status?: string | null;
|
|
145
|
+
billing_status?: string | null;
|
|
146
|
+
billing_plan?: string | null;
|
|
147
|
+
billing_currency?: string | null;
|
|
148
|
+
token_symbol?: string | null;
|
|
149
|
+
monthly_fee_minor?: number | null;
|
|
150
|
+
settlement_fee_bps?: number | null;
|
|
151
|
+
settlement_fee_min_minor?: number | null;
|
|
152
|
+
included_monthly_payments?: number | null;
|
|
153
|
+
metadata_jsonb?: Record<string, unknown>;
|
|
154
|
+
[key: string]: unknown;
|
|
155
|
+
}
|
|
156
|
+
interface DirectRequestPaymentMerchantSetupInput {
|
|
157
|
+
merchant: string;
|
|
158
|
+
display_name?: string;
|
|
159
|
+
billing_plan?: DirectRequestPaymentBillingPlan | string;
|
|
160
|
+
billing_currency?: DirectRequestPaymentCurrency | string;
|
|
161
|
+
allowed_currencies?: Record<string, string> | Array<DirectRequestPaymentCurrency | string>;
|
|
162
|
+
webhook_callback_url?: string;
|
|
163
|
+
billing_mandate_cap_minor?: number;
|
|
164
|
+
max_amount_minor?: number;
|
|
165
|
+
}
|
|
166
|
+
interface DirectRequestPaymentMerchantBillingMandateInput {
|
|
167
|
+
currency?: DirectRequestPaymentCurrency | string;
|
|
168
|
+
billing_currency?: DirectRequestPaymentCurrency | string;
|
|
169
|
+
max_amount_minor?: number;
|
|
170
|
+
}
|
|
171
|
+
interface DirectRequestPaymentMerchantResponse {
|
|
172
|
+
merchant_account: DirectRequestPaymentMerchantAccount;
|
|
173
|
+
challenge_secret?: string | null;
|
|
174
|
+
challenge_secret_created?: boolean;
|
|
175
|
+
created?: boolean | null;
|
|
176
|
+
listing_id?: string | null;
|
|
177
|
+
mandate?: Record<string, unknown> | null;
|
|
178
|
+
next_steps?: Record<string, unknown>;
|
|
179
|
+
}
|
|
180
|
+
interface DirectRequestPaymentWebhookSubscriptionInput {
|
|
181
|
+
callback_url: string;
|
|
182
|
+
description?: string;
|
|
183
|
+
event_types?: string[];
|
|
184
|
+
metadata?: Record<string, unknown>;
|
|
185
|
+
}
|
|
186
|
+
interface DirectRequestPaymentWebhookSubscription {
|
|
187
|
+
webhook_subscription_id?: string;
|
|
188
|
+
subscription_id?: string;
|
|
189
|
+
id?: string;
|
|
190
|
+
callback_url?: string;
|
|
191
|
+
signing_secret?: string;
|
|
192
|
+
status?: string;
|
|
193
|
+
event_types?: string[];
|
|
194
|
+
[key: string]: unknown;
|
|
195
|
+
}
|
|
196
|
+
interface DirectRequestPaymentCheckoutSetupInput extends DirectRequestPaymentMerchantSetupInput {
|
|
197
|
+
create_webhook_subscription?: boolean;
|
|
198
|
+
prepare_billing_mandate?: boolean;
|
|
199
|
+
webhook_event_types?: string[];
|
|
200
|
+
webhook_description?: string;
|
|
201
|
+
}
|
|
202
|
+
interface DirectRequestPaymentCheckoutSetupResult {
|
|
203
|
+
merchant: DirectRequestPaymentMerchantResponse;
|
|
204
|
+
billing_mandate?: DirectRequestPaymentMerchantResponse | null;
|
|
205
|
+
webhook_subscription?: DirectRequestPaymentWebhookSubscription | null;
|
|
206
|
+
env: Record<string, string>;
|
|
207
|
+
}
|
|
112
208
|
interface SiglumeEnvelopeMeta {
|
|
113
209
|
request_id?: string | null;
|
|
114
210
|
trace_id?: string | null;
|
|
@@ -177,6 +273,21 @@ declare class DirectRequestPaymentClient {
|
|
|
177
273
|
}): Promise<Web3PreparedTransactionExecuteResult>;
|
|
178
274
|
request<T>(method: string, path: string, json_body?: unknown): Promise<T>;
|
|
179
275
|
}
|
|
276
|
+
declare class DirectRequestPaymentMerchantClient {
|
|
277
|
+
readonly auth_token: string;
|
|
278
|
+
readonly base_url: string;
|
|
279
|
+
readonly timeout_ms: number;
|
|
280
|
+
readonly user_agent: string;
|
|
281
|
+
private readonly fetch_impl;
|
|
282
|
+
constructor(options?: DirectRequestPaymentClientOptions);
|
|
283
|
+
setupMerchant(input: DirectRequestPaymentMerchantSetupInput): Promise<DirectRequestPaymentMerchantResponse>;
|
|
284
|
+
getMerchant(merchant: string): Promise<DirectRequestPaymentMerchantResponse>;
|
|
285
|
+
rotateChallengeSecret(merchant: string): Promise<DirectRequestPaymentMerchantResponse>;
|
|
286
|
+
prepareBillingMandate(merchant: string, input?: DirectRequestPaymentMerchantBillingMandateInput): Promise<DirectRequestPaymentMerchantResponse>;
|
|
287
|
+
createWebhookSubscription(input: DirectRequestPaymentWebhookSubscriptionInput): Promise<DirectRequestPaymentWebhookSubscription>;
|
|
288
|
+
setupCheckout(input: DirectRequestPaymentCheckoutSetupInput): Promise<DirectRequestPaymentCheckoutSetupResult>;
|
|
289
|
+
request<T>(method: string, path: string, json_body?: unknown): Promise<T>;
|
|
290
|
+
}
|
|
180
291
|
declare function createDirectRequestPaymentChallenge(input: DirectRequestPaymentChallengeInput): Promise<DirectRequestPaymentChallenge>;
|
|
181
292
|
declare function createDirectRequestPaymentChallengeSignature(secret: string, input: {
|
|
182
293
|
merchant: string;
|
|
@@ -185,6 +296,26 @@ declare function createDirectRequestPaymentChallengeSignature(secret: string, in
|
|
|
185
296
|
nonce: string;
|
|
186
297
|
}): Promise<string>;
|
|
187
298
|
declare function parseDirectRequestPaymentChallenge(challenge: string): ParsedDirectRequestPaymentChallenge;
|
|
299
|
+
/** Merchant-side, ONE-TIME approval of a recurring authorization: amount +
|
|
300
|
+
* currency + cadence are bound into the HMAC. Recurring charges afterwards
|
|
301
|
+
* are deliberately challenge-free; the recurring authorization and the
|
|
302
|
+
* buyer's mandate/budget caps are the per-charge integrity checks. Cadence
|
|
303
|
+
* "monthly" = subscription, "daily" = scheduled autopay approval tag. */
|
|
304
|
+
declare function createDirectRequestPaymentRecurringChallenge(input: DirectRequestPaymentRecurringChallengeInput): Promise<DirectRequestPaymentRecurringChallenge>;
|
|
305
|
+
declare function createDirectRequestPaymentRecurringChallengeSignature(secret: string, input: {
|
|
306
|
+
merchant: string;
|
|
307
|
+
amount_minor: number;
|
|
308
|
+
currency: DirectRequestPaymentCurrency | string;
|
|
309
|
+
cadence: DirectRequestPaymentRecurringCadence | string;
|
|
310
|
+
nonce: string;
|
|
311
|
+
}): Promise<string>;
|
|
312
|
+
declare function verifyDirectRequestPaymentRecurringChallenge(secret: string, input: {
|
|
313
|
+
merchant: string;
|
|
314
|
+
amount_minor: number;
|
|
315
|
+
currency: DirectRequestPaymentCurrency | string;
|
|
316
|
+
cadence: DirectRequestPaymentRecurringCadence | string;
|
|
317
|
+
challenge: string;
|
|
318
|
+
}): Promise<boolean>;
|
|
188
319
|
declare function verifyDirectRequestPaymentChallenge(secret: string, input: {
|
|
189
320
|
merchant: string;
|
|
190
321
|
amount_minor: number;
|
|
@@ -231,5 +362,7 @@ declare function verifyDirectRequestPaymentWebhook(signing_secret: string, body:
|
|
|
231
362
|
}>;
|
|
232
363
|
declare const createExternal402Challenge: typeof createDirectRequestPaymentChallenge;
|
|
233
364
|
declare const verifyExternal402Challenge: typeof verifyDirectRequestPaymentChallenge;
|
|
365
|
+
declare const createExternal402RecurringChallenge: typeof createDirectRequestPaymentRecurringChallenge;
|
|
366
|
+
declare const verifyExternal402RecurringChallenge: typeof verifyDirectRequestPaymentRecurringChallenge;
|
|
234
367
|
|
|
235
|
-
export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentVerifyInput, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookEvent, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createExternal402Challenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyWebhookSignature };
|
|
368
|
+
export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentVerifyInput, type DirectRequestPaymentBillingPlan, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, type DirectRequestPaymentCheckoutSetupInput, type DirectRequestPaymentCheckoutSetupResult, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentMerchantAccount, type DirectRequestPaymentMerchantBillingMandateInput, DirectRequestPaymentMerchantClient, type DirectRequestPaymentMerchantResponse, type DirectRequestPaymentMerchantSetupInput, type DirectRequestPaymentRecurringCadence, type DirectRequestPaymentRecurringChallenge, type DirectRequestPaymentRecurringChallengeInput, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookEvent, type DirectRequestPaymentWebhookSubscription, type DirectRequestPaymentWebhookSubscriptionInput, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createDirectRequestPaymentRecurringChallenge, createDirectRequestPaymentRecurringChallengeSignature, createExternal402Challenge, createExternal402RecurringChallenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentRecurringChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyExternal402RecurringChallenge, verifyWebhookSignature };
|