@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.
Files changed (65) hide show
  1. package/CHANGELOG.md +117 -9
  2. package/README.md +88 -39
  3. package/dist/account/account-billing.d.ts +3 -3
  4. package/dist/account/cancel-dialog.d.ts +2 -2
  5. package/dist/account/format.d.ts +4 -4
  6. package/dist/account/payment-methods-panel.d.ts +7 -9
  7. package/dist/account/section.d.ts +3 -1
  8. package/dist/checkout-page.d.ts +6 -1
  9. package/dist/client/client.d.ts +81 -62
  10. package/dist/client/generated/currencies.d.ts +1 -0
  11. package/dist/client/generated/error-codes.d.ts +7 -0
  12. package/dist/client/generated/routes.d.ts +764 -0
  13. package/dist/client/generated/wire.d.ts +772 -0
  14. package/dist/client/index.d.ts +3 -3
  15. package/dist/client/types.d.ts +498 -393
  16. package/dist/client-CWX6QpLa.js +920 -0
  17. package/dist/client-CWX6QpLa.js.map +1 -0
  18. package/dist/client.js +2 -3
  19. package/dist/components/methods.d.ts +3 -3
  20. package/dist/config-DZ97SQG2.js +341 -0
  21. package/dist/config-DZ97SQG2.js.map +1 -0
  22. package/dist/frame.d.ts +1 -1
  23. package/dist/index.d.ts +4 -4
  24. package/dist/index.js +1447 -1539
  25. package/dist/index.js.map +1 -1
  26. package/dist/lib/billing.d.ts +14 -0
  27. package/dist/lib/money.d.ts +1 -0
  28. package/dist/lib/period.d.ts +0 -2
  29. package/dist/lib/rail-meta.d.ts +4 -4
  30. package/dist/locales/de.js +11 -8
  31. package/dist/locales/de.js.map +1 -1
  32. package/dist/locales/en.d.ts +8 -5
  33. package/dist/locales/en.js +11 -8
  34. package/dist/locales/en.js.map +1 -1
  35. package/dist/locales/es.js +11 -8
  36. package/dist/locales/es.js.map +1 -1
  37. package/dist/locales/ja.js +11 -8
  38. package/dist/locales/ja.js.map +1 -1
  39. package/dist/locales/ko.js +11 -8
  40. package/dist/locales/ko.js.map +1 -1
  41. package/dist/locales/zh.js +11 -8
  42. package/dist/locales/zh.js.map +1 -1
  43. package/dist/psp.d.ts +10 -21
  44. package/dist/react/config.d.ts +34 -0
  45. package/dist/react/context.d.ts +5 -8
  46. package/dist/react/hooks.d.ts +20 -14
  47. package/dist/react/index.d.ts +1 -0
  48. package/dist/react/provider.d.ts +1 -9
  49. package/dist/react/remote.d.ts +0 -1
  50. package/dist/react.js +24 -28
  51. package/dist/react.js.map +1 -1
  52. package/dist/save-payment-method.d.ts +1 -1
  53. package/dist/source.d.ts +0 -9
  54. package/dist/styles.css +1 -1
  55. package/dist/types.d.ts +114 -55
  56. package/docs/payment-form-contract.md +23 -40
  57. package/package.json +3 -3
  58. package/dist/client/generated/openrails-routes.d.ts +0 -2
  59. package/dist/client-DhG2jv34.js +0 -771
  60. package/dist/client-DhG2jv34.js.map +0 -1
  61. package/dist/errors-T-PRm3vV.js +0 -54
  62. package/dist/errors-T-PRm3vV.js.map +0 -1
  63. package/dist/hooks-DLFF-zx5.js +0 -285
  64. package/dist/hooks-DLFF-zx5.js.map +0 -1
  65. 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 paymentRailOptionSchema: z.ZodObject<{
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 PaymentRailOption = z.infer<typeof paymentRailOptionSchema>;
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
- brand: z.ZodOptional<z.ZodString>;
48
- last_four: z.ZodOptional<z.ZodString>;
49
- exp_month: z.ZodOptional<z.ZodNumber>;
50
- exp_year: z.ZodOptional<z.ZodNumber>;
51
- default: z.ZodOptional<z.ZodBoolean>;
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
- period_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
66
- automatically_renews: z.ZodBoolean;
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
- period_hours: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
90
- automatically_renews: z.ZodBoolean;
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
- tax: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
98
- due_today: z.ZodOptional<z.ZodString & z.ZodType<string, string, z.core.$ZodTypeInternals<string, string>>>;
99
- rails: z.ZodArray<z.ZodObject<{
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
- brand: z.ZodOptional<z.ZodString>;
121
- last_four: z.ZodOptional<z.ZodString>;
122
- exp_month: z.ZodOptional<z.ZodNumber>;
123
- exp_year: z.ZodOptional<z.ZodNumber>;
124
- default: z.ZodOptional<z.ZodBoolean>;
125
- }, z.core.$strip>>>;
126
- transaction_url: z.ZodOptional<z.ZodString>;
127
- payment_id: z.ZodOptional<z.ZodString>;
128
- subscription_id: z.ZodOptional<z.ZodString>;
129
- failure_message: z.ZodOptional<z.ZodString>;
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
- last_four: z.ZodOptional<z.ZodString>;
162
- card_type: z.ZodOptional<z.ZodString>;
163
- expiry_date: z.ZodOptional<z.ZodString>;
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
- redirect_url: z.ZodOptional<z.ZodString>;
179
- transaction_url: z.ZodOptional<z.ZodString>;
180
- payment_id: z.ZodOptional<z.ZodString>;
181
- subscription_id: z.ZodOptional<z.ZodString>;
182
- failure_message: z.ZodOptional<z.ZodString>;
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
- "period_hours": 720,
21
- "automatically_renews": true
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/currencies`); OpenRails serves the session at
35
- `GET /v1/checkout-sessions/{id}`; the Go shape is
36
- `billing.HostedCheckoutSession` and its canonical fixture
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
- - `name_on_card` — one visible “Name on card” input with `autocomplete="cc-name"`;
54
- - `country` — a native ISO-3166 country select with `autocomplete="billing country"`;
55
- - `zip` — a country-aware ZIP/postal input with `autocomplete="billing postal-code"`.
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 canonical
78
- `name_on_card`, uppercase ISO country in `country`, and `zip`. Paying with an
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
- ## CCBill
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. The host's pay endpoint relays `payment_token` (or
100
- `payment_method_id`) to `CreateCheckoutSession` with `Confirm: true`; OpenRails
101
- saves a new card, accepts the displayed recurring terms and charges it. A
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
- A custom CheckoutSource may call an application-owned admission wrapper instead
135
- of the default hosted endpoints. It must retain its logical attempt identity
136
- and original request, use the same key for an authorized retry, and expose only
137
- the authorized buyer's state. `getSession` is a read, not another payment.
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.230.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": "node e2e/scripts/contract.ts",
111
- "contract:check": "pnpm contract && git diff --exit-code -- src/client/generated && test -z \"$(git status --porcelain -- src/client/generated)\"",
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>>;