@proxy-checkout/server-js 0.0.8 → 0.1.0-prx-124.139.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/README.md +13 -1
- package/dist/cjs/client.d.cts +2 -0
- package/dist/cjs/client.d.ts +2 -0
- package/dist/cjs/client.js +4 -1
- package/dist/cjs/errors.d.cts +1 -1
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/events.d.cts +10 -2
- package/dist/cjs/events.d.ts +10 -2
- package/dist/cjs/events.js +28 -1
- package/dist/cjs/index.d.cts +4 -3
- package/dist/cjs/index.d.ts +4 -3
- package/dist/cjs/index.js +6 -1
- package/dist/cjs/provider-acquisitions.d.cts +106 -0
- package/dist/cjs/provider-acquisitions.d.ts +106 -0
- package/dist/cjs/provider-acquisitions.js +168 -0
- package/dist/cjs/sessions.d.cts +36 -4
- package/dist/cjs/sessions.d.ts +36 -4
- package/dist/cjs/sessions.js +132 -7
- package/dist/cjs/version.d.cts +2 -2
- package/dist/cjs/version.d.ts +2 -2
- package/dist/cjs/version.js +1 -1
- package/dist/cjs/webhook-events.d.cts +21 -0
- package/dist/cjs/webhook-events.d.ts +21 -0
- package/dist/cjs/webhook-events.js +48 -0
- package/dist/cjs/webhook-handler.d.cts +1 -0
- package/dist/cjs/webhook-handler.d.ts +1 -0
- package/dist/cjs/webhook-handler.js +7 -0
- package/dist/esm/client.d.ts +2 -0
- package/dist/esm/client.js +4 -1
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/events.d.ts +10 -2
- package/dist/esm/events.js +29 -2
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.js +2 -1
- package/dist/esm/provider-acquisitions.d.ts +106 -0
- package/dist/esm/provider-acquisitions.js +164 -0
- package/dist/esm/sessions.d.ts +36 -4
- package/dist/esm/sessions.js +132 -7
- package/dist/esm/version.d.ts +2 -2
- package/dist/esm/version.js +1 -1
- package/dist/esm/webhook-events.d.ts +21 -0
- package/dist/esm/webhook-events.js +46 -0
- package/dist/esm/webhook-handler.d.ts +1 -0
- package/dist/esm/webhook-handler.js +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,9 @@ const handoff = await proxy.sessions.createHandoff({
|
|
|
44
44
|
cartSnapshot: {
|
|
45
45
|
items: [{ product_id: "prod_123", quantity: 1 }],
|
|
46
46
|
},
|
|
47
|
-
|
|
47
|
+
// Stable merchant purchase-request id: reuse for retries and every payer
|
|
48
|
+
// invited to this order; use a new id for a genuinely new purchase.
|
|
49
|
+
idempotencyKey: "proxy-session:purchase_request_123",
|
|
48
50
|
// Optional: omit in normal production flows to use the dashboard default.
|
|
49
51
|
// Preview/staging/multi-origin environments may override the merchant payer page.
|
|
50
52
|
payerDestinationUrl: "https://preview.example.com/checkout",
|
|
@@ -74,6 +76,8 @@ For delegated checkout, prefer the high-level flow:
|
|
|
74
76
|
|
|
75
77
|
Use `payerHandoff`, `payerOpened`, raw event construction, or manual provisioning acknowledgements only for custom integrations that cannot use the default helpers.
|
|
76
78
|
|
|
79
|
+
The legacy `proxy.sessions.recordProviderBinding(...)` compatibility adapter is deprecated. If a custom Stripe integration still calls it directly, pass canonical `psp: "stripe"` plus `commercialMode: "one_time"` for Checkout `mode: "payment"` or `commercialMode: "subscription"` for Checkout `mode: "subscription"`. Current TypeScript callers receive that requirement at compile time; `openCheckout(...)` derives it automatically.
|
|
80
|
+
|
|
77
81
|
`proxy.webhooks.handle(...)` automatically marks successful initial provisioning as provisioned after `onResolved` completes. Return a fulfillment reference and/or metadata from `onResolved` when you want that acknowledgement to record the merchant-side access row:
|
|
78
82
|
|
|
79
83
|
```ts
|
|
@@ -97,6 +101,10 @@ await proxy.webhooks.handle(request, {
|
|
|
97
101
|
|
|
98
102
|
For pre-account purchases, create a durable pending entitlement before `sessions.createHandoff(...)`, use that pending entitlement id as `buyerReference`, pass the future recipient's contact as `beneficiaryContact`, and claim the entitlement after signup/login with your own high-entropy claim token. Store only the token hash on the pending entitlement; use `sessionStorage` or an emailed merchant-owned claim link to carry the plaintext token to the authenticated claim endpoint. Treat `proxy_session_id` as public correlation, not as a claim secret.
|
|
99
103
|
|
|
104
|
+
Keep purchase identity separate from beneficiary identity. Create a durable merchant purchase-request/order row before `createHandoff`, derive `idempotencyKey` from that row's stable non-PII id, and store the returned Proxy session/handoff on it. Reuse the row and one handoff across HTTP retries and every invited payer. `buyerReference` identifies the entitlement recipient; it is not, by itself, an order key. A repeated purchase by the same beneficiary needs a new purchase-request id even if its offer and amount are unchanged. Do not derive the key from email, payer identity, Stripe Customer id, amount alone, or a per-retry random value.
|
|
105
|
+
|
|
106
|
+
One shared handoff supports simultaneous viewers. Opening never grants checkout ownership or a viewer lease. All authorized viewers can render the same cart/current state; identical provider preparation joins the same order-scoped acquisition, and a completed session remains readable while further provider creation is refused.
|
|
107
|
+
|
|
100
108
|
Verify and parse outbound webhooks with the exact raw request body:
|
|
101
109
|
|
|
102
110
|
```ts
|
|
@@ -114,6 +122,10 @@ if (event.type === "subscription.renewed") {
|
|
|
114
122
|
}
|
|
115
123
|
```
|
|
116
124
|
|
|
125
|
+
`PROXY_WEBHOOK_EVENT_TYPES` and the `isProxy*Event` predicates also cover initial payment refunds
|
|
126
|
+
and observation-only Shopify reconciliation/renewal/refund/fulfillment events. Shopify observation events do not
|
|
127
|
+
initiate a commerce mutation or imply provisioning; inspect their verified `event.data` payload.
|
|
128
|
+
|
|
117
129
|
Production calls default to `https://api.proxycheckout.com`. Tests, local
|
|
118
130
|
development, and previews can pass `apiHost`.
|
|
119
131
|
|
package/dist/cjs/client.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProxyEventsResource } from "./events.js";
|
|
2
|
+
import { ProxyProviderAcquisitionsResource } from "./provider-acquisitions.js";
|
|
2
3
|
import { ProxySessionsResource } from "./sessions.js";
|
|
3
4
|
import { ProxySubscriptionsResource } from "./subscriptions.js";
|
|
4
5
|
import type { ProxyCheckoutServerClientOptions } from "./types.js";
|
|
@@ -7,6 +8,7 @@ import { ProxyWebhookEndpointsResource } from "./webhooks.js";
|
|
|
7
8
|
export declare class ProxyCheckoutServerClient {
|
|
8
9
|
readonly apiHost: string;
|
|
9
10
|
readonly sessions: ProxySessionsResource;
|
|
11
|
+
readonly providerAcquisitions: ProxyProviderAcquisitionsResource;
|
|
10
12
|
readonly subscriptions: ProxySubscriptionsResource;
|
|
11
13
|
/** Current-state lifecycle resolver for signed webhook events. */
|
|
12
14
|
readonly events: ProxyEventsResource;
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ProxyEventsResource } from "./events.js";
|
|
2
|
+
import { ProxyProviderAcquisitionsResource } from "./provider-acquisitions.js";
|
|
2
3
|
import { ProxySessionsResource } from "./sessions.js";
|
|
3
4
|
import { ProxySubscriptionsResource } from "./subscriptions.js";
|
|
4
5
|
import type { ProxyCheckoutServerClientOptions } from "./types.js";
|
|
@@ -7,6 +8,7 @@ import { ProxyWebhookEndpointsResource } from "./webhooks.js";
|
|
|
7
8
|
export declare class ProxyCheckoutServerClient {
|
|
8
9
|
readonly apiHost: string;
|
|
9
10
|
readonly sessions: ProxySessionsResource;
|
|
11
|
+
readonly providerAcquisitions: ProxyProviderAcquisitionsResource;
|
|
10
12
|
readonly subscriptions: ProxySubscriptionsResource;
|
|
11
13
|
/** Current-state lifecycle resolver for signed webhook events. */
|
|
12
14
|
readonly events: ProxyEventsResource;
|
package/dist/cjs/client.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.ProxyCheckoutServerClient = void 0;
|
|
|
4
4
|
exports.createProxyCheckoutServerClient = createProxyCheckoutServerClient;
|
|
5
5
|
const events_js_1 = require("./events.js");
|
|
6
6
|
const http_client_js_1 = require("./http-client.js");
|
|
7
|
+
const provider_acquisitions_js_1 = require("./provider-acquisitions.js");
|
|
7
8
|
const sessions_js_1 = require("./sessions.js");
|
|
8
9
|
const subscriptions_js_1 = require("./subscriptions.js");
|
|
9
10
|
const webhook_handler_js_1 = require("./webhook-handler.js");
|
|
@@ -11,6 +12,7 @@ const webhooks_js_1 = require("./webhooks.js");
|
|
|
11
12
|
class ProxyCheckoutServerClient {
|
|
12
13
|
apiHost;
|
|
13
14
|
sessions;
|
|
15
|
+
providerAcquisitions;
|
|
14
16
|
subscriptions;
|
|
15
17
|
/** Current-state lifecycle resolver for signed webhook events. */
|
|
16
18
|
events;
|
|
@@ -29,8 +31,9 @@ class ProxyCheckoutServerClient {
|
|
|
29
31
|
payHost: options.payHost,
|
|
30
32
|
publishableKey: options.publishableKey,
|
|
31
33
|
});
|
|
34
|
+
this.providerAcquisitions = new provider_acquisitions_js_1.ProxyProviderAcquisitionsResource(httpClient);
|
|
32
35
|
this.subscriptions = new subscriptions_js_1.ProxySubscriptionsResource(httpClient, this.sessions);
|
|
33
|
-
this.events = new events_js_1.ProxyEventsResource(this.sessions, this.subscriptions);
|
|
36
|
+
this.events = new events_js_1.ProxyEventsResource(this.sessions, this.subscriptions, this.providerAcquisitions);
|
|
34
37
|
this.webhooks = new webhook_handler_js_1.ProxyWebhooksResource(this.events, this.sessions);
|
|
35
38
|
this.webhookEndpoints = new webhooks_js_1.ProxyWebhookEndpointsResource(httpClient);
|
|
36
39
|
}
|
package/dist/cjs/errors.d.cts
CHANGED
|
@@ -4,7 +4,7 @@ export interface ProxyCheckoutApiErrorDetails {
|
|
|
4
4
|
readonly responseBody: unknown;
|
|
5
5
|
readonly statusCode: number;
|
|
6
6
|
}
|
|
7
|
-
export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "invalid_date" | "provider_binding_mismatch" | "subscription_session_mismatch" | "webhook_sessions_resource_missing";
|
|
7
|
+
export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "cart_version_conflict" | "commercial_mode_required" | "invalid_date" | "invalid_session_presentation" | "provider_acquisition_in_progress" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
|
|
8
8
|
/**
|
|
9
9
|
* Raised when the SDK receives Proxy data it cannot safely normalize, for
|
|
10
10
|
* example an invalid date string, a cart snapshot that fails the merchant
|
package/dist/cjs/errors.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export interface ProxyCheckoutApiErrorDetails {
|
|
|
4
4
|
readonly responseBody: unknown;
|
|
5
5
|
readonly statusCode: number;
|
|
6
6
|
}
|
|
7
|
-
export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "invalid_date" | "provider_binding_mismatch" | "subscription_session_mismatch" | "webhook_sessions_resource_missing";
|
|
7
|
+
export type ProxyCheckoutValidationCode = "buyer_reference_mismatch" | "cart_invalid" | "cart_version_conflict" | "commercial_mode_required" | "invalid_date" | "invalid_session_presentation" | "provider_acquisition_in_progress" | "provider_binding_missing" | "provider_binding_mismatch" | "subscription_session_mismatch" | "unsupported_provider_option" | "webhook_sessions_resource_missing";
|
|
8
8
|
/**
|
|
9
9
|
* Raised when the SDK receives Proxy data it cannot safely normalize, for
|
|
10
10
|
* example an invalid date string, a cart snapshot that fails the merchant
|
package/dist/cjs/events.d.cts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* lifecycle decision. It never grants from webhook payload fields, and it
|
|
7
7
|
* classifies subscription events from current state rather than event order.
|
|
8
8
|
*/
|
|
9
|
+
import type { ProviderAcquisition, ProxyProviderAcquisitionsResource } from "./provider-acquisitions.js";
|
|
9
10
|
import type { MerchantProxySession, ProxySessionsResource } from "./sessions.js";
|
|
10
11
|
import type { MerchantProxySubscription, ProxySubscriptionsResource } from "./subscriptions.js";
|
|
11
12
|
import type { ProxyCheckoutServerRequestOptions } from "./types.js";
|
|
@@ -66,23 +67,30 @@ export interface ResolvedPaymentAttempt extends ResolvedBase {
|
|
|
66
67
|
readonly sessionId: string | null;
|
|
67
68
|
readonly subscriptionId: string | null;
|
|
68
69
|
}
|
|
70
|
+
export interface ResolvedAcquisitionProgress extends ResolvedBase {
|
|
71
|
+
readonly acquisition: ProviderAcquisition;
|
|
72
|
+
readonly kind: "acquisition_progress";
|
|
73
|
+
readonly session: MerchantProxySession;
|
|
74
|
+
}
|
|
69
75
|
export interface ResolvedIgnored extends ResolvedBase {
|
|
70
76
|
readonly kind: "ignored";
|
|
71
77
|
readonly reason: string;
|
|
72
78
|
readonly sessionId: string | null;
|
|
73
79
|
readonly subscriptionId: string | null;
|
|
74
80
|
}
|
|
75
|
-
export type ResolvedProxyEvent = ResolvedInitialProvision | ResolvedSubscriptionRenewed | ResolvedSubscriptionCancelScheduled | ResolvedSubscriptionCancelled | ResolvedPaymentRisk | ResolvedTerminalSession | ResolvedPaymentAttempt | ResolvedIgnored;
|
|
81
|
+
export type ResolvedProxyEvent = ResolvedInitialProvision | ResolvedSubscriptionRenewed | ResolvedSubscriptionCancelScheduled | ResolvedSubscriptionCancelled | ResolvedPaymentRisk | ResolvedTerminalSession | ResolvedPaymentAttempt | ResolvedAcquisitionProgress | ResolvedIgnored;
|
|
76
82
|
export type ResolvedProxyEventKind = ResolvedProxyEvent["kind"];
|
|
77
83
|
export declare class ProxyEventsResource {
|
|
78
84
|
private readonly sessions;
|
|
79
85
|
private readonly subscriptions;
|
|
80
|
-
|
|
86
|
+
private readonly providerAcquisitions;
|
|
87
|
+
constructor(sessions: ProxySessionsResource, subscriptions: ProxySubscriptionsResource, providerAcquisitions: ProxyProviderAcquisitionsResource);
|
|
81
88
|
/**
|
|
82
89
|
* Resolve a signed webhook event into a current-state lifecycle decision by
|
|
83
90
|
* re-reading the authoritative session/subscription with the secret key.
|
|
84
91
|
*/
|
|
85
92
|
resolveCurrentState(event: ProxyWebhookEvent, options?: ResolveProxyEventOptions): Promise<ResolvedProxyEvent>;
|
|
93
|
+
private resolveProviderAcquisitionEvent;
|
|
86
94
|
private resolveSessionEvent;
|
|
87
95
|
private resolveSubscriptionEvent;
|
|
88
96
|
}
|
package/dist/cjs/events.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* lifecycle decision. It never grants from webhook payload fields, and it
|
|
7
7
|
* classifies subscription events from current state rather than event order.
|
|
8
8
|
*/
|
|
9
|
+
import type { ProviderAcquisition, ProxyProviderAcquisitionsResource } from "./provider-acquisitions.js";
|
|
9
10
|
import type { MerchantProxySession, ProxySessionsResource } from "./sessions.js";
|
|
10
11
|
import type { MerchantProxySubscription, ProxySubscriptionsResource } from "./subscriptions.js";
|
|
11
12
|
import type { ProxyCheckoutServerRequestOptions } from "./types.js";
|
|
@@ -66,23 +67,30 @@ export interface ResolvedPaymentAttempt extends ResolvedBase {
|
|
|
66
67
|
readonly sessionId: string | null;
|
|
67
68
|
readonly subscriptionId: string | null;
|
|
68
69
|
}
|
|
70
|
+
export interface ResolvedAcquisitionProgress extends ResolvedBase {
|
|
71
|
+
readonly acquisition: ProviderAcquisition;
|
|
72
|
+
readonly kind: "acquisition_progress";
|
|
73
|
+
readonly session: MerchantProxySession;
|
|
74
|
+
}
|
|
69
75
|
export interface ResolvedIgnored extends ResolvedBase {
|
|
70
76
|
readonly kind: "ignored";
|
|
71
77
|
readonly reason: string;
|
|
72
78
|
readonly sessionId: string | null;
|
|
73
79
|
readonly subscriptionId: string | null;
|
|
74
80
|
}
|
|
75
|
-
export type ResolvedProxyEvent = ResolvedInitialProvision | ResolvedSubscriptionRenewed | ResolvedSubscriptionCancelScheduled | ResolvedSubscriptionCancelled | ResolvedPaymentRisk | ResolvedTerminalSession | ResolvedPaymentAttempt | ResolvedIgnored;
|
|
81
|
+
export type ResolvedProxyEvent = ResolvedInitialProvision | ResolvedSubscriptionRenewed | ResolvedSubscriptionCancelScheduled | ResolvedSubscriptionCancelled | ResolvedPaymentRisk | ResolvedTerminalSession | ResolvedPaymentAttempt | ResolvedAcquisitionProgress | ResolvedIgnored;
|
|
76
82
|
export type ResolvedProxyEventKind = ResolvedProxyEvent["kind"];
|
|
77
83
|
export declare class ProxyEventsResource {
|
|
78
84
|
private readonly sessions;
|
|
79
85
|
private readonly subscriptions;
|
|
80
|
-
|
|
86
|
+
private readonly providerAcquisitions;
|
|
87
|
+
constructor(sessions: ProxySessionsResource, subscriptions: ProxySubscriptionsResource, providerAcquisitions: ProxyProviderAcquisitionsResource);
|
|
81
88
|
/**
|
|
82
89
|
* Resolve a signed webhook event into a current-state lifecycle decision by
|
|
83
90
|
* re-reading the authoritative session/subscription with the secret key.
|
|
84
91
|
*/
|
|
85
92
|
resolveCurrentState(event: ProxyWebhookEvent, options?: ResolveProxyEventOptions): Promise<ResolvedProxyEvent>;
|
|
93
|
+
private resolveProviderAcquisitionEvent;
|
|
86
94
|
private resolveSessionEvent;
|
|
87
95
|
private resolveSubscriptionEvent;
|
|
88
96
|
}
|
package/dist/cjs/events.js
CHANGED
|
@@ -15,15 +15,20 @@ const webhook_events_js_1 = require("./webhook-events.js");
|
|
|
15
15
|
class ProxyEventsResource {
|
|
16
16
|
sessions;
|
|
17
17
|
subscriptions;
|
|
18
|
-
|
|
18
|
+
providerAcquisitions;
|
|
19
|
+
constructor(sessions, subscriptions, providerAcquisitions) {
|
|
19
20
|
this.sessions = sessions;
|
|
20
21
|
this.subscriptions = subscriptions;
|
|
22
|
+
this.providerAcquisitions = providerAcquisitions;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Resolve a signed webhook event into a current-state lifecycle decision by
|
|
24
26
|
* re-reading the authoritative session/subscription with the secret key.
|
|
25
27
|
*/
|
|
26
28
|
async resolveCurrentState(event, options = {}) {
|
|
29
|
+
if ((0, webhook_events_js_1.isProxyProviderAcquisitionEvent)(event.type)) {
|
|
30
|
+
return this.resolveProviderAcquisitionEvent(event, options);
|
|
31
|
+
}
|
|
27
32
|
if ((0, webhook_events_js_1.isProxySubscriptionEvent)(event.type)) {
|
|
28
33
|
return this.resolveSubscriptionEvent(event, options);
|
|
29
34
|
}
|
|
@@ -44,6 +49,28 @@ class ProxyEventsResource {
|
|
|
44
49
|
subscriptionId: readEventString(event.data.subscription_id),
|
|
45
50
|
});
|
|
46
51
|
}
|
|
52
|
+
async resolveProviderAcquisitionEvent(event, options) {
|
|
53
|
+
const sessionId = extractSessionId(event);
|
|
54
|
+
const acquisitionAttemptId = readEventString(event.data.provider_acquisition_attempt_id);
|
|
55
|
+
if (sessionId === null || acquisitionAttemptId === null) {
|
|
56
|
+
return ignored(event, "Provider acquisition event is missing current-state identifiers.", {
|
|
57
|
+
sessionId,
|
|
58
|
+
subscriptionId: null,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
const [session, acquisitions] = await Promise.all([
|
|
62
|
+
this.sessions.retrieve(sessionId, options),
|
|
63
|
+
this.providerAcquisitions.listProviderAcquisitions(sessionId, options),
|
|
64
|
+
]);
|
|
65
|
+
const acquisition = acquisitions.find((candidate) => candidate.id === acquisitionAttemptId);
|
|
66
|
+
if (!acquisition) {
|
|
67
|
+
return ignored(event, `Provider acquisition ${acquisitionAttemptId} is no longer visible for session ${sessionId}.`, { sessionId, subscriptionId: null });
|
|
68
|
+
}
|
|
69
|
+
if (acquisition.proxySessionId !== session.id) {
|
|
70
|
+
throw new Error("Proxy provider acquisition current state disagreed with its session");
|
|
71
|
+
}
|
|
72
|
+
return { acquisition, event, kind: "acquisition_progress", session };
|
|
73
|
+
}
|
|
47
74
|
async resolveSessionEvent(event, options) {
|
|
48
75
|
const sessionId = extractSessionId(event);
|
|
49
76
|
if (sessionId === null) {
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -2,12 +2,13 @@ export { type ProxyCartParseOptions, type ProxyCartValidator, parseProxyCart, }
|
|
|
2
2
|
export { createProxyCheckoutServerClient, ProxyCheckoutServerClient, } from "./client.js";
|
|
3
3
|
export { assertCartBuyerReference, assertSubscriptionMatchesSession, } from "./consistency.js";
|
|
4
4
|
export { isProxySessionNotFoundError, PROXY_SESSION_NOT_FOUND_ERROR_CODE, ProxyCheckoutApiError, type ProxyCheckoutApiErrorDetails, type ProxyCheckoutValidationCode, ProxyCheckoutValidationError, } from "./errors.js";
|
|
5
|
-
export { ProxyEventsResource, type ResolvedIgnored, type ResolvedInitialProvision, type ResolvedPaymentAttempt, type ResolvedPaymentRisk, type ResolvedProxyEvent, type ResolvedProxyEventKind, type ResolvedSubscriptionCancelled, type ResolvedSubscriptionCancelScheduled, type ResolvedSubscriptionRenewed, type ResolvedTerminalSession, type ResolveProxyEventOptions, } from "./events.js";
|
|
5
|
+
export { ProxyEventsResource, type ResolvedAcquisitionProgress, type ResolvedIgnored, type ResolvedInitialProvision, type ResolvedPaymentAttempt, type ResolvedPaymentRisk, type ResolvedProxyEvent, type ResolvedProxyEventKind, type ResolvedSubscriptionCancelled, type ResolvedSubscriptionCancelScheduled, type ResolvedSubscriptionRenewed, type ResolvedTerminalSession, type ResolveProxyEventOptions, } from "./events.js";
|
|
6
6
|
export { AT_RISK_SUBSCRIPTION_STATUSES, ENDED_SUBSCRIPTION_STATUSES, isSessionProvisionable, isSessionTerminal, isSubscriptionEnded, isSubscriptionPaymentAtRisk, PROVISIONABLE_SESSION_STATUSES, parseOptionalProxyDate, requireProxyDate, subscriptionAccessEndsAt, subscriptionWillRenew, TERMINAL_SESSION_STATUSES, } from "./lifecycle.js";
|
|
7
|
-
export { type
|
|
7
|
+
export { type AttachProviderAcquisitionObjectInput, type ProviderAcquisition, type ProviderAcquisitionCheckoutUiMode, type ProviderAcquisitionCommercialMode, type ProviderAcquisitionIntegrationPath, type ProviderAcquisitionObjectType, type ProviderAcquisitionObservedCheckoutUiMode, type ProviderAcquisitionPricingMode, type ProviderAcquisitionReservation, ProxyProviderAcquisitionsResource, proxyCheckoutProviderAcquisitionEndpoints, type ReserveProviderAcquisitionInput, type SupersedeProviderAcquisitionInput, } from "./provider-acquisitions.js";
|
|
8
|
+
export { type CreateProxySessionHandoffInput, type CreateProxySessionInput, type CreateProxySessionOptions, type MarkProxySessionProvisionedInput, type MarkProxySessionProvisioningFailedInput, type MerchantProxySession, type PayerHandoffResult, type PayerOpenedResult, type ProxySession, type ProxySessionAcquisitionSummary, type ProxySessionActionableNextStep, ProxySessionCartResource, type ProxySessionCartResult, type ProxySessionHandoff, type ProxySessionPresentationState, type ProxySessionProviderBinding, type ProxySessionProvisioningAcknowledgement, ProxySessionsResource, type ProxySessionViewStatus, proxyCheckoutServerEndpoints, type RecordProviderBindingInput, type SetProxySessionCartInput, type TypedMerchantProxySession, } from "./sessions.js";
|
|
8
9
|
export { type MerchantProxySubscription, ProxySubscriptionsResource, type ProxySubscriptionWithSession, type ProxySubscriptionWithUntypedSession, proxyCheckoutSubscriptionEndpoints, } from "./subscriptions.js";
|
|
9
10
|
export type { JsonObject, JsonPrimitive, JsonValue, ProxyCheckoutFetch, ProxyCheckoutServerClientOptions, ProxyCheckoutServerRequestOptions, } from "./types.js";
|
|
10
11
|
export { proxyCheckoutServerSdkName, proxyCheckoutServerSdkUserAgent, proxyCheckoutServerSdkVersion, } from "./version.js";
|
|
11
|
-
export { isProxyPaymentAttemptEvent, isProxySessionEvent, isProxySubscriptionEvent, PROXY_WEBHOOK_EVENT_TYPES, type ProxyWebhookEventType, } from "./webhook-events.js";
|
|
12
|
+
export { isProxyPaymentAttemptEvent, isProxyProviderAcquisitionEvent, isProxySessionEvent, isProxyShopifyEvent, isProxySubscriptionEvent, PROXY_WEBHOOK_EVENT_TYPES, type ProxyWebhookEventType, } from "./webhook-events.js";
|
|
12
13
|
export { PROXY_WEBHOOK_RETRY_AFTER_SECONDS, type ProxyWebhookClaimResult, type ProxyWebhookHandlerOptions, type ProxyWebhookOutcome, type ProxyWebhookPayloadInput, type ProxyWebhookProcessRecord, type ProxyWebhookProcessResult, type ProxyWebhookProvisioningFailure, type ProxyWebhookProvisioningSuccess, type ProxyWebhookProvisioningSuccessResult, type ProxyWebhookRequestInput, type ProxyWebhookStore, ProxyWebhooksResource, } from "./webhook-handler.js";
|
|
13
14
|
export { type ConstructProxyWebhookEventInput, type CreateWebhookEndpointInput, constructProxyWebhookEvent, PROXY_SIGNATURE_HEADER, ProxyWebhookEndpointsResource, type ProxyWebhookEvent, ProxyWebhookSignatureVerificationError, proxyCheckoutWebhookEndpointEndpoints, type RotateWebhookEndpointSecretInput, type UpdateWebhookEndpointInput, type VerifyProxyWebhookSignatureInput, verifyProxyWebhookSignature, type WebhookEndpoint, type WebhookEndpointSecretResult, } from "./webhooks.js";
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -2,12 +2,13 @@ export { type ProxyCartParseOptions, type ProxyCartValidator, parseProxyCart, }
|
|
|
2
2
|
export { createProxyCheckoutServerClient, ProxyCheckoutServerClient, } from "./client.js";
|
|
3
3
|
export { assertCartBuyerReference, assertSubscriptionMatchesSession, } from "./consistency.js";
|
|
4
4
|
export { isProxySessionNotFoundError, PROXY_SESSION_NOT_FOUND_ERROR_CODE, ProxyCheckoutApiError, type ProxyCheckoutApiErrorDetails, type ProxyCheckoutValidationCode, ProxyCheckoutValidationError, } from "./errors.js";
|
|
5
|
-
export { ProxyEventsResource, type ResolvedIgnored, type ResolvedInitialProvision, type ResolvedPaymentAttempt, type ResolvedPaymentRisk, type ResolvedProxyEvent, type ResolvedProxyEventKind, type ResolvedSubscriptionCancelled, type ResolvedSubscriptionCancelScheduled, type ResolvedSubscriptionRenewed, type ResolvedTerminalSession, type ResolveProxyEventOptions, } from "./events.js";
|
|
5
|
+
export { ProxyEventsResource, type ResolvedAcquisitionProgress, type ResolvedIgnored, type ResolvedInitialProvision, type ResolvedPaymentAttempt, type ResolvedPaymentRisk, type ResolvedProxyEvent, type ResolvedProxyEventKind, type ResolvedSubscriptionCancelled, type ResolvedSubscriptionCancelScheduled, type ResolvedSubscriptionRenewed, type ResolvedTerminalSession, type ResolveProxyEventOptions, } from "./events.js";
|
|
6
6
|
export { AT_RISK_SUBSCRIPTION_STATUSES, ENDED_SUBSCRIPTION_STATUSES, isSessionProvisionable, isSessionTerminal, isSubscriptionEnded, isSubscriptionPaymentAtRisk, PROVISIONABLE_SESSION_STATUSES, parseOptionalProxyDate, requireProxyDate, subscriptionAccessEndsAt, subscriptionWillRenew, TERMINAL_SESSION_STATUSES, } from "./lifecycle.js";
|
|
7
|
-
export { type
|
|
7
|
+
export { type AttachProviderAcquisitionObjectInput, type ProviderAcquisition, type ProviderAcquisitionCheckoutUiMode, type ProviderAcquisitionCommercialMode, type ProviderAcquisitionIntegrationPath, type ProviderAcquisitionObjectType, type ProviderAcquisitionObservedCheckoutUiMode, type ProviderAcquisitionPricingMode, type ProviderAcquisitionReservation, ProxyProviderAcquisitionsResource, proxyCheckoutProviderAcquisitionEndpoints, type ReserveProviderAcquisitionInput, type SupersedeProviderAcquisitionInput, } from "./provider-acquisitions.js";
|
|
8
|
+
export { type CreateProxySessionHandoffInput, type CreateProxySessionInput, type CreateProxySessionOptions, type MarkProxySessionProvisionedInput, type MarkProxySessionProvisioningFailedInput, type MerchantProxySession, type PayerHandoffResult, type PayerOpenedResult, type ProxySession, type ProxySessionAcquisitionSummary, type ProxySessionActionableNextStep, ProxySessionCartResource, type ProxySessionCartResult, type ProxySessionHandoff, type ProxySessionPresentationState, type ProxySessionProviderBinding, type ProxySessionProvisioningAcknowledgement, ProxySessionsResource, type ProxySessionViewStatus, proxyCheckoutServerEndpoints, type RecordProviderBindingInput, type SetProxySessionCartInput, type TypedMerchantProxySession, } from "./sessions.js";
|
|
8
9
|
export { type MerchantProxySubscription, ProxySubscriptionsResource, type ProxySubscriptionWithSession, type ProxySubscriptionWithUntypedSession, proxyCheckoutSubscriptionEndpoints, } from "./subscriptions.js";
|
|
9
10
|
export type { JsonObject, JsonPrimitive, JsonValue, ProxyCheckoutFetch, ProxyCheckoutServerClientOptions, ProxyCheckoutServerRequestOptions, } from "./types.js";
|
|
10
11
|
export { proxyCheckoutServerSdkName, proxyCheckoutServerSdkUserAgent, proxyCheckoutServerSdkVersion, } from "./version.js";
|
|
11
|
-
export { isProxyPaymentAttemptEvent, isProxySessionEvent, isProxySubscriptionEvent, PROXY_WEBHOOK_EVENT_TYPES, type ProxyWebhookEventType, } from "./webhook-events.js";
|
|
12
|
+
export { isProxyPaymentAttemptEvent, isProxyProviderAcquisitionEvent, isProxySessionEvent, isProxyShopifyEvent, isProxySubscriptionEvent, PROXY_WEBHOOK_EVENT_TYPES, type ProxyWebhookEventType, } from "./webhook-events.js";
|
|
12
13
|
export { PROXY_WEBHOOK_RETRY_AFTER_SECONDS, type ProxyWebhookClaimResult, type ProxyWebhookHandlerOptions, type ProxyWebhookOutcome, type ProxyWebhookPayloadInput, type ProxyWebhookProcessRecord, type ProxyWebhookProcessResult, type ProxyWebhookProvisioningFailure, type ProxyWebhookProvisioningSuccess, type ProxyWebhookProvisioningSuccessResult, type ProxyWebhookRequestInput, type ProxyWebhookStore, ProxyWebhooksResource, } from "./webhook-handler.js";
|
|
13
14
|
export { type ConstructProxyWebhookEventInput, type CreateWebhookEndpointInput, constructProxyWebhookEvent, PROXY_SIGNATURE_HEADER, ProxyWebhookEndpointsResource, type ProxyWebhookEvent, ProxyWebhookSignatureVerificationError, proxyCheckoutWebhookEndpointEndpoints, type RotateWebhookEndpointSecretInput, type UpdateWebhookEndpointInput, type VerifyProxyWebhookSignatureInput, verifyProxyWebhookSignature, type WebhookEndpoint, type WebhookEndpointSecretResult, } from "./webhooks.js";
|
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.verifyProxyWebhookSignature = exports.proxyCheckoutWebhookEndpointEndpoints = exports.ProxyWebhookSignatureVerificationError = exports.ProxyWebhookEndpointsResource = exports.PROXY_SIGNATURE_HEADER = exports.constructProxyWebhookEvent = exports.ProxyWebhooksResource = exports.PROXY_WEBHOOK_RETRY_AFTER_SECONDS = exports.PROXY_WEBHOOK_EVENT_TYPES = exports.isProxySubscriptionEvent = exports.isProxySessionEvent = exports.isProxyPaymentAttemptEvent = exports.proxyCheckoutServerSdkVersion = exports.proxyCheckoutServerSdkUserAgent = exports.proxyCheckoutServerSdkName = exports.proxyCheckoutSubscriptionEndpoints = exports.ProxySubscriptionsResource = exports.proxyCheckoutServerEndpoints = exports.ProxySessionsResource = exports.ProxySessionCartResource = exports.TERMINAL_SESSION_STATUSES = exports.subscriptionWillRenew = exports.subscriptionAccessEndsAt = exports.requireProxyDate = exports.parseOptionalProxyDate = exports.PROVISIONABLE_SESSION_STATUSES = exports.isSubscriptionPaymentAtRisk = exports.isSubscriptionEnded = exports.isSessionTerminal = exports.isSessionProvisionable = exports.ENDED_SUBSCRIPTION_STATUSES = exports.AT_RISK_SUBSCRIPTION_STATUSES = exports.ProxyEventsResource = exports.ProxyCheckoutValidationError = exports.ProxyCheckoutApiError = exports.PROXY_SESSION_NOT_FOUND_ERROR_CODE = exports.isProxySessionNotFoundError = exports.assertSubscriptionMatchesSession = exports.assertCartBuyerReference = exports.ProxyCheckoutServerClient = exports.createProxyCheckoutServerClient = exports.parseProxyCart = void 0;
|
|
3
|
+
exports.verifyProxyWebhookSignature = exports.proxyCheckoutWebhookEndpointEndpoints = exports.ProxyWebhookSignatureVerificationError = exports.ProxyWebhookEndpointsResource = exports.PROXY_SIGNATURE_HEADER = exports.constructProxyWebhookEvent = exports.ProxyWebhooksResource = exports.PROXY_WEBHOOK_RETRY_AFTER_SECONDS = exports.PROXY_WEBHOOK_EVENT_TYPES = exports.isProxySubscriptionEvent = exports.isProxyShopifyEvent = exports.isProxySessionEvent = exports.isProxyProviderAcquisitionEvent = exports.isProxyPaymentAttemptEvent = exports.proxyCheckoutServerSdkVersion = exports.proxyCheckoutServerSdkUserAgent = exports.proxyCheckoutServerSdkName = exports.proxyCheckoutSubscriptionEndpoints = exports.ProxySubscriptionsResource = exports.proxyCheckoutServerEndpoints = exports.ProxySessionsResource = exports.ProxySessionCartResource = exports.proxyCheckoutProviderAcquisitionEndpoints = exports.ProxyProviderAcquisitionsResource = exports.TERMINAL_SESSION_STATUSES = exports.subscriptionWillRenew = exports.subscriptionAccessEndsAt = exports.requireProxyDate = exports.parseOptionalProxyDate = exports.PROVISIONABLE_SESSION_STATUSES = exports.isSubscriptionPaymentAtRisk = exports.isSubscriptionEnded = exports.isSessionTerminal = exports.isSessionProvisionable = exports.ENDED_SUBSCRIPTION_STATUSES = exports.AT_RISK_SUBSCRIPTION_STATUSES = exports.ProxyEventsResource = exports.ProxyCheckoutValidationError = exports.ProxyCheckoutApiError = exports.PROXY_SESSION_NOT_FOUND_ERROR_CODE = exports.isProxySessionNotFoundError = exports.assertSubscriptionMatchesSession = exports.assertCartBuyerReference = exports.ProxyCheckoutServerClient = exports.createProxyCheckoutServerClient = exports.parseProxyCart = void 0;
|
|
4
4
|
var cart_js_1 = require("./cart.js");
|
|
5
5
|
Object.defineProperty(exports, "parseProxyCart", { enumerable: true, get: function () { return cart_js_1.parseProxyCart; } });
|
|
6
6
|
var client_js_1 = require("./client.js");
|
|
@@ -29,6 +29,9 @@ Object.defineProperty(exports, "requireProxyDate", { enumerable: true, get: func
|
|
|
29
29
|
Object.defineProperty(exports, "subscriptionAccessEndsAt", { enumerable: true, get: function () { return lifecycle_js_1.subscriptionAccessEndsAt; } });
|
|
30
30
|
Object.defineProperty(exports, "subscriptionWillRenew", { enumerable: true, get: function () { return lifecycle_js_1.subscriptionWillRenew; } });
|
|
31
31
|
Object.defineProperty(exports, "TERMINAL_SESSION_STATUSES", { enumerable: true, get: function () { return lifecycle_js_1.TERMINAL_SESSION_STATUSES; } });
|
|
32
|
+
var provider_acquisitions_js_1 = require("./provider-acquisitions.js");
|
|
33
|
+
Object.defineProperty(exports, "ProxyProviderAcquisitionsResource", { enumerable: true, get: function () { return provider_acquisitions_js_1.ProxyProviderAcquisitionsResource; } });
|
|
34
|
+
Object.defineProperty(exports, "proxyCheckoutProviderAcquisitionEndpoints", { enumerable: true, get: function () { return provider_acquisitions_js_1.proxyCheckoutProviderAcquisitionEndpoints; } });
|
|
32
35
|
var sessions_js_1 = require("./sessions.js");
|
|
33
36
|
Object.defineProperty(exports, "ProxySessionCartResource", { enumerable: true, get: function () { return sessions_js_1.ProxySessionCartResource; } });
|
|
34
37
|
Object.defineProperty(exports, "ProxySessionsResource", { enumerable: true, get: function () { return sessions_js_1.ProxySessionsResource; } });
|
|
@@ -42,7 +45,9 @@ Object.defineProperty(exports, "proxyCheckoutServerSdkUserAgent", { enumerable:
|
|
|
42
45
|
Object.defineProperty(exports, "proxyCheckoutServerSdkVersion", { enumerable: true, get: function () { return version_js_1.proxyCheckoutServerSdkVersion; } });
|
|
43
46
|
var webhook_events_js_1 = require("./webhook-events.js");
|
|
44
47
|
Object.defineProperty(exports, "isProxyPaymentAttemptEvent", { enumerable: true, get: function () { return webhook_events_js_1.isProxyPaymentAttemptEvent; } });
|
|
48
|
+
Object.defineProperty(exports, "isProxyProviderAcquisitionEvent", { enumerable: true, get: function () { return webhook_events_js_1.isProxyProviderAcquisitionEvent; } });
|
|
45
49
|
Object.defineProperty(exports, "isProxySessionEvent", { enumerable: true, get: function () { return webhook_events_js_1.isProxySessionEvent; } });
|
|
50
|
+
Object.defineProperty(exports, "isProxyShopifyEvent", { enumerable: true, get: function () { return webhook_events_js_1.isProxyShopifyEvent; } });
|
|
46
51
|
Object.defineProperty(exports, "isProxySubscriptionEvent", { enumerable: true, get: function () { return webhook_events_js_1.isProxySubscriptionEvent; } });
|
|
47
52
|
Object.defineProperty(exports, "PROXY_WEBHOOK_EVENT_TYPES", { enumerable: true, get: function () { return webhook_events_js_1.PROXY_WEBHOOK_EVENT_TYPES; } });
|
|
48
53
|
var webhook_handler_js_1 = require("./webhook-handler.js");
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ProxyCheckoutHttpClient } from "./http-client.js";
|
|
2
|
+
import type { ProxyCheckoutServerRequestOptions } from "./types.js";
|
|
3
|
+
declare const providerAcquisitionCheckoutUiModes: readonly ["custom", "embedded", "hosted"];
|
|
4
|
+
declare const providerAcquisitionObservedCheckoutUiModes: readonly ["custom", "embedded", "hosted", "unknown"];
|
|
5
|
+
declare const providerAcquisitionCommercialModes: readonly ["one_time", "subscription"];
|
|
6
|
+
declare const providerAcquisitionIntegrationPaths: readonly ["checkout_session", "direct_subscription", "payment_intent"];
|
|
7
|
+
declare const providerAcquisitionObjectTypes: readonly ["checkout_session", "payment_intent", "setup_intent", "subscription"];
|
|
8
|
+
declare const providerAcquisitionPricingModes: readonly ["fixed", "provider_finalized"];
|
|
9
|
+
export type ProviderAcquisitionCheckoutUiMode = (typeof providerAcquisitionCheckoutUiModes)[number];
|
|
10
|
+
export type ProviderAcquisitionObservedCheckoutUiMode = (typeof providerAcquisitionObservedCheckoutUiModes)[number];
|
|
11
|
+
export type ProviderAcquisitionCommercialMode = (typeof providerAcquisitionCommercialModes)[number];
|
|
12
|
+
export type ProviderAcquisitionIntegrationPath = (typeof providerAcquisitionIntegrationPaths)[number];
|
|
13
|
+
export type ProviderAcquisitionObjectType = (typeof providerAcquisitionObjectTypes)[number];
|
|
14
|
+
export type ProviderAcquisitionPricingMode = (typeof providerAcquisitionPricingModes)[number];
|
|
15
|
+
export interface ProviderAcquisition {
|
|
16
|
+
readonly attemptNumber: number;
|
|
17
|
+
readonly checkoutUiMode: ProviderAcquisitionObservedCheckoutUiMode | null;
|
|
18
|
+
readonly commercialMode: ProviderAcquisitionCommercialMode;
|
|
19
|
+
readonly completionRecordedAt: string | null;
|
|
20
|
+
readonly createdAt: string;
|
|
21
|
+
readonly directFeeBasisSource: string | null;
|
|
22
|
+
readonly directMerchandiseCurrency: string | null;
|
|
23
|
+
readonly directMerchandiseSubtotalMinor: number | null;
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly integrationPath: ProviderAcquisitionIntegrationPath;
|
|
26
|
+
readonly merchantPspConfigId: string;
|
|
27
|
+
readonly pricingMode: ProviderAcquisitionPricingMode;
|
|
28
|
+
readonly providerCreatedAt: string | null;
|
|
29
|
+
/** Stripe Customer ID retained only as a merchant-authenticated diagnostic. */
|
|
30
|
+
readonly providerCustomerId: string | null;
|
|
31
|
+
readonly providerRetryNotAfter: string;
|
|
32
|
+
readonly providerRootObjectId: string | null;
|
|
33
|
+
readonly providerRootObjectType: ProviderAcquisitionObjectType | null;
|
|
34
|
+
readonly providerSetupIntentId: string | null;
|
|
35
|
+
readonly proxySessionId: string;
|
|
36
|
+
readonly psp: "stripe";
|
|
37
|
+
readonly status: string;
|
|
38
|
+
readonly statusReason: string | null;
|
|
39
|
+
readonly supersedesAttemptId: string | null;
|
|
40
|
+
readonly updatedAt: string;
|
|
41
|
+
readonly version: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ProviderAcquisitionReservation {
|
|
44
|
+
readonly acquisitionAttempt: ProviderAcquisition;
|
|
45
|
+
readonly stripe: {
|
|
46
|
+
readonly idempotencyKeys: {
|
|
47
|
+
readonly root: string;
|
|
48
|
+
readonly setupIntent?: string;
|
|
49
|
+
};
|
|
50
|
+
readonly metadata: {
|
|
51
|
+
readonly proxyAcquisitionAttemptId: string;
|
|
52
|
+
readonly proxyContractVersion: "2";
|
|
53
|
+
readonly proxySessionId: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface ReserveProviderAcquisitionInput extends ProxyCheckoutServerRequestOptions {
|
|
58
|
+
readonly checkoutUiMode?: ProviderAcquisitionCheckoutUiMode;
|
|
59
|
+
readonly commercialMode: ProviderAcquisitionCommercialMode;
|
|
60
|
+
readonly integrationPath: ProviderAcquisitionIntegrationPath;
|
|
61
|
+
/** Optional server-only direct PaymentIntent percentage basis; omit to use verified provider gross. */
|
|
62
|
+
readonly merchandiseSubtotalMinor?: number;
|
|
63
|
+
readonly pricingMode: ProviderAcquisitionPricingMode;
|
|
64
|
+
readonly providerOptionsFingerprint: string;
|
|
65
|
+
}
|
|
66
|
+
export interface AttachProviderAcquisitionObjectInput extends ProxyCheckoutServerRequestOptions {
|
|
67
|
+
readonly expectedVersion: number;
|
|
68
|
+
readonly objectId: string;
|
|
69
|
+
readonly objectType: ProviderAcquisitionObjectType;
|
|
70
|
+
readonly role: "root" | "setup_intent";
|
|
71
|
+
}
|
|
72
|
+
export interface SupersedeProviderAcquisitionInput extends ProxyCheckoutServerRequestOptions {
|
|
73
|
+
readonly expectedVersion: number;
|
|
74
|
+
readonly reason: string;
|
|
75
|
+
readonly replacement: {
|
|
76
|
+
readonly checkoutUiMode?: ProviderAcquisitionCheckoutUiMode;
|
|
77
|
+
readonly integrationPath: ProviderAcquisitionIntegrationPath;
|
|
78
|
+
readonly providerOptionsFingerprint: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare const proxyCheckoutProviderAcquisitionEndpoints: readonly [{
|
|
82
|
+
readonly method: "POST";
|
|
83
|
+
readonly operation: "providerAcquisitions.reserveProviderAcquisition";
|
|
84
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts";
|
|
85
|
+
}, {
|
|
86
|
+
readonly method: "POST";
|
|
87
|
+
readonly operation: "providerAcquisitions.attachProviderAcquisitionObject";
|
|
88
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts/:acquisition_attempt_id/provider_objects";
|
|
89
|
+
}, {
|
|
90
|
+
readonly method: "POST";
|
|
91
|
+
readonly operation: "providerAcquisitions.supersedeProviderAcquisition";
|
|
92
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts/:acquisition_attempt_id/supersede";
|
|
93
|
+
}, {
|
|
94
|
+
readonly method: "GET";
|
|
95
|
+
readonly operation: "providerAcquisitions.listProviderAcquisitions";
|
|
96
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts";
|
|
97
|
+
}];
|
|
98
|
+
export declare class ProxyProviderAcquisitionsResource {
|
|
99
|
+
private readonly httpClient;
|
|
100
|
+
constructor(httpClient: ProxyCheckoutHttpClient);
|
|
101
|
+
reserveProviderAcquisition(proxySessionId: string, input: ReserveProviderAcquisitionInput): Promise<ProviderAcquisitionReservation>;
|
|
102
|
+
attachProviderAcquisitionObject(proxySessionId: string, acquisitionAttemptId: string, input: AttachProviderAcquisitionObjectInput): Promise<ProviderAcquisition>;
|
|
103
|
+
supersedeProviderAcquisition(proxySessionId: string, acquisitionAttemptId: string, input: SupersedeProviderAcquisitionInput): Promise<ProviderAcquisitionReservation>;
|
|
104
|
+
listProviderAcquisitions(proxySessionId: string, options?: ProxyCheckoutServerRequestOptions): Promise<ProviderAcquisition[]>;
|
|
105
|
+
}
|
|
106
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { ProxyCheckoutHttpClient } from "./http-client.js";
|
|
2
|
+
import type { ProxyCheckoutServerRequestOptions } from "./types.js";
|
|
3
|
+
declare const providerAcquisitionCheckoutUiModes: readonly ["custom", "embedded", "hosted"];
|
|
4
|
+
declare const providerAcquisitionObservedCheckoutUiModes: readonly ["custom", "embedded", "hosted", "unknown"];
|
|
5
|
+
declare const providerAcquisitionCommercialModes: readonly ["one_time", "subscription"];
|
|
6
|
+
declare const providerAcquisitionIntegrationPaths: readonly ["checkout_session", "direct_subscription", "payment_intent"];
|
|
7
|
+
declare const providerAcquisitionObjectTypes: readonly ["checkout_session", "payment_intent", "setup_intent", "subscription"];
|
|
8
|
+
declare const providerAcquisitionPricingModes: readonly ["fixed", "provider_finalized"];
|
|
9
|
+
export type ProviderAcquisitionCheckoutUiMode = (typeof providerAcquisitionCheckoutUiModes)[number];
|
|
10
|
+
export type ProviderAcquisitionObservedCheckoutUiMode = (typeof providerAcquisitionObservedCheckoutUiModes)[number];
|
|
11
|
+
export type ProviderAcquisitionCommercialMode = (typeof providerAcquisitionCommercialModes)[number];
|
|
12
|
+
export type ProviderAcquisitionIntegrationPath = (typeof providerAcquisitionIntegrationPaths)[number];
|
|
13
|
+
export type ProviderAcquisitionObjectType = (typeof providerAcquisitionObjectTypes)[number];
|
|
14
|
+
export type ProviderAcquisitionPricingMode = (typeof providerAcquisitionPricingModes)[number];
|
|
15
|
+
export interface ProviderAcquisition {
|
|
16
|
+
readonly attemptNumber: number;
|
|
17
|
+
readonly checkoutUiMode: ProviderAcquisitionObservedCheckoutUiMode | null;
|
|
18
|
+
readonly commercialMode: ProviderAcquisitionCommercialMode;
|
|
19
|
+
readonly completionRecordedAt: string | null;
|
|
20
|
+
readonly createdAt: string;
|
|
21
|
+
readonly directFeeBasisSource: string | null;
|
|
22
|
+
readonly directMerchandiseCurrency: string | null;
|
|
23
|
+
readonly directMerchandiseSubtotalMinor: number | null;
|
|
24
|
+
readonly id: string;
|
|
25
|
+
readonly integrationPath: ProviderAcquisitionIntegrationPath;
|
|
26
|
+
readonly merchantPspConfigId: string;
|
|
27
|
+
readonly pricingMode: ProviderAcquisitionPricingMode;
|
|
28
|
+
readonly providerCreatedAt: string | null;
|
|
29
|
+
/** Stripe Customer ID retained only as a merchant-authenticated diagnostic. */
|
|
30
|
+
readonly providerCustomerId: string | null;
|
|
31
|
+
readonly providerRetryNotAfter: string;
|
|
32
|
+
readonly providerRootObjectId: string | null;
|
|
33
|
+
readonly providerRootObjectType: ProviderAcquisitionObjectType | null;
|
|
34
|
+
readonly providerSetupIntentId: string | null;
|
|
35
|
+
readonly proxySessionId: string;
|
|
36
|
+
readonly psp: "stripe";
|
|
37
|
+
readonly status: string;
|
|
38
|
+
readonly statusReason: string | null;
|
|
39
|
+
readonly supersedesAttemptId: string | null;
|
|
40
|
+
readonly updatedAt: string;
|
|
41
|
+
readonly version: number;
|
|
42
|
+
}
|
|
43
|
+
export interface ProviderAcquisitionReservation {
|
|
44
|
+
readonly acquisitionAttempt: ProviderAcquisition;
|
|
45
|
+
readonly stripe: {
|
|
46
|
+
readonly idempotencyKeys: {
|
|
47
|
+
readonly root: string;
|
|
48
|
+
readonly setupIntent?: string;
|
|
49
|
+
};
|
|
50
|
+
readonly metadata: {
|
|
51
|
+
readonly proxyAcquisitionAttemptId: string;
|
|
52
|
+
readonly proxyContractVersion: "2";
|
|
53
|
+
readonly proxySessionId: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export interface ReserveProviderAcquisitionInput extends ProxyCheckoutServerRequestOptions {
|
|
58
|
+
readonly checkoutUiMode?: ProviderAcquisitionCheckoutUiMode;
|
|
59
|
+
readonly commercialMode: ProviderAcquisitionCommercialMode;
|
|
60
|
+
readonly integrationPath: ProviderAcquisitionIntegrationPath;
|
|
61
|
+
/** Optional server-only direct PaymentIntent percentage basis; omit to use verified provider gross. */
|
|
62
|
+
readonly merchandiseSubtotalMinor?: number;
|
|
63
|
+
readonly pricingMode: ProviderAcquisitionPricingMode;
|
|
64
|
+
readonly providerOptionsFingerprint: string;
|
|
65
|
+
}
|
|
66
|
+
export interface AttachProviderAcquisitionObjectInput extends ProxyCheckoutServerRequestOptions {
|
|
67
|
+
readonly expectedVersion: number;
|
|
68
|
+
readonly objectId: string;
|
|
69
|
+
readonly objectType: ProviderAcquisitionObjectType;
|
|
70
|
+
readonly role: "root" | "setup_intent";
|
|
71
|
+
}
|
|
72
|
+
export interface SupersedeProviderAcquisitionInput extends ProxyCheckoutServerRequestOptions {
|
|
73
|
+
readonly expectedVersion: number;
|
|
74
|
+
readonly reason: string;
|
|
75
|
+
readonly replacement: {
|
|
76
|
+
readonly checkoutUiMode?: ProviderAcquisitionCheckoutUiMode;
|
|
77
|
+
readonly integrationPath: ProviderAcquisitionIntegrationPath;
|
|
78
|
+
readonly providerOptionsFingerprint: string;
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
export declare const proxyCheckoutProviderAcquisitionEndpoints: readonly [{
|
|
82
|
+
readonly method: "POST";
|
|
83
|
+
readonly operation: "providerAcquisitions.reserveProviderAcquisition";
|
|
84
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts";
|
|
85
|
+
}, {
|
|
86
|
+
readonly method: "POST";
|
|
87
|
+
readonly operation: "providerAcquisitions.attachProviderAcquisitionObject";
|
|
88
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts/:acquisition_attempt_id/provider_objects";
|
|
89
|
+
}, {
|
|
90
|
+
readonly method: "POST";
|
|
91
|
+
readonly operation: "providerAcquisitions.supersedeProviderAcquisition";
|
|
92
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts/:acquisition_attempt_id/supersede";
|
|
93
|
+
}, {
|
|
94
|
+
readonly method: "GET";
|
|
95
|
+
readonly operation: "providerAcquisitions.listProviderAcquisitions";
|
|
96
|
+
readonly path: "/proxy_sessions/:proxy_session_id/acquisition_attempts";
|
|
97
|
+
}];
|
|
98
|
+
export declare class ProxyProviderAcquisitionsResource {
|
|
99
|
+
private readonly httpClient;
|
|
100
|
+
constructor(httpClient: ProxyCheckoutHttpClient);
|
|
101
|
+
reserveProviderAcquisition(proxySessionId: string, input: ReserveProviderAcquisitionInput): Promise<ProviderAcquisitionReservation>;
|
|
102
|
+
attachProviderAcquisitionObject(proxySessionId: string, acquisitionAttemptId: string, input: AttachProviderAcquisitionObjectInput): Promise<ProviderAcquisition>;
|
|
103
|
+
supersedeProviderAcquisition(proxySessionId: string, acquisitionAttemptId: string, input: SupersedeProviderAcquisitionInput): Promise<ProviderAcquisitionReservation>;
|
|
104
|
+
listProviderAcquisitions(proxySessionId: string, options?: ProxyCheckoutServerRequestOptions): Promise<ProviderAcquisition[]>;
|
|
105
|
+
}
|
|
106
|
+
export {};
|