@openrails/billing-ui 0.230.0 → 0.234.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +117 -9
- package/README.md +88 -39
- package/dist/account/account-billing.d.ts +3 -3
- package/dist/account/cancel-dialog.d.ts +2 -2
- package/dist/account/format.d.ts +4 -4
- package/dist/account/payment-methods-panel.d.ts +7 -9
- package/dist/account/section.d.ts +3 -1
- package/dist/checkout-page.d.ts +6 -1
- package/dist/client/client.d.ts +81 -62
- package/dist/client/generated/currencies.d.ts +1 -0
- package/dist/client/generated/error-codes.d.ts +7 -0
- package/dist/client/generated/routes.d.ts +764 -0
- package/dist/client/generated/wire.d.ts +772 -0
- package/dist/client/index.d.ts +3 -3
- package/dist/client/types.d.ts +498 -393
- package/dist/client-CWX6QpLa.js +920 -0
- package/dist/client-CWX6QpLa.js.map +1 -0
- package/dist/client.js +2 -3
- package/dist/components/methods.d.ts +3 -3
- package/dist/config-DZ97SQG2.js +341 -0
- package/dist/config-DZ97SQG2.js.map +1 -0
- package/dist/frame.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1447 -1539
- package/dist/index.js.map +1 -1
- package/dist/lib/billing.d.ts +14 -0
- package/dist/lib/money.d.ts +1 -0
- package/dist/lib/period.d.ts +0 -2
- package/dist/lib/rail-meta.d.ts +4 -4
- package/dist/locales/de.js +11 -8
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/en.d.ts +8 -5
- package/dist/locales/en.js +11 -8
- package/dist/locales/en.js.map +1 -1
- package/dist/locales/es.js +11 -8
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/ja.js +11 -8
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/ko.js +11 -8
- package/dist/locales/ko.js.map +1 -1
- package/dist/locales/zh.js +11 -8
- package/dist/locales/zh.js.map +1 -1
- package/dist/psp.d.ts +10 -21
- package/dist/react/config.d.ts +34 -0
- package/dist/react/context.d.ts +5 -8
- package/dist/react/hooks.d.ts +20 -14
- package/dist/react/index.d.ts +1 -0
- package/dist/react/provider.d.ts +1 -9
- package/dist/react/remote.d.ts +0 -1
- package/dist/react.js +24 -28
- package/dist/react.js.map +1 -1
- package/dist/save-payment-method.d.ts +1 -1
- package/dist/source.d.ts +0 -9
- package/dist/styles.css +1 -1
- package/dist/types.d.ts +114 -55
- package/docs/payment-form-contract.md +23 -40
- package/package.json +3 -3
- package/dist/client/generated/openrails-routes.d.ts +0 -2
- package/dist/client-DhG2jv34.js +0 -771
- package/dist/client-DhG2jv34.js.map +0 -1
- package/dist/errors-T-PRm3vV.js +0 -54
- package/dist/errors-T-PRm3vV.js.map +0 -1
- package/dist/hooks-DLFF-zx5.js +0 -285
- package/dist/hooks-DLFF-zx5.js.map +0 -1
- package/docs/1055-nmi-host-integration.md +0 -28
package/dist/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { z } from 'zod';
|
|
|
2
2
|
export declare const amountSchema: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
3
3
|
export declare const unitDecimalsSchema: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
|
|
4
4
|
export declare const checkoutSessionStatusSchema: z.ZodEnum<{
|
|
5
|
+
canceled: "canceled";
|
|
5
6
|
succeeded: "succeeded";
|
|
6
7
|
failed: "failed";
|
|
7
8
|
expired: "expired";
|
|
@@ -9,7 +10,6 @@ export declare const checkoutSessionStatusSchema: z.ZodEnum<{
|
|
|
9
10
|
requires_action: "requires_action";
|
|
10
11
|
processing: "processing";
|
|
11
12
|
blocked: "blocked";
|
|
12
|
-
canceled: "canceled";
|
|
13
13
|
}>;
|
|
14
14
|
export type CheckoutSessionStatus = z.infer<typeof checkoutSessionStatusSchema>;
|
|
15
15
|
export declare const paymentFailureSchema: z.ZodObject<{
|
|
@@ -22,8 +22,9 @@ export declare const checkoutOperationSchema: z.ZodObject<{
|
|
|
22
22
|
id: z.ZodString;
|
|
23
23
|
status: z.ZodString;
|
|
24
24
|
}, z.core.$strip>;
|
|
25
|
-
export declare const
|
|
25
|
+
export declare const paymentOptionSchema: z.ZodObject<{
|
|
26
26
|
id: z.ZodString;
|
|
27
|
+
psp_id: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
27
28
|
rail: z.ZodString;
|
|
28
29
|
mode: z.ZodEnum<{
|
|
29
30
|
subscription: "subscription";
|
|
@@ -36,39 +37,50 @@ export declare const paymentRailOptionSchema: z.ZodObject<{
|
|
|
36
37
|
redirect: "redirect";
|
|
37
38
|
solana_pay: "solana_pay";
|
|
38
39
|
}>;
|
|
39
|
-
psp_key: z.ZodOptional<z.ZodString
|
|
40
|
-
public_config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString
|
|
40
|
+
psp_key: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
41
|
+
public_config: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>, z.ZodTransform<Record<string, string> | undefined, Record<string, string> | null | undefined>>>;
|
|
41
42
|
}, z.core.$strip>;
|
|
42
|
-
export type
|
|
43
|
+
export type PaymentOption = z.infer<typeof paymentOptionSchema>;
|
|
44
|
+
export declare const nextActionSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
45
|
+
type: z.ZodLiteral<"redirect_to_url">;
|
|
46
|
+
url: z.ZodString;
|
|
47
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
48
|
+
type: z.ZodLiteral<"solana_pay">;
|
|
49
|
+
url: z.ZodString;
|
|
50
|
+
}, z.core.$strip>], "type">;
|
|
51
|
+
export type NextAction = z.infer<typeof nextActionSchema>;
|
|
43
52
|
export declare const savedPaymentMethodSchema: z.ZodObject<{
|
|
44
53
|
id: z.ZodString;
|
|
45
54
|
option_id: z.ZodString;
|
|
46
55
|
rail: z.ZodString;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
card: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
57
|
+
brand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
58
|
+
last4: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
59
|
+
exp_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
60
|
+
exp_year: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
61
|
+
}, z.core.$strip>>>;
|
|
52
62
|
}, z.core.$strip>;
|
|
53
63
|
export type SavedPaymentMethod = z.infer<typeof savedPaymentMethodSchema>;
|
|
54
64
|
export declare const checkoutLineItemSchema: z.ZodObject<{
|
|
55
65
|
label: z.ZodString;
|
|
56
|
-
sublabel: z.ZodOptional<z.ZodString
|
|
66
|
+
sublabel: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
57
67
|
amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
58
68
|
}, z.core.$strip>;
|
|
59
69
|
export type CheckoutLineItem = z.infer<typeof checkoutLineItemSchema>;
|
|
60
70
|
export declare const checkoutPlanSchema: z.ZodObject<{
|
|
71
|
+
auto_renew: z.ZodBoolean;
|
|
61
72
|
display_name: z.ZodString;
|
|
62
73
|
unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
63
74
|
currency: z.ZodString;
|
|
64
75
|
unit_decimals: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
|
|
65
|
-
|
|
66
|
-
|
|
76
|
+
billing_interval_hours: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>>;
|
|
77
|
+
access_duration_hours: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>>;
|
|
67
78
|
}, z.core.$strip>;
|
|
68
79
|
export type CheckoutPlan = z.infer<typeof checkoutPlanSchema>;
|
|
69
80
|
export declare const checkoutSessionSchema: z.ZodObject<{
|
|
70
81
|
id: z.ZodString;
|
|
71
82
|
status: z.ZodEnum<{
|
|
83
|
+
canceled: "canceled";
|
|
72
84
|
succeeded: "succeeded";
|
|
73
85
|
failed: "failed";
|
|
74
86
|
expired: "expired";
|
|
@@ -76,28 +88,37 @@ export declare const checkoutSessionSchema: z.ZodObject<{
|
|
|
76
88
|
requires_action: "requires_action";
|
|
77
89
|
processing: "processing";
|
|
78
90
|
blocked: "blocked";
|
|
79
|
-
canceled: "canceled";
|
|
80
91
|
}>;
|
|
81
92
|
merchant: z.ZodObject<{
|
|
82
93
|
display_name: z.ZodString;
|
|
83
94
|
}, z.core.$strip>;
|
|
84
95
|
plan: z.ZodObject<{
|
|
96
|
+
auto_renew: z.ZodBoolean;
|
|
85
97
|
display_name: z.ZodString;
|
|
86
98
|
unit_amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
87
99
|
currency: z.ZodString;
|
|
88
100
|
unit_decimals: z.ZodNumber & z.ZodType<number, number, z.core.$ZodTypeInternals<number, number>>;
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
billing_interval_hours: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>>;
|
|
102
|
+
access_duration_hours: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodNumber>>, z.ZodTransform<number | undefined, number | null | undefined>>>;
|
|
91
103
|
}, z.core.$strip>;
|
|
92
|
-
line_items: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
104
|
+
line_items: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
93
105
|
label: z.ZodString;
|
|
94
|
-
sublabel: z.ZodOptional<z.ZodString
|
|
106
|
+
sublabel: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
95
107
|
amount: z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>;
|
|
96
|
-
}, z.core.$strip
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
108
|
+
}, z.core.$strip>>>>, z.ZodTransform<{
|
|
109
|
+
label: string;
|
|
110
|
+
amount: string;
|
|
111
|
+
sublabel?: string | undefined;
|
|
112
|
+
}[] | undefined, {
|
|
113
|
+
label: string;
|
|
114
|
+
amount: string;
|
|
115
|
+
sublabel?: string | undefined;
|
|
116
|
+
}[] | null | undefined>>>;
|
|
117
|
+
tax: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
118
|
+
due_today: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
119
|
+
options: z.ZodArray<z.ZodObject<{
|
|
100
120
|
id: z.ZodString;
|
|
121
|
+
psp_id: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
101
122
|
rail: z.ZodString;
|
|
102
123
|
mode: z.ZodEnum<{
|
|
103
124
|
subscription: "subscription";
|
|
@@ -110,23 +131,50 @@ export declare const checkoutSessionSchema: z.ZodObject<{
|
|
|
110
131
|
redirect: "redirect";
|
|
111
132
|
solana_pay: "solana_pay";
|
|
112
133
|
}>;
|
|
113
|
-
psp_key: z.ZodOptional<z.ZodString
|
|
114
|
-
public_config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString
|
|
134
|
+
psp_key: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
135
|
+
public_config: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>, z.ZodTransform<Record<string, string> | undefined, Record<string, string> | null | undefined>>>;
|
|
115
136
|
}, z.core.$strip>>;
|
|
116
|
-
saved_methods: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
137
|
+
saved_methods: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodArray<z.ZodObject<{
|
|
117
138
|
id: z.ZodString;
|
|
118
139
|
option_id: z.ZodString;
|
|
119
140
|
rail: z.ZodString;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
141
|
+
card: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
142
|
+
brand: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
143
|
+
last4: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
144
|
+
exp_month: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
145
|
+
exp_year: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
146
|
+
}, z.core.$strip>>>;
|
|
147
|
+
}, z.core.$strip>>>>, z.ZodTransform<{
|
|
148
|
+
id: string;
|
|
149
|
+
option_id: string;
|
|
150
|
+
rail: string;
|
|
151
|
+
card?: {
|
|
152
|
+
brand?: string | null | undefined;
|
|
153
|
+
last4?: string | null | undefined;
|
|
154
|
+
exp_month?: number | null | undefined;
|
|
155
|
+
exp_year?: number | null | undefined;
|
|
156
|
+
} | null | undefined;
|
|
157
|
+
}[] | undefined, {
|
|
158
|
+
id: string;
|
|
159
|
+
option_id: string;
|
|
160
|
+
rail: string;
|
|
161
|
+
card?: {
|
|
162
|
+
brand?: string | null | undefined;
|
|
163
|
+
last4?: string | null | undefined;
|
|
164
|
+
exp_month?: number | null | undefined;
|
|
165
|
+
exp_year?: number | null | undefined;
|
|
166
|
+
} | null | undefined;
|
|
167
|
+
}[] | null | undefined>>>;
|
|
168
|
+
next_action: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
169
|
+
type: z.ZodLiteral<"redirect_to_url">;
|
|
170
|
+
url: z.ZodString;
|
|
171
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
172
|
+
type: z.ZodLiteral<"solana_pay">;
|
|
173
|
+
url: z.ZodString;
|
|
174
|
+
}, z.core.$strip>], "type">>>;
|
|
175
|
+
payment_id: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
176
|
+
subscription_id: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
177
|
+
failure_message: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
130
178
|
failure: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
131
179
|
reason: z.ZodString;
|
|
132
180
|
message: z.ZodString;
|
|
@@ -136,36 +184,40 @@ export declare const checkoutSessionSchema: z.ZodObject<{
|
|
|
136
184
|
id: z.ZodString;
|
|
137
185
|
status: z.ZodString;
|
|
138
186
|
}, z.core.$strip>>>;
|
|
139
|
-
success_url: z.ZodOptional<z.ZodString
|
|
140
|
-
embed_origin: z.ZodOptional<z.ZodString
|
|
141
|
-
expires_at: z.ZodOptional<z.ZodNullable<z.ZodString
|
|
187
|
+
success_url: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
188
|
+
embed_origin: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
189
|
+
expires_at: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
142
190
|
}, z.core.$strip>;
|
|
143
191
|
export type CheckoutSession = z.infer<typeof checkoutSessionSchema>;
|
|
144
192
|
export declare const payRequestSchema: z.ZodObject<{
|
|
145
193
|
option_id: z.ZodString;
|
|
146
194
|
payment_token: z.ZodOptional<z.ZodString>;
|
|
147
195
|
payment_method_id: z.ZodOptional<z.ZodString>;
|
|
148
|
-
email: z.ZodOptional<z.ZodString>;
|
|
149
|
-
name_on_card: z.ZodOptional<z.ZodString>;
|
|
150
|
-
address1: z.ZodOptional<z.ZodString>;
|
|
151
|
-
city: z.ZodOptional<z.ZodString>;
|
|
152
|
-
state: z.ZodOptional<z.ZodString>;
|
|
153
|
-
zip: z.ZodOptional<z.ZodString>;
|
|
154
|
-
country: z.ZodOptional<z.ZodString>;
|
|
155
196
|
card: z.ZodOptional<z.ZodObject<{
|
|
156
197
|
number: z.ZodString;
|
|
157
198
|
exp_month: z.ZodNumber;
|
|
158
199
|
exp_year: z.ZodNumber;
|
|
159
200
|
cvc: z.ZodString;
|
|
160
201
|
}, z.core.$strip>>;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
202
|
+
billing_details: z.ZodOptional<z.ZodObject<{
|
|
203
|
+
name: z.ZodOptional<z.ZodString>;
|
|
204
|
+
email: z.ZodOptional<z.ZodString>;
|
|
205
|
+
phone: z.ZodOptional<z.ZodString>;
|
|
206
|
+
address: z.ZodOptional<z.ZodObject<{
|
|
207
|
+
line1: z.ZodOptional<z.ZodString>;
|
|
208
|
+
line2: z.ZodOptional<z.ZodString>;
|
|
209
|
+
city: z.ZodOptional<z.ZodString>;
|
|
210
|
+
state: z.ZodOptional<z.ZodString>;
|
|
211
|
+
postal_code: z.ZodOptional<z.ZodString>;
|
|
212
|
+
country: z.ZodOptional<z.ZodString>;
|
|
213
|
+
}, z.core.$strip>>;
|
|
214
|
+
}, z.core.$strip>>;
|
|
164
215
|
token_symbol: z.ZodOptional<z.ZodString>;
|
|
165
216
|
}, z.core.$strip>;
|
|
166
217
|
export type PayRequest = z.infer<typeof payRequestSchema>;
|
|
167
218
|
export declare const payResultSchema: z.ZodObject<{
|
|
168
219
|
status: z.ZodEnum<{
|
|
220
|
+
canceled: "canceled";
|
|
169
221
|
succeeded: "succeeded";
|
|
170
222
|
failed: "failed";
|
|
171
223
|
expired: "expired";
|
|
@@ -173,19 +225,26 @@ export declare const payResultSchema: z.ZodObject<{
|
|
|
173
225
|
requires_action: "requires_action";
|
|
174
226
|
processing: "processing";
|
|
175
227
|
blocked: "blocked";
|
|
176
|
-
canceled: "canceled";
|
|
177
228
|
}>;
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
229
|
+
next_action: z.ZodOptional<z.ZodNullable<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
230
|
+
type: z.ZodLiteral<"redirect_to_url">;
|
|
231
|
+
url: z.ZodString;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"solana_pay">;
|
|
234
|
+
url: z.ZodString;
|
|
235
|
+
}, z.core.$strip>], "type">>>;
|
|
236
|
+
operation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
237
|
+
id: z.ZodString;
|
|
238
|
+
status: z.ZodString;
|
|
239
|
+
}, z.core.$strip>>>;
|
|
240
|
+
payment_id: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
241
|
+
subscription_id: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
242
|
+
failure_message: z.ZodOptional<z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodString>>, z.ZodTransform<string | undefined, string | null | undefined>>>;
|
|
183
243
|
failure: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
184
244
|
reason: z.ZodString;
|
|
185
245
|
message: z.ZodString;
|
|
186
246
|
field: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
187
247
|
}, z.core.$strip>>>;
|
|
188
|
-
operation_id: z.ZodOptional<z.ZodString>;
|
|
189
248
|
}, z.core.$strip>;
|
|
190
249
|
export type PayResult = z.infer<typeof payResultSchema>;
|
|
191
250
|
export type CheckoutPhase = "loading" | "ready" | "processing" | "succeeded" | "failed" | "blocked" | "expired" | "unavailable" | "error";
|
|
@@ -17,8 +17,9 @@ as an exact signed int64 decimal string of `plan.currency`'s native unit, and
|
|
|
17
17
|
"unit_amount": "99000000",
|
|
18
18
|
"currency": "USD",
|
|
19
19
|
"unit_decimals": 6,
|
|
20
|
-
"
|
|
21
|
-
"
|
|
20
|
+
"auto_renew": true,
|
|
21
|
+
"billing_interval_hours": 720,
|
|
22
|
+
"access_duration_hours": 720
|
|
22
23
|
},
|
|
23
24
|
"line_items": [{ "label": "Premium Membership", "amount": "99000000" }],
|
|
24
25
|
"tax": "0",
|
|
@@ -31,11 +32,9 @@ currency and scale. A JSON number, a decimal point, a value outside int64, or
|
|
|
31
32
|
a missing `unit_decimals` fails schema validation and the session is
|
|
32
33
|
unavailable; the package never assumes a scale. Hosts take the scale from
|
|
33
34
|
OpenRails' currency registry (`billing.LookupCurrency`, the same table as
|
|
34
|
-
`GET /v1/
|
|
35
|
-
`GET /v1/checkout-sessions/{id}`;
|
|
36
|
-
`
|
|
37
|
-
(`testdata/wire/hosted_checkout_session.json`) is decoded by this package's
|
|
38
|
-
tests.
|
|
35
|
+
the `currencies` of `GET /v1/config`); OpenRails serves the session at
|
|
36
|
+
`GET /v1/checkout-sessions/{id}`; its canonical fixture
|
|
37
|
+
(`testdata/wire/checkout_session.json`) is decoded by this package's tests.
|
|
39
38
|
|
|
40
39
|
Rendering scales with `BigInt` and hands Intl the exact major-unit decimal;
|
|
41
40
|
`formatAmount`, `amountToDecimal` and `addAmounts` are exported for hosts that
|
|
@@ -43,16 +42,13 @@ show the same figures outside the component. An amount the engine cannot show
|
|
|
43
42
|
exactly is refused with a visible notice, never rounded. `due_today`, when
|
|
44
43
|
absent, is the exact sum of the line items and `tax`.
|
|
45
44
|
|
|
46
|
-
Version 0.3.0 replaces `unit_amount_micros`, `amount_micros`, `tax_micros` and
|
|
47
|
-
`due_today_micros` (JSON numbers, assumed six decimals) with this contract.
|
|
48
|
-
|
|
49
45
|
## NMI new cards
|
|
50
46
|
|
|
51
47
|
The host collects only:
|
|
52
48
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
49
|
+
- the cardholder's name: one visible “Name on card” input with `autocomplete="cc-name"`;
|
|
50
|
+
- the country: a native ISO-3166 country select with `autocomplete="billing country"`;
|
|
51
|
+
- the postal code: a country-aware input with `autocomplete="billing postal-code"`.
|
|
56
52
|
|
|
57
53
|
Postal code is optional for the 53 ISO-3166 alpha-2 countries and territories
|
|
58
54
|
in the Universal Postal Union's September 2025
|
|
@@ -74,32 +70,20 @@ and `cc-csc`, the same layout and field errors, and no gateway script. Its
|
|
|
74
70
|
request carries `card: {number, exp_month, exp_year, cvc}` in place of
|
|
75
71
|
`payment_token`; the inputs are cleared once the card is sent.
|
|
76
72
|
|
|
77
|
-
A new-card payment request includes the one-time `payment_token` plus
|
|
78
|
-
`
|
|
73
|
+
A new-card payment request includes the one-time `payment_token` plus
|
|
74
|
+
`billing_details`: `name`, and `address` with the uppercase ISO `country` and
|
|
75
|
+
`postal_code`. Paying with an
|
|
79
76
|
existing saved method sends only `payment_method_id`; it does not overwrite the
|
|
80
77
|
stored billing identity with empty form values.
|
|
81
78
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
For CCBill credit-card hand-off, the browser supplies only the same single
|
|
85
|
-
`name_on_card`, country, and postal code. OpenRails binds the authenticated
|
|
86
|
-
account's verified email and derives the customer's IP server-side; the browser
|
|
87
|
-
cannot override either value. CCBill's FlexForms Address Fields are
|
|
88
|
-
configurable for credit-card forms, so OpenRails does not collect street, city,
|
|
89
|
-
or state in this flow. The checkout package never exposes separate first- and
|
|
90
|
-
last-name inputs. OpenRails performs any provider-specific name projection at
|
|
91
|
-
the CCBill boundary.
|
|
92
|
-
|
|
93
|
-
Version 0.2.4 requires a checkout host whose pay endpoint accepts
|
|
94
|
-
`name_on_card`. Legacy `first_name` and `last_name` are no longer emitted by
|
|
95
|
-
this package.
|
|
79
|
+
The package never shows separate first- and last-name inputs; OpenRails
|
|
80
|
+
projects the one name onto provider-specific fields at the rail boundary.
|
|
96
81
|
|
|
97
82
|
## Card subscriptions
|
|
98
83
|
|
|
99
|
-
`Subscribe` is one action
|
|
100
|
-
`payment_method_id`)
|
|
101
|
-
|
|
102
|
-
decline answers `failed` and keeps no card; the next attempt uses a new key.
|
|
84
|
+
`Subscribe` is one action: paying the session with a `payment_token` (or a
|
|
85
|
+
`payment_method_id`) saves a new card, accepts the displayed recurring terms
|
|
86
|
+
and charges it. A decline answers `failed` and keeps no card.
|
|
103
87
|
|
|
104
88
|
## Solana Pay
|
|
105
89
|
|
|
@@ -116,9 +100,6 @@ binds the token on the advertised option's `public_config` (hosts copy it):
|
|
|
116
100
|
(“USD Coin (USDC) on Solana devnet”) so a test-network payment is never
|
|
117
101
|
mistaken for a real one.
|
|
118
102
|
|
|
119
|
-
Version 0.2.5 removes the former `USDC` default: a host that bound no token
|
|
120
|
-
saw “USDC” before and sees no Solana option now.
|
|
121
|
-
|
|
122
103
|
## Pending payment outcomes
|
|
123
104
|
|
|
124
105
|
`processing` means an accepted outcome is unresolved. Checkout polls the same
|
|
@@ -131,10 +112,12 @@ a fresh card token and payment. Tokenization/field validation errors before
|
|
|
131
112
|
submission remain editable. Explicit `failed` results are definitive host
|
|
132
113
|
responses; they must not represent an unknown provider result.
|
|
133
114
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
115
|
+
`client.checkoutSource(id)` is the source of every checkout: it reads and pays
|
|
116
|
+
the OpenRails session. `getSession` is a read, never another payment. With the
|
|
117
|
+
session id alone it sends no bearer, so it pays with a new card only. A
|
|
118
|
+
signed-in customer pays with a saved card through a customer surface:
|
|
119
|
+
`client.checkoutSource(id, { customerBase: "/billing/v1/me" })` reads and pays
|
|
120
|
+
at that surface's `/checkout-sessions/{id}` with the client's credential.
|
|
138
121
|
|
|
139
122
|
## Separate NMI card setup
|
|
140
123
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openrails/billing-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.234.0",
|
|
4
4
|
"description": "Embeddable OpenRails checkout and account-billing UI: client, React hooks and styled components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -107,8 +107,8 @@
|
|
|
107
107
|
"test": "vitest run",
|
|
108
108
|
"test:browser": "playwright test",
|
|
109
109
|
"test:e2e": "playwright test -c playwright.e2e.config.ts",
|
|
110
|
-
"contract": "
|
|
111
|
-
"contract:check": "
|
|
110
|
+
"contract": "cd ../.. && go run ./scripts/contracts -write",
|
|
111
|
+
"contract:check": "cd ../.. && go run ./scripts/contracts",
|
|
112
112
|
"format": "prettier --write \"**/*.{css,ts,tsx,json,md}\"",
|
|
113
113
|
"check": "pnpm typecheck && pnpm lint && pnpm test && pnpm build"
|
|
114
114
|
}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
export type OpenRailsCustomerRoute = "GET /billing/v1/me/balance" | "POST /billing/v1/me/billing-portal" | "POST /billing/v1/me/checkout" | "POST /billing/v1/me/checkout/sessions" | "GET /billing/v1/me/checkout/{id}" | "POST /billing/v1/me/checkout/{id}/confirm" | "PUT /billing/v1/me/collection-payment-method" | "PUT /billing/v1/me/default-payment-method" | "GET /billing/v1/me/entitlements/active" | "GET /billing/v1/me/invoices" | "GET /billing/v1/me/invoices/{id}" | "POST /billing/v1/me/invoices/{id}/pay-now" | "GET /billing/v1/me/notifications" | "GET /billing/v1/me/notifications/unread-count" | "POST /billing/v1/me/notifications/{id}/read" | "GET /billing/v1/me/payment-methods" | "POST /billing/v1/me/payment-methods" | "POST /billing/v1/me/payment-methods/stripe-setup" | "GET /billing/v1/me/payment-methods/stripe-setup/{id}" | "POST /billing/v1/me/payment-methods/stripe-setup/{id}/confirm" | "DELETE /billing/v1/me/payment-methods/{id}" | "PUT /billing/v1/me/payment-methods/{id}" | "GET /billing/v1/me/payment-operations/{id}/authentication" | "POST /billing/v1/me/payment-operations/{id}/authentication/confirm" | "GET /billing/v1/me/payments" | "GET /billing/v1/me/products" | "GET /billing/v1/me/products/{product_id}/access" | "GET /billing/v1/me/spend-limits" | "GET /billing/v1/me/status" | "GET /billing/v1/me/subscriptions" | "GET /billing/v1/me/subscriptions/{id}" | "POST /billing/v1/me/subscriptions/{id}/cancel" | "POST /billing/v1/me/subscriptions/{id}/change-tier" | "POST /billing/v1/me/subscriptions/{id}/change-tier/preview" | "PUT /billing/v1/me/subscriptions/{id}/payment-method" | "GET /billing/v1/me/subscriptions/{id}/provider-cutover" | "POST /billing/v1/me/subscriptions/{id}/provider-cutover" | "POST /billing/v1/me/subscriptions/{id}/provider-cutover/preview" | "POST /billing/v1/me/subscriptions/{id}/resume" | "POST /billing/v1/me/subscriptions/{id}/retry-now" | "POST /billing/v1/me/subscriptions/{id}/solana-cancel" | "POST /billing/v1/me/subscriptions/{id}/solana-cancel-tx" | "POST /billing/v1/me/subscriptions/{id}/solana-tier-change" | "POST /billing/v1/me/subscriptions/{id}/solana-tier-change/confirm" | "GET /billing/v1/me/tier" | "GET /billing/v1/me/transactions" | "GET /billing/v1/me/usage";
|
|
2
|
-
export declare const OPENRAILS_CURRENCY_SCALES: Readonly<Record<string, number>>;
|