@siglume/direct-request-payment 0.4.18 → 0.4.20
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 +44 -0
- package/README.md +32 -15
- package/bin/siglume-sdrp.mjs +398 -0
- package/dist/index.cjs +25 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +25 -1
- package/dist/index.js.map +1 -1
- package/docs/announcement-ja.md +17 -3
- package/docs/api-reference.md +57 -13
- package/docs/merchant-quickstart.md +11 -26
- package/docs/metered-statements.md +15 -13
- package/docs/payment-lifecycle.md +12 -9
- package/docs/pricing.md +7 -4
- package/docs/quickstart-10-minutes.md +126 -128
- package/docs/troubleshooting.md +20 -5
- package/examples/express-checkout.ts +37 -13
- package/examples/hosted-checkout-python/app.py +46 -31
- package/examples/hosted-checkout-python/order_store.py +13 -3
- package/examples/hosted-checkout-python/pyproject.toml +1 -1
- package/examples/hosted-checkout-typescript/src/order-store.ts +14 -3
- package/examples/hosted-checkout-typescript/src/server.ts +49 -37
- package/package.json +9 -1
- package/templates/express/README.md +42 -0
- package/templates/express/siglume-order-store.example.ts +69 -0
- package/templates/express/siglume-sdrp-routes.ts +231 -0
- package/templates/fastapi/README.md +26 -0
- package/templates/fastapi/siglume_order_store_example.py +77 -0
- package/templates/fastapi/siglume_sdrp_routes.py +170 -0
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare const DIRECT_REQUEST_PAYMENT_RECEIPT_KIND = "sdrp_direct_payment";
|
|
|
6
6
|
declare const DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND = "sdrp_direct_payment_allowance";
|
|
7
7
|
declare const DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE = "sdrp_direct_payment_requirement";
|
|
8
8
|
declare const DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
|
|
9
|
-
declare const DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.
|
|
9
|
+
declare const DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.20";
|
|
10
10
|
declare const DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS = "settled";
|
|
11
11
|
declare const DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS = "pending_settlement";
|
|
12
12
|
declare const DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY = "per_payment_onchain";
|
|
@@ -433,6 +433,27 @@ interface DirectRequestPaymentWebhookSubscription {
|
|
|
433
433
|
event_types?: string[];
|
|
434
434
|
[key: string]: unknown;
|
|
435
435
|
}
|
|
436
|
+
interface DirectRequestPaymentWebhookTestDeliveryInput {
|
|
437
|
+
event_type: string;
|
|
438
|
+
data?: Record<string, unknown>;
|
|
439
|
+
subscription_ids?: string[];
|
|
440
|
+
}
|
|
441
|
+
interface DirectRequestPaymentWebhookDelivery {
|
|
442
|
+
id?: string;
|
|
443
|
+
subscription_id?: string;
|
|
444
|
+
event_id?: string;
|
|
445
|
+
event_type?: string;
|
|
446
|
+
delivery_status?: string;
|
|
447
|
+
response_status?: number | null;
|
|
448
|
+
delivered_at?: string | null;
|
|
449
|
+
[key: string]: unknown;
|
|
450
|
+
}
|
|
451
|
+
interface DirectRequestPaymentWebhookDeliveryListInput {
|
|
452
|
+
subscription_id?: string;
|
|
453
|
+
event_type?: string;
|
|
454
|
+
status?: string;
|
|
455
|
+
limit?: number;
|
|
456
|
+
}
|
|
436
457
|
interface DirectRequestPaymentCheckoutSetupInput extends DirectRequestPaymentMerchantSetupInput {
|
|
437
458
|
create_webhook_subscription?: boolean;
|
|
438
459
|
prepare_billing_mandate?: boolean;
|
|
@@ -612,6 +633,9 @@ declare class DirectRequestPaymentMerchantClient {
|
|
|
612
633
|
rotateChallengeSecret(merchant: string): Promise<DirectRequestPaymentMerchantResponse>;
|
|
613
634
|
prepareBillingMandate(merchant: string, input?: DirectRequestPaymentMerchantBillingMandateInput): Promise<DirectRequestPaymentMerchantResponse>;
|
|
614
635
|
createWebhookSubscription(input: DirectRequestPaymentWebhookSubscriptionInput): Promise<DirectRequestPaymentWebhookSubscription>;
|
|
636
|
+
listWebhookSubscriptions(): Promise<DirectRequestPaymentWebhookSubscription[]>;
|
|
637
|
+
queueWebhookTestDelivery(input: DirectRequestPaymentWebhookTestDeliveryInput): Promise<Record<string, unknown>>;
|
|
638
|
+
listWebhookDeliveries(input?: DirectRequestPaymentWebhookDeliveryListInput): Promise<DirectRequestPaymentWebhookDelivery[]>;
|
|
615
639
|
setupCheckout(input: DirectRequestPaymentCheckoutSetupInput): Promise<DirectRequestPaymentCheckoutSetupResult>;
|
|
616
640
|
request<T>(method: string, path: string, json_body?: unknown): Promise<T>;
|
|
617
641
|
private requestHostedCheckout;
|
|
@@ -700,4 +724,4 @@ declare const verifyExternal402Challenge: typeof verifyDirectRequestPaymentChall
|
|
|
700
724
|
declare const createExternal402RecurringChallenge: typeof createDirectRequestPaymentRecurringChallenge;
|
|
701
725
|
declare const verifyExternal402RecurringChallenge: typeof verifyDirectRequestPaymentRecurringChallenge;
|
|
702
726
|
|
|
703
|
-
export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS, DIRECT_REQUEST_PAYMENT_METERED_FINALITY, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, DIRECT_REQUEST_PAYMENT_SDK_VERSION, DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY, DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS, type DirectPaymentConfirmationClassification, type DirectPaymentConfirmationKind, type DirectPaymentConfirmationUnknownReason, type DirectPaymentMeteredBatchSettledClassification, type DirectPaymentMeteredUsageAcceptedClassification, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentStandardSettledClassification, type DirectPaymentUnknownClassification, type DirectPaymentVerifyInput, type DirectRequestPaymentBalanceSufficiency, type DirectRequestPaymentBillingPlan, type DirectRequestPaymentBuyerMeteredQuery, type DirectRequestPaymentBuyerMeteredSummary, type DirectRequestPaymentBuyerUsageEvent, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, type DirectRequestPaymentCheckoutSetupInput, type DirectRequestPaymentCheckoutSetupResult, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentListResponse, type DirectRequestPaymentMerchantAccount, type DirectRequestPaymentMerchantBillingMandateInput, DirectRequestPaymentMerchantClient, type DirectRequestPaymentMerchantResponse, type DirectRequestPaymentMerchantSetupInput, type DirectRequestPaymentMeteredListQuery, type DirectRequestPaymentMeteredOpenPeriod, type DirectRequestPaymentMeteredPlanType, type DirectRequestPaymentMinorAmount, type DirectRequestPaymentPastDueBlock, type DirectRequestPaymentProviderMeteredListQuery, type DirectRequestPaymentProviderMeteredQuery, type DirectRequestPaymentProviderMeteredSummary, type DirectRequestPaymentProviderMeteredTotals, type DirectRequestPaymentProviderUsageEvent, type DirectRequestPaymentRawWebhookBody, type DirectRequestPaymentRecurringCadence, type DirectRequestPaymentRecurringChallenge, type DirectRequestPaymentRecurringChallengeInput, type DirectRequestPaymentSettlementBatch, type DirectRequestPaymentSettlementTrigger, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookEvent, type DirectRequestPaymentWebhookSignatureBody, type DirectRequestPaymentWebhookSubscription, type DirectRequestPaymentWebhookSubscriptionInput, HostedCheckoutNotAvailableError, type HostedCheckoutSession, type HostedCheckoutSessionCreateInput, type HostedCheckoutSessionCreateResult, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, classifyDirectPaymentConfirmation, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createDirectRequestPaymentRecurringChallenge, createDirectRequestPaymentRecurringChallengeSignature, createExternal402Challenge, createExternal402RecurringChallenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, directRequestPaymentRequestHashV2, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentRecurringChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyExternal402RecurringChallenge, verifyWebhookSignature };
|
|
727
|
+
export { DEFAULT_SIGLUME_API_BASE, DEFAULT_WEBHOOK_TOLERANCE_SECONDS, DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS, DIRECT_REQUEST_PAYMENT_METERED_FINALITY, DIRECT_REQUEST_PAYMENT_MODE, DIRECT_REQUEST_PAYMENT_RECEIPT_KIND, DIRECT_REQUEST_PAYMENT_RECURRING_CHALLENGE_SCHEME, DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE, DIRECT_REQUEST_PAYMENT_SDK_VERSION, DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY, DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS, type DirectPaymentConfirmationClassification, type DirectPaymentConfirmationKind, type DirectPaymentConfirmationUnknownReason, type DirectPaymentMeteredBatchSettledClassification, type DirectPaymentMeteredUsageAcceptedClassification, type DirectPaymentRequirement, type DirectPaymentRequirementCreateInput, type DirectPaymentStandardSettledClassification, type DirectPaymentUnknownClassification, type DirectPaymentVerifyInput, type DirectRequestPaymentBalanceSufficiency, type DirectRequestPaymentBillingPlan, type DirectRequestPaymentBuyerMeteredQuery, type DirectRequestPaymentBuyerMeteredSummary, type DirectRequestPaymentBuyerUsageEvent, type DirectRequestPaymentChallenge, type DirectRequestPaymentChallengeInput, type DirectRequestPaymentCheckoutSetupInput, type DirectRequestPaymentCheckoutSetupResult, DirectRequestPaymentClient, type DirectRequestPaymentClientOptions, type DirectRequestPaymentCurrency, type DirectRequestPaymentListResponse, type DirectRequestPaymentMerchantAccount, type DirectRequestPaymentMerchantBillingMandateInput, DirectRequestPaymentMerchantClient, type DirectRequestPaymentMerchantResponse, type DirectRequestPaymentMerchantSetupInput, type DirectRequestPaymentMeteredListQuery, type DirectRequestPaymentMeteredOpenPeriod, type DirectRequestPaymentMeteredPlanType, type DirectRequestPaymentMinorAmount, type DirectRequestPaymentPastDueBlock, type DirectRequestPaymentProviderMeteredListQuery, type DirectRequestPaymentProviderMeteredQuery, type DirectRequestPaymentProviderMeteredSummary, type DirectRequestPaymentProviderMeteredTotals, type DirectRequestPaymentProviderUsageEvent, type DirectRequestPaymentRawWebhookBody, type DirectRequestPaymentRecurringCadence, type DirectRequestPaymentRecurringChallenge, type DirectRequestPaymentRecurringChallengeInput, type DirectRequestPaymentSettlementBatch, type DirectRequestPaymentSettlementTrigger, type DirectRequestPaymentToken, type DirectRequestPaymentWebhookDelivery, type DirectRequestPaymentWebhookDeliveryListInput, type DirectRequestPaymentWebhookEvent, type DirectRequestPaymentWebhookSignatureBody, type DirectRequestPaymentWebhookSubscription, type DirectRequestPaymentWebhookSubscriptionInput, type DirectRequestPaymentWebhookTestDeliveryInput, HostedCheckoutNotAvailableError, type HostedCheckoutSession, type HostedCheckoutSessionCreateInput, type HostedCheckoutSessionCreateResult, type ParsedDirectRequestPaymentChallenge, SiglumeApiError, SiglumeDirectRequestPaymentError, type SiglumeEnvelopeMeta, SiglumeWebhookPayloadError, SiglumeWebhookSignatureError, type Web3PreparedTransactionExecutePayload, type Web3PreparedTransactionExecuteResult, type Web3TransactionRequest, type WebhookSignatureVerification, buildAllowanceExecutionPayload, buildPaymentExecutionPayload, buildPreparedTransactionExecutionPayload, buildWebhookSignatureHeader, classifyDirectPaymentConfirmation, computeWebhookSignature, createDirectRequestPaymentChallenge, createDirectRequestPaymentChallengeSignature, createDirectRequestPaymentRecurringChallenge, createDirectRequestPaymentRecurringChallengeSignature, createExternal402Challenge, createExternal402RecurringChallenge, directRequestPaymentChallengeHash, directRequestPaymentRequestHash, directRequestPaymentRequestHashV2, parseDirectRequestPaymentChallenge, parseDirectRequestPaymentWebhookEvent, verifyDirectRequestPaymentChallenge, verifyDirectRequestPaymentRecurringChallenge, verifyDirectRequestPaymentWebhook, verifyExternal402Challenge, verifyExternal402RecurringChallenge, verifyWebhookSignature };
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ var DIRECT_REQUEST_PAYMENT_RECEIPT_KIND = "sdrp_direct_payment";
|
|
|
7
7
|
var DIRECT_REQUEST_PAYMENT_ALLOWANCE_RECEIPT_KIND = "sdrp_direct_payment_allowance";
|
|
8
8
|
var DIRECT_REQUEST_PAYMENT_REFERENCE_TYPE = "sdrp_direct_payment_requirement";
|
|
9
9
|
var DEFAULT_WEBHOOK_TOLERANCE_SECONDS = 300;
|
|
10
|
-
var DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.
|
|
10
|
+
var DIRECT_REQUEST_PAYMENT_SDK_VERSION = "0.4.20";
|
|
11
11
|
var DIRECT_REQUEST_PAYMENT_STANDARD_SETTLED_STATUS = "settled";
|
|
12
12
|
var DIRECT_REQUEST_PAYMENT_METERED_ACCEPTED_STATUS = "pending_settlement";
|
|
13
13
|
var DIRECT_REQUEST_PAYMENT_STANDARD_FINALITY = "per_payment_onchain";
|
|
@@ -328,6 +328,30 @@ var DirectRequestPaymentMerchantClient = class {
|
|
|
328
328
|
}
|
|
329
329
|
return this.request("POST", "/market/webhooks/subscriptions", payload);
|
|
330
330
|
}
|
|
331
|
+
async listWebhookSubscriptions() {
|
|
332
|
+
return this.request("GET", "/market/webhooks/subscriptions");
|
|
333
|
+
}
|
|
334
|
+
async queueWebhookTestDelivery(input) {
|
|
335
|
+
const payload = {
|
|
336
|
+
event_type: requireNonEmpty(input.event_type, "event_type")
|
|
337
|
+
};
|
|
338
|
+
if (input.data !== void 0) {
|
|
339
|
+
payload.data = cloneJsonObject(input.data, "data");
|
|
340
|
+
}
|
|
341
|
+
if (input.subscription_ids !== void 0) {
|
|
342
|
+
payload.subscription_ids = input.subscription_ids.map((subscriptionId) => requireNonEmpty(subscriptionId, "subscription_id"));
|
|
343
|
+
}
|
|
344
|
+
return this.request("POST", "/market/webhooks/test-deliveries", payload);
|
|
345
|
+
}
|
|
346
|
+
async listWebhookDeliveries(input = {}) {
|
|
347
|
+
const params = new URLSearchParams();
|
|
348
|
+
if (input.subscription_id !== void 0) params.set("subscription_id", requireNonEmpty(input.subscription_id, "subscription_id"));
|
|
349
|
+
if (input.event_type !== void 0) params.set("event_type", requireNonEmpty(input.event_type, "event_type"));
|
|
350
|
+
if (input.status !== void 0) params.set("status", requireNonEmpty(input.status, "status"));
|
|
351
|
+
if (input.limit !== void 0) params.set("limit", String(positiveInteger(input.limit, "limit")));
|
|
352
|
+
const query = params.toString();
|
|
353
|
+
return this.request("GET", `/market/webhooks/deliveries${query ? `?${query}` : ""}`);
|
|
354
|
+
}
|
|
331
355
|
async setupCheckout(input) {
|
|
332
356
|
const merchant = await this.setupMerchant(input);
|
|
333
357
|
const merchantKey = merchant.merchant_account.merchant;
|