@paygentic/sdk 0.6.12 → 0.6.13
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 +12 -3
- package/dist/commonjs/funcs/paymentsCreate.d.ts +19 -0
- package/dist/commonjs/funcs/paymentsCreate.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentsCreate.js +119 -0
- package/dist/commonjs/funcs/paymentsCreate.js.map +1 -0
- package/dist/commonjs/funcs/paymentsGet.d.ts +19 -0
- package/dist/commonjs/funcs/paymentsGet.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentsGet.js +124 -0
- package/dist/commonjs/funcs/paymentsGet.js.map +1 -0
- package/dist/commonjs/funcs/paymentsList.d.ts +18 -0
- package/dist/commonjs/funcs/paymentsList.d.ts.map +1 -0
- package/dist/commonjs/funcs/paymentsList.js +125 -0
- package/dist/commonjs/funcs/paymentsList.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +3 -3
- package/dist/commonjs/lib/config.js +3 -3
- package/dist/commonjs/lib/config.js.map +1 -1
- package/dist/commonjs/lib/matchers.d.ts.map +1 -1
- package/dist/commonjs/lib/matchers.js +0 -1
- package/dist/commonjs/lib/matchers.js.map +1 -1
- package/dist/commonjs/lib/security.d.ts.map +1 -1
- package/dist/commonjs/lib/security.js +1 -2
- package/dist/commonjs/lib/security.js.map +1 -1
- package/dist/commonjs/models/index.d.ts +1 -0
- package/dist/commonjs/models/index.d.ts.map +1 -1
- package/dist/commonjs/models/index.js +1 -0
- package/dist/commonjs/models/index.js.map +1 -1
- package/dist/commonjs/models/operations/createpayment.d.ts +113 -0
- package/dist/commonjs/models/operations/createpayment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createpayment.js +82 -0
- package/dist/commonjs/models/operations/createpayment.js.map +1 -0
- package/dist/commonjs/models/operations/createpaymentsession.d.ts +113 -0
- package/dist/commonjs/models/operations/createpaymentsession.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createpaymentsession.js +82 -0
- package/dist/commonjs/models/operations/createpaymentsession.js.map +1 -0
- package/dist/commonjs/models/operations/createplan.d.ts +18 -0
- package/dist/commonjs/models/operations/createplan.d.ts.map +1 -1
- package/dist/commonjs/models/operations/createplan.js +11 -1
- package/dist/commonjs/models/operations/createplan.js.map +1 -1
- package/dist/commonjs/models/operations/getpayment.d.ts +15 -0
- package/dist/commonjs/models/operations/getpayment.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getpayment.js +49 -0
- package/dist/commonjs/models/operations/getpayment.js.map +1 -0
- package/dist/commonjs/models/operations/getpaymentsession.d.ts +15 -0
- package/dist/commonjs/models/operations/getpaymentsession.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getpaymentsession.js +49 -0
- package/dist/commonjs/models/operations/getpaymentsession.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/models/operations/listpayments.d.ts +75 -0
- package/dist/commonjs/models/operations/listpayments.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listpayments.js +82 -0
- package/dist/commonjs/models/operations/listpayments.js.map +1 -0
- package/dist/commonjs/models/operations/listpaymentsessions.d.ts +75 -0
- package/dist/commonjs/models/operations/listpaymentsessions.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listpaymentsessions.js +82 -0
- package/dist/commonjs/models/operations/listpaymentsessions.js.map +1 -0
- package/dist/commonjs/models/payment.d.ts +91 -0
- package/dist/commonjs/models/payment.d.ts.map +1 -0
- package/dist/commonjs/models/payment.js +90 -0
- package/dist/commonjs/models/payment.js.map +1 -0
- package/dist/commonjs/models/subscription.d.ts +8 -4
- package/dist/commonjs/models/subscription.d.ts.map +1 -1
- package/dist/commonjs/models/subscription.js +7 -6
- package/dist/commonjs/models/subscription.js.map +1 -1
- package/dist/commonjs/sdk/payments.d.ts +27 -0
- package/dist/commonjs/sdk/payments.d.ts.map +1 -0
- package/dist/commonjs/sdk/payments.js +42 -0
- package/dist/commonjs/sdk/payments.js.map +1 -0
- package/dist/commonjs/sdk/sdk.d.ts +3 -0
- package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
- package/dist/commonjs/sdk/sdk.js +4 -0
- package/dist/commonjs/sdk/sdk.js.map +1 -1
- package/dist/esm/funcs/paymentsCreate.d.ts +19 -0
- package/dist/esm/funcs/paymentsCreate.d.ts.map +1 -0
- package/dist/esm/funcs/paymentsCreate.js +83 -0
- package/dist/esm/funcs/paymentsCreate.js.map +1 -0
- package/dist/esm/funcs/paymentsGet.d.ts +19 -0
- package/dist/esm/funcs/paymentsGet.d.ts.map +1 -0
- package/dist/esm/funcs/paymentsGet.js +88 -0
- package/dist/esm/funcs/paymentsGet.js.map +1 -0
- package/dist/esm/funcs/paymentsList.d.ts +18 -0
- package/dist/esm/funcs/paymentsList.d.ts.map +1 -0
- package/dist/esm/funcs/paymentsList.js +89 -0
- package/dist/esm/funcs/paymentsList.js.map +1 -0
- package/dist/esm/lib/config.d.ts +3 -3
- package/dist/esm/lib/config.js +3 -3
- package/dist/esm/lib/config.js.map +1 -1
- package/dist/esm/lib/matchers.d.ts.map +1 -1
- package/dist/esm/lib/matchers.js +0 -1
- package/dist/esm/lib/matchers.js.map +1 -1
- package/dist/esm/lib/security.d.ts.map +1 -1
- package/dist/esm/lib/security.js +1 -2
- package/dist/esm/lib/security.js.map +1 -1
- package/dist/esm/models/index.d.ts +1 -0
- package/dist/esm/models/index.d.ts.map +1 -1
- package/dist/esm/models/index.js +1 -0
- package/dist/esm/models/index.js.map +1 -1
- package/dist/esm/models/operations/createpayment.d.ts +113 -0
- package/dist/esm/models/operations/createpayment.d.ts.map +1 -0
- package/dist/esm/models/operations/createpayment.js +44 -0
- package/dist/esm/models/operations/createpayment.js.map +1 -0
- package/dist/esm/models/operations/createpaymentsession.d.ts +113 -0
- package/dist/esm/models/operations/createpaymentsession.d.ts.map +1 -0
- package/dist/esm/models/operations/createpaymentsession.js +44 -0
- package/dist/esm/models/operations/createpaymentsession.js.map +1 -0
- package/dist/esm/models/operations/createplan.d.ts +18 -0
- package/dist/esm/models/operations/createplan.d.ts.map +1 -1
- package/dist/esm/models/operations/createplan.js +10 -0
- package/dist/esm/models/operations/createplan.js.map +1 -1
- package/dist/esm/models/operations/getpayment.d.ts +15 -0
- package/dist/esm/models/operations/getpayment.d.ts.map +1 -0
- package/dist/esm/models/operations/getpayment.js +12 -0
- package/dist/esm/models/operations/getpayment.js.map +1 -0
- package/dist/esm/models/operations/getpaymentsession.d.ts +15 -0
- package/dist/esm/models/operations/getpaymentsession.d.ts.map +1 -0
- package/dist/esm/models/operations/getpaymentsession.js +12 -0
- package/dist/esm/models/operations/getpaymentsession.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/models/operations/listpayments.d.ts +75 -0
- package/dist/esm/models/operations/listpayments.d.ts.map +1 -0
- package/dist/esm/models/operations/listpayments.js +44 -0
- package/dist/esm/models/operations/listpayments.js.map +1 -0
- package/dist/esm/models/operations/listpaymentsessions.d.ts +75 -0
- package/dist/esm/models/operations/listpaymentsessions.d.ts.map +1 -0
- package/dist/esm/models/operations/listpaymentsessions.js +44 -0
- package/dist/esm/models/operations/listpaymentsessions.js.map +1 -0
- package/dist/esm/models/payment.d.ts +91 -0
- package/dist/esm/models/payment.d.ts.map +1 -0
- package/dist/esm/models/payment.js +52 -0
- package/dist/esm/models/payment.js.map +1 -0
- package/dist/esm/models/subscription.d.ts +8 -4
- package/dist/esm/models/subscription.d.ts.map +1 -1
- package/dist/esm/models/subscription.js +5 -4
- package/dist/esm/models/subscription.js.map +1 -1
- package/dist/esm/sdk/payments.d.ts +27 -0
- package/dist/esm/sdk/payments.d.ts.map +1 -0
- package/dist/esm/sdk/payments.js +38 -0
- package/dist/esm/sdk/payments.js.map +1 -0
- package/dist/esm/sdk/sdk.d.ts +3 -0
- package/dist/esm/sdk/sdk.d.ts.map +1 -1
- package/dist/esm/sdk/sdk.js +4 -0
- package/dist/esm/sdk/sdk.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +2 -2
- package/src/funcs/paymentsCreate.ts +175 -0
- package/src/funcs/paymentsGet.ts +177 -0
- package/src/funcs/paymentsList.ts +179 -0
- package/src/lib/config.ts +3 -3
- package/src/lib/matchers.ts +3 -2
- package/src/lib/security.ts +1 -2
- package/src/models/index.ts +1 -0
- package/src/models/operations/createpayment.ts +156 -0
- package/src/models/operations/createpaymentsession.ts +158 -0
- package/src/models/operations/createplan.ts +23 -0
- package/src/models/operations/getpayment.ts +34 -0
- package/src/models/operations/getpaymentsession.ts +34 -0
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/listpayments.ts +126 -0
- package/src/models/operations/listpaymentsessions.ts +130 -0
- package/src/models/payment.ts +149 -0
- package/src/models/subscription.ts +24 -16
- package/src/sdk/payments.ts +64 -0
- package/src/sdk/sdk.ts +6 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ISO 4217 currency code.
|
|
10
|
+
*/
|
|
11
|
+
export const Currency = {
|
|
12
|
+
Usd: "USD",
|
|
13
|
+
Eur: "EUR",
|
|
14
|
+
Gbp: "GBP",
|
|
15
|
+
Aud: "AUD",
|
|
16
|
+
} as const;
|
|
17
|
+
/**
|
|
18
|
+
* ISO 4217 currency code.
|
|
19
|
+
*/
|
|
20
|
+
export type Currency = ClosedEnum<typeof Currency>;
|
|
21
|
+
|
|
22
|
+
export type LineItem = {
|
|
23
|
+
/**
|
|
24
|
+
* Line item description.
|
|
25
|
+
*/
|
|
26
|
+
description: string;
|
|
27
|
+
/**
|
|
28
|
+
* Line item amount in decimal format (e.g. '5.00').
|
|
29
|
+
*/
|
|
30
|
+
amount: string;
|
|
31
|
+
/**
|
|
32
|
+
* Quantity of this line item. Defaults to 1.
|
|
33
|
+
*/
|
|
34
|
+
quantity?: number | undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export type CreatePaymentSessionRequest = {
|
|
38
|
+
/**
|
|
39
|
+
* Payment amount in decimal format (e.g. '10.50'). Minimum 1.00, maximum 5,000.00. Contact support for higher limits.
|
|
40
|
+
*/
|
|
41
|
+
amount: string;
|
|
42
|
+
/**
|
|
43
|
+
* ISO 4217 currency code.
|
|
44
|
+
*/
|
|
45
|
+
currency: Currency;
|
|
46
|
+
/**
|
|
47
|
+
* Merchant organization ID. Required when using an API key that is not scoped to a single merchant.
|
|
48
|
+
*/
|
|
49
|
+
merchantId?: string | undefined;
|
|
50
|
+
/**
|
|
51
|
+
* Optional customer ID. Must belong to this merchant.
|
|
52
|
+
*/
|
|
53
|
+
customerId?: string | undefined;
|
|
54
|
+
/**
|
|
55
|
+
* Client-provided key for safe retries. If a payment with the same key already exists, the existing payment is returned.
|
|
56
|
+
*/
|
|
57
|
+
idempotencyKey?: string | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* Merchant-defined reference for this payment (e.g. order ID, invoice number).
|
|
60
|
+
*/
|
|
61
|
+
reference?: string | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* Arbitrary key-value string pairs to attach to the payment.
|
|
64
|
+
*/
|
|
65
|
+
metadata?: { [k: string]: string } | undefined;
|
|
66
|
+
/**
|
|
67
|
+
* Optional breakdown of what the customer is being charged for.
|
|
68
|
+
*/
|
|
69
|
+
lineItems?: Array<LineItem> | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* URL to redirect the customer to after a successful payment.
|
|
72
|
+
*/
|
|
73
|
+
successRedirectUrl?: string | undefined;
|
|
74
|
+
/**
|
|
75
|
+
* URL to redirect the customer to after a failed payment.
|
|
76
|
+
*/
|
|
77
|
+
failureRedirectUrl?: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Whether to save the customer's payment method for future use. Defaults to false.
|
|
80
|
+
*/
|
|
81
|
+
savePaymentMethod?: boolean | undefined;
|
|
82
|
+
/**
|
|
83
|
+
* ISO 8601 duration for the payment lifetime. Defaults to P30D (30 days). Maximum is P31D (31 days). Examples: PT1H, P1D, P7D, P30D.
|
|
84
|
+
*/
|
|
85
|
+
expiresIn?: string | undefined;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/** @internal */
|
|
89
|
+
export const Currency$outboundSchema: z.ZodNativeEnum<typeof Currency> = z
|
|
90
|
+
.nativeEnum(Currency);
|
|
91
|
+
|
|
92
|
+
/** @internal */
|
|
93
|
+
export type LineItem$Outbound = {
|
|
94
|
+
description: string;
|
|
95
|
+
amount: string;
|
|
96
|
+
quantity: number;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
/** @internal */
|
|
100
|
+
export const LineItem$outboundSchema: z.ZodType<
|
|
101
|
+
LineItem$Outbound,
|
|
102
|
+
z.ZodTypeDef,
|
|
103
|
+
LineItem
|
|
104
|
+
> = z.object({
|
|
105
|
+
description: z.string(),
|
|
106
|
+
amount: z.string(),
|
|
107
|
+
quantity: z.number().int().default(1),
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
export function lineItemToJSON(lineItem: LineItem): string {
|
|
111
|
+
return JSON.stringify(LineItem$outboundSchema.parse(lineItem));
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** @internal */
|
|
115
|
+
export type CreatePaymentSessionRequest$Outbound = {
|
|
116
|
+
amount: string;
|
|
117
|
+
currency: string;
|
|
118
|
+
merchantId?: string | undefined;
|
|
119
|
+
customerId?: string | undefined;
|
|
120
|
+
idempotencyKey?: string | undefined;
|
|
121
|
+
reference?: string | undefined;
|
|
122
|
+
metadata?: { [k: string]: string } | undefined;
|
|
123
|
+
lineItems?: Array<LineItem$Outbound> | undefined;
|
|
124
|
+
successRedirectUrl?: string | undefined;
|
|
125
|
+
failureRedirectUrl?: string | undefined;
|
|
126
|
+
savePaymentMethod: boolean;
|
|
127
|
+
expiresIn?: string | undefined;
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/** @internal */
|
|
131
|
+
export const CreatePaymentSessionRequest$outboundSchema: z.ZodType<
|
|
132
|
+
CreatePaymentSessionRequest$Outbound,
|
|
133
|
+
z.ZodTypeDef,
|
|
134
|
+
CreatePaymentSessionRequest
|
|
135
|
+
> = z.object({
|
|
136
|
+
amount: z.string(),
|
|
137
|
+
currency: Currency$outboundSchema,
|
|
138
|
+
merchantId: z.string().optional(),
|
|
139
|
+
customerId: z.string().optional(),
|
|
140
|
+
idempotencyKey: z.string().optional(),
|
|
141
|
+
reference: z.string().optional(),
|
|
142
|
+
metadata: z.record(z.string()).optional(),
|
|
143
|
+
lineItems: z.array(z.lazy(() => LineItem$outboundSchema)).optional(),
|
|
144
|
+
successRedirectUrl: z.string().optional(),
|
|
145
|
+
failureRedirectUrl: z.string().optional(),
|
|
146
|
+
savePaymentMethod: z.boolean().default(false),
|
|
147
|
+
expiresIn: z.string().optional(),
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
export function createPaymentSessionRequestToJSON(
|
|
151
|
+
createPaymentSessionRequest: CreatePaymentSessionRequest,
|
|
152
|
+
): string {
|
|
153
|
+
return JSON.stringify(
|
|
154
|
+
CreatePaymentSessionRequest$outboundSchema.parse(
|
|
155
|
+
createPaymentSessionRequest,
|
|
156
|
+
),
|
|
157
|
+
);
|
|
158
|
+
}
|
|
@@ -17,6 +17,18 @@ export const CreatePlanTaxBehavior = {
|
|
|
17
17
|
*/
|
|
18
18
|
export type CreatePlanTaxBehavior = ClosedEnum<typeof CreatePlanTaxBehavior>;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
|
|
22
|
+
*/
|
|
23
|
+
export const BillingVersion = {
|
|
24
|
+
Zero: 0,
|
|
25
|
+
One: 1,
|
|
26
|
+
} as const;
|
|
27
|
+
/**
|
|
28
|
+
* Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
|
|
29
|
+
*/
|
|
30
|
+
export type BillingVersion = ClosedEnum<typeof BillingVersion>;
|
|
31
|
+
|
|
20
32
|
export type CreatePlanRequest = {
|
|
21
33
|
/**
|
|
22
34
|
* Recurring billing period frequency. Sample values: 'monthly' for monthly billing, 'yearly' for annual billing, 'weekly' for weekly billing
|
|
@@ -70,6 +82,10 @@ export type CreatePlanRequest = {
|
|
|
70
82
|
* Number of days before renewal to send the reminder email
|
|
71
83
|
*/
|
|
72
84
|
renewalReminderDays?: number | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Billing engine version. 0 = legacy fee-schedule billing (Legacy), 1 = line-item billing with metered usage support (Standard).
|
|
87
|
+
*/
|
|
88
|
+
billingVersion?: BillingVersion | undefined;
|
|
73
89
|
};
|
|
74
90
|
|
|
75
91
|
/** @internal */
|
|
@@ -77,6 +93,11 @@ export const CreatePlanTaxBehavior$outboundSchema: z.ZodNativeEnum<
|
|
|
77
93
|
typeof CreatePlanTaxBehavior
|
|
78
94
|
> = z.nativeEnum(CreatePlanTaxBehavior);
|
|
79
95
|
|
|
96
|
+
/** @internal */
|
|
97
|
+
export const BillingVersion$outboundSchema: z.ZodNativeEnum<
|
|
98
|
+
typeof BillingVersion
|
|
99
|
+
> = z.nativeEnum(BillingVersion);
|
|
100
|
+
|
|
80
101
|
/** @internal */
|
|
81
102
|
export type CreatePlanRequest$Outbound = {
|
|
82
103
|
billingInterval?: string | undefined;
|
|
@@ -92,6 +113,7 @@ export type CreatePlanRequest$Outbound = {
|
|
|
92
113
|
taxBehavior: string;
|
|
93
114
|
renewalReminderEnabled: boolean;
|
|
94
115
|
renewalReminderDays: number;
|
|
116
|
+
billingVersion: number;
|
|
95
117
|
};
|
|
96
118
|
|
|
97
119
|
/** @internal */
|
|
@@ -113,6 +135,7 @@ export const CreatePlanRequest$outboundSchema: z.ZodType<
|
|
|
113
135
|
taxBehavior: CreatePlanTaxBehavior$outboundSchema.default("exclusive"),
|
|
114
136
|
renewalReminderEnabled: z.boolean().default(true),
|
|
115
137
|
renewalReminderDays: z.number().int().default(3),
|
|
138
|
+
billingVersion: BillingVersion$outboundSchema.default(0),
|
|
116
139
|
});
|
|
117
140
|
|
|
118
141
|
export function createPlanRequestToJSON(
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type GetPaymentRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* Payment session ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type GetPaymentRequest$Outbound = {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const GetPaymentRequest$outboundSchema: z.ZodType<
|
|
21
|
+
GetPaymentRequest$Outbound,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
GetPaymentRequest
|
|
24
|
+
> = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function getPaymentRequestToJSON(
|
|
29
|
+
getPaymentRequest: GetPaymentRequest,
|
|
30
|
+
): string {
|
|
31
|
+
return JSON.stringify(
|
|
32
|
+
GetPaymentRequest$outboundSchema.parse(getPaymentRequest),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
|
|
7
|
+
export type GetPaymentSessionRequest = {
|
|
8
|
+
/**
|
|
9
|
+
* Payment session ID
|
|
10
|
+
*/
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/** @internal */
|
|
15
|
+
export type GetPaymentSessionRequest$Outbound = {
|
|
16
|
+
id: string;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const GetPaymentSessionRequest$outboundSchema: z.ZodType<
|
|
21
|
+
GetPaymentSessionRequest$Outbound,
|
|
22
|
+
z.ZodTypeDef,
|
|
23
|
+
GetPaymentSessionRequest
|
|
24
|
+
> = z.object({
|
|
25
|
+
id: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
export function getPaymentSessionRequestToJSON(
|
|
29
|
+
getPaymentSessionRequest: GetPaymentSessionRequest,
|
|
30
|
+
): string {
|
|
31
|
+
return JSON.stringify(
|
|
32
|
+
GetPaymentSessionRequest$outboundSchema.parse(getPaymentSessionRequest),
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -11,6 +11,7 @@ export * from "./createbillablemetric.js";
|
|
|
11
11
|
export * from "./createcustomer.js";
|
|
12
12
|
export * from "./createfeature.js";
|
|
13
13
|
export * from "./createfee.js";
|
|
14
|
+
export * from "./createpayment.js";
|
|
14
15
|
export * from "./createplan.js";
|
|
15
16
|
export * from "./createprice.js";
|
|
16
17
|
export * from "./createproduct.js";
|
|
@@ -34,6 +35,7 @@ export * from "./getfee.js";
|
|
|
34
35
|
export * from "./getfeeprice.js";
|
|
35
36
|
export * from "./getinvoice.js";
|
|
36
37
|
export * from "./getinvoicelineitems.js";
|
|
38
|
+
export * from "./getpayment.js";
|
|
37
39
|
export * from "./getplan.js";
|
|
38
40
|
export * from "./getprice.js";
|
|
39
41
|
export * from "./getproduct.js";
|
|
@@ -53,6 +55,7 @@ export * from "./listentitlements.js";
|
|
|
53
55
|
export * from "./listfeatures.js";
|
|
54
56
|
export * from "./listfees.js";
|
|
55
57
|
export * from "./listinvoices.js";
|
|
58
|
+
export * from "./listpayments.js";
|
|
56
59
|
export * from "./listplans.js";
|
|
57
60
|
export * from "./listprices.js";
|
|
58
61
|
export * from "./listproducts.js";
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import * as models from "../index.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Filter by payment status.
|
|
14
|
+
*/
|
|
15
|
+
export const ListPaymentsStatus = {
|
|
16
|
+
Pending: "pending",
|
|
17
|
+
Processing: "processing",
|
|
18
|
+
Completed: "completed",
|
|
19
|
+
Expired: "expired",
|
|
20
|
+
Cancelled: "cancelled",
|
|
21
|
+
} as const;
|
|
22
|
+
/**
|
|
23
|
+
* Filter by payment status.
|
|
24
|
+
*/
|
|
25
|
+
export type ListPaymentsStatus = ClosedEnum<typeof ListPaymentsStatus>;
|
|
26
|
+
|
|
27
|
+
export type ListPaymentsRequest = {
|
|
28
|
+
/**
|
|
29
|
+
* Merchant organization ID. Required when using an API key that is not scoped to a single merchant.
|
|
30
|
+
*/
|
|
31
|
+
merchantId?: string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Filter by payment status.
|
|
34
|
+
*/
|
|
35
|
+
status?: ListPaymentsStatus | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* Filter by customer ID.
|
|
38
|
+
*/
|
|
39
|
+
customerId?: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Number of payments to return.
|
|
42
|
+
*/
|
|
43
|
+
limit?: number | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Number of payments to skip.
|
|
46
|
+
*/
|
|
47
|
+
offset?: number | undefined;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const ListPaymentsObject = {
|
|
51
|
+
List: "list",
|
|
52
|
+
} as const;
|
|
53
|
+
export type ListPaymentsObject = ClosedEnum<typeof ListPaymentsObject>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* List of payments
|
|
57
|
+
*/
|
|
58
|
+
export type ListPaymentsResponse = {
|
|
59
|
+
object: ListPaymentsObject;
|
|
60
|
+
data: Array<models.Payment>;
|
|
61
|
+
/**
|
|
62
|
+
* Offset-based pagination response.
|
|
63
|
+
*/
|
|
64
|
+
pagination: models.OffsetPagination;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/** @internal */
|
|
68
|
+
export const ListPaymentsStatus$outboundSchema: z.ZodNativeEnum<
|
|
69
|
+
typeof ListPaymentsStatus
|
|
70
|
+
> = z.nativeEnum(ListPaymentsStatus);
|
|
71
|
+
|
|
72
|
+
/** @internal */
|
|
73
|
+
export type ListPaymentsRequest$Outbound = {
|
|
74
|
+
merchantId?: string | undefined;
|
|
75
|
+
status?: string | undefined;
|
|
76
|
+
customerId?: string | undefined;
|
|
77
|
+
limit: number;
|
|
78
|
+
offset: number;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export const ListPaymentsRequest$outboundSchema: z.ZodType<
|
|
83
|
+
ListPaymentsRequest$Outbound,
|
|
84
|
+
z.ZodTypeDef,
|
|
85
|
+
ListPaymentsRequest
|
|
86
|
+
> = z.object({
|
|
87
|
+
merchantId: z.string().optional(),
|
|
88
|
+
status: ListPaymentsStatus$outboundSchema.optional(),
|
|
89
|
+
customerId: z.string().optional(),
|
|
90
|
+
limit: z.number().int().default(10),
|
|
91
|
+
offset: z.number().int().default(0),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export function listPaymentsRequestToJSON(
|
|
95
|
+
listPaymentsRequest: ListPaymentsRequest,
|
|
96
|
+
): string {
|
|
97
|
+
return JSON.stringify(
|
|
98
|
+
ListPaymentsRequest$outboundSchema.parse(listPaymentsRequest),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** @internal */
|
|
103
|
+
export const ListPaymentsObject$inboundSchema: z.ZodNativeEnum<
|
|
104
|
+
typeof ListPaymentsObject
|
|
105
|
+
> = z.nativeEnum(ListPaymentsObject);
|
|
106
|
+
|
|
107
|
+
/** @internal */
|
|
108
|
+
export const ListPaymentsResponse$inboundSchema: z.ZodType<
|
|
109
|
+
ListPaymentsResponse,
|
|
110
|
+
z.ZodTypeDef,
|
|
111
|
+
unknown
|
|
112
|
+
> = z.object({
|
|
113
|
+
object: ListPaymentsObject$inboundSchema,
|
|
114
|
+
data: z.array(models.Payment$inboundSchema),
|
|
115
|
+
pagination: models.OffsetPagination$inboundSchema,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
export function listPaymentsResponseFromJSON(
|
|
119
|
+
jsonString: string,
|
|
120
|
+
): SafeParseResult<ListPaymentsResponse, SDKValidationError> {
|
|
121
|
+
return safeParse(
|
|
122
|
+
jsonString,
|
|
123
|
+
(x) => ListPaymentsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
124
|
+
`Failed to parse 'ListPaymentsResponse' from JSON`,
|
|
125
|
+
);
|
|
126
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import * as models from "../index.js";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Filter by payment status.
|
|
14
|
+
*/
|
|
15
|
+
export const ListPaymentSessionsStatus = {
|
|
16
|
+
Pending: "pending",
|
|
17
|
+
Processing: "processing",
|
|
18
|
+
Completed: "completed",
|
|
19
|
+
Expired: "expired",
|
|
20
|
+
Cancelled: "cancelled",
|
|
21
|
+
} as const;
|
|
22
|
+
/**
|
|
23
|
+
* Filter by payment status.
|
|
24
|
+
*/
|
|
25
|
+
export type ListPaymentSessionsStatus = ClosedEnum<
|
|
26
|
+
typeof ListPaymentSessionsStatus
|
|
27
|
+
>;
|
|
28
|
+
|
|
29
|
+
export type ListPaymentSessionsRequest = {
|
|
30
|
+
/**
|
|
31
|
+
* Merchant organization ID. Required when using an API key that is not scoped to a single merchant.
|
|
32
|
+
*/
|
|
33
|
+
merchantId?: string | undefined;
|
|
34
|
+
/**
|
|
35
|
+
* Filter by payment status.
|
|
36
|
+
*/
|
|
37
|
+
status?: ListPaymentSessionsStatus | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Filter by customer ID.
|
|
40
|
+
*/
|
|
41
|
+
customerId?: string | undefined;
|
|
42
|
+
/**
|
|
43
|
+
* Number of payments to return.
|
|
44
|
+
*/
|
|
45
|
+
limit?: number | undefined;
|
|
46
|
+
/**
|
|
47
|
+
* Number of payments to skip.
|
|
48
|
+
*/
|
|
49
|
+
offset?: number | undefined;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const ListPaymentSessionsObject = {
|
|
53
|
+
List: "list",
|
|
54
|
+
} as const;
|
|
55
|
+
export type ListPaymentSessionsObject = ClosedEnum<
|
|
56
|
+
typeof ListPaymentSessionsObject
|
|
57
|
+
>;
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* List of payments
|
|
61
|
+
*/
|
|
62
|
+
export type ListPaymentSessionsResponse = {
|
|
63
|
+
object: ListPaymentSessionsObject;
|
|
64
|
+
data: Array<models.Payment>;
|
|
65
|
+
/**
|
|
66
|
+
* Offset-based pagination response.
|
|
67
|
+
*/
|
|
68
|
+
pagination: models.OffsetPagination;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export const ListPaymentSessionsStatus$outboundSchema: z.ZodNativeEnum<
|
|
73
|
+
typeof ListPaymentSessionsStatus
|
|
74
|
+
> = z.nativeEnum(ListPaymentSessionsStatus);
|
|
75
|
+
|
|
76
|
+
/** @internal */
|
|
77
|
+
export type ListPaymentSessionsRequest$Outbound = {
|
|
78
|
+
merchantId?: string | undefined;
|
|
79
|
+
status?: string | undefined;
|
|
80
|
+
customerId?: string | undefined;
|
|
81
|
+
limit: number;
|
|
82
|
+
offset: number;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/** @internal */
|
|
86
|
+
export const ListPaymentSessionsRequest$outboundSchema: z.ZodType<
|
|
87
|
+
ListPaymentSessionsRequest$Outbound,
|
|
88
|
+
z.ZodTypeDef,
|
|
89
|
+
ListPaymentSessionsRequest
|
|
90
|
+
> = z.object({
|
|
91
|
+
merchantId: z.string().optional(),
|
|
92
|
+
status: ListPaymentSessionsStatus$outboundSchema.optional(),
|
|
93
|
+
customerId: z.string().optional(),
|
|
94
|
+
limit: z.number().int().default(10),
|
|
95
|
+
offset: z.number().int().default(0),
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
export function listPaymentSessionsRequestToJSON(
|
|
99
|
+
listPaymentSessionsRequest: ListPaymentSessionsRequest,
|
|
100
|
+
): string {
|
|
101
|
+
return JSON.stringify(
|
|
102
|
+
ListPaymentSessionsRequest$outboundSchema.parse(listPaymentSessionsRequest),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** @internal */
|
|
107
|
+
export const ListPaymentSessionsObject$inboundSchema: z.ZodNativeEnum<
|
|
108
|
+
typeof ListPaymentSessionsObject
|
|
109
|
+
> = z.nativeEnum(ListPaymentSessionsObject);
|
|
110
|
+
|
|
111
|
+
/** @internal */
|
|
112
|
+
export const ListPaymentSessionsResponse$inboundSchema: z.ZodType<
|
|
113
|
+
ListPaymentSessionsResponse,
|
|
114
|
+
z.ZodTypeDef,
|
|
115
|
+
unknown
|
|
116
|
+
> = z.object({
|
|
117
|
+
object: ListPaymentSessionsObject$inboundSchema,
|
|
118
|
+
data: z.array(models.Payment$inboundSchema),
|
|
119
|
+
pagination: models.OffsetPagination$inboundSchema,
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
export function listPaymentSessionsResponseFromJSON(
|
|
123
|
+
jsonString: string,
|
|
124
|
+
): SafeParseResult<ListPaymentSessionsResponse, SDKValidationError> {
|
|
125
|
+
return safeParse(
|
|
126
|
+
jsonString,
|
|
127
|
+
(x) => ListPaymentSessionsResponse$inboundSchema.parse(JSON.parse(x)),
|
|
128
|
+
`Failed to parse 'ListPaymentSessionsResponse' from JSON`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod/v3";
|
|
6
|
+
import { safeParse } from "../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "./errors/sdkvalidationerror.js";
|
|
10
|
+
|
|
11
|
+
export const PaymentObject = {
|
|
12
|
+
Payment: "payment",
|
|
13
|
+
} as const;
|
|
14
|
+
export type PaymentObject = ClosedEnum<typeof PaymentObject>;
|
|
15
|
+
|
|
16
|
+
export type LineItem = {
|
|
17
|
+
description?: string | undefined;
|
|
18
|
+
amount?: string | undefined;
|
|
19
|
+
quantity?: number | undefined;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Current status of the payment.
|
|
24
|
+
*/
|
|
25
|
+
export const PaymentStatus = {
|
|
26
|
+
Pending: "pending",
|
|
27
|
+
Processing: "processing",
|
|
28
|
+
Completed: "completed",
|
|
29
|
+
Expired: "expired",
|
|
30
|
+
Cancelled: "cancelled",
|
|
31
|
+
} as const;
|
|
32
|
+
/**
|
|
33
|
+
* Current status of the payment.
|
|
34
|
+
*/
|
|
35
|
+
export type PaymentStatus = ClosedEnum<typeof PaymentStatus>;
|
|
36
|
+
|
|
37
|
+
export type Payment = {
|
|
38
|
+
/**
|
|
39
|
+
* Unique payment identifier (pay_* prefixed).
|
|
40
|
+
*/
|
|
41
|
+
id: string;
|
|
42
|
+
object: PaymentObject;
|
|
43
|
+
/**
|
|
44
|
+
* Payment amount in decimal format (e.g. '10.50').
|
|
45
|
+
*/
|
|
46
|
+
amount: string;
|
|
47
|
+
/**
|
|
48
|
+
* ISO 4217 currency code (e.g. 'USD').
|
|
49
|
+
*/
|
|
50
|
+
currency: string;
|
|
51
|
+
/**
|
|
52
|
+
* URL for the customer to complete the payment.
|
|
53
|
+
*/
|
|
54
|
+
paymentUrl?: string | undefined;
|
|
55
|
+
/**
|
|
56
|
+
* Customer ID if provided.
|
|
57
|
+
*/
|
|
58
|
+
customerId?: string | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Client-provided idempotency key.
|
|
61
|
+
*/
|
|
62
|
+
idempotencyKey?: string | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* Merchant-defined reference for this payment.
|
|
65
|
+
*/
|
|
66
|
+
reference?: string | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Merchant-provided key-value metadata.
|
|
69
|
+
*/
|
|
70
|
+
metadata?: { [k: string]: string } | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Breakdown of what the customer is being charged for.
|
|
73
|
+
*/
|
|
74
|
+
lineItems?: Array<LineItem> | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Current status of the payment.
|
|
77
|
+
*/
|
|
78
|
+
status: PaymentStatus;
|
|
79
|
+
/**
|
|
80
|
+
* When the payment expires.
|
|
81
|
+
*/
|
|
82
|
+
expiresAt?: Date | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* When the payment was created.
|
|
85
|
+
*/
|
|
86
|
+
createdAt: Date;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/** @internal */
|
|
90
|
+
export const PaymentObject$inboundSchema: z.ZodNativeEnum<
|
|
91
|
+
typeof PaymentObject
|
|
92
|
+
> = z.nativeEnum(PaymentObject);
|
|
93
|
+
|
|
94
|
+
/** @internal */
|
|
95
|
+
export const LineItem$inboundSchema: z.ZodType<
|
|
96
|
+
LineItem,
|
|
97
|
+
z.ZodTypeDef,
|
|
98
|
+
unknown
|
|
99
|
+
> = z.object({
|
|
100
|
+
description: z.string().optional(),
|
|
101
|
+
amount: z.string().optional(),
|
|
102
|
+
quantity: z.number().int().optional(),
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
export function lineItemFromJSON(
|
|
106
|
+
jsonString: string,
|
|
107
|
+
): SafeParseResult<LineItem, SDKValidationError> {
|
|
108
|
+
return safeParse(
|
|
109
|
+
jsonString,
|
|
110
|
+
(x) => LineItem$inboundSchema.parse(JSON.parse(x)),
|
|
111
|
+
`Failed to parse 'LineItem' from JSON`,
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** @internal */
|
|
116
|
+
export const PaymentStatus$inboundSchema: z.ZodNativeEnum<
|
|
117
|
+
typeof PaymentStatus
|
|
118
|
+
> = z.nativeEnum(PaymentStatus);
|
|
119
|
+
|
|
120
|
+
/** @internal */
|
|
121
|
+
export const Payment$inboundSchema: z.ZodType<Payment, z.ZodTypeDef, unknown> =
|
|
122
|
+
z.object({
|
|
123
|
+
id: z.string(),
|
|
124
|
+
object: PaymentObject$inboundSchema.default("payment"),
|
|
125
|
+
amount: z.string(),
|
|
126
|
+
currency: z.string(),
|
|
127
|
+
paymentUrl: z.string().optional(),
|
|
128
|
+
customerId: z.string().optional(),
|
|
129
|
+
idempotencyKey: z.string().optional(),
|
|
130
|
+
reference: z.string().optional(),
|
|
131
|
+
metadata: z.record(z.string()).optional(),
|
|
132
|
+
lineItems: z.array(z.lazy(() => LineItem$inboundSchema)).optional(),
|
|
133
|
+
status: PaymentStatus$inboundSchema,
|
|
134
|
+
expiresAt: z.string().datetime({ offset: true }).transform(v => new Date(v))
|
|
135
|
+
.optional(),
|
|
136
|
+
createdAt: z.string().datetime({ offset: true }).transform(v =>
|
|
137
|
+
new Date(v)
|
|
138
|
+
),
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export function paymentFromJSON(
|
|
142
|
+
jsonString: string,
|
|
143
|
+
): SafeParseResult<Payment, SDKValidationError> {
|
|
144
|
+
return safeParse(
|
|
145
|
+
jsonString,
|
|
146
|
+
(x) => Payment$inboundSchema.parse(JSON.parse(x)),
|
|
147
|
+
`Failed to parse 'Payment' from JSON`,
|
|
148
|
+
);
|
|
149
|
+
}
|