@stripe/stripe-react-native 0.64.0 → 0.65.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/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +835 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +17 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +2 -2
- package/android/detekt/detekt-baseline.xml +146 -0
- package/android/detekt/detekt.gradle +45 -0
- package/android/detekt/detekt.yml +722 -0
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +0 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +2 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +76 -4
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +0 -4
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +36 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfigTest.kt +3 -3
- package/ios/Mappers.swift +0 -5
- package/ios/PaymentMethodMessagingElementConfig.swift +6 -3
- package/ios/PaymentMethodMessagingElementView.swift +19 -0
- package/ios/StripeSdkImpl.swift +0 -92
- package/jest/mock.js +1 -0
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/PaymentMethodMessagingElement.js +2 -0
- package/lib/commonjs/components/PaymentMethodMessagingElement.js.map +1 -0
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/connect/Components.js +1 -1
- package/lib/commonjs/connect/Components.js.map +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js +1 -1
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -1
- package/lib/commonjs/connect/NavigationBar.js +1 -1
- package/lib/commonjs/connect/NavigationBar.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/hooks/useCheckout.js +2 -0
- package/lib/commonjs/hooks/useCheckout.js.map +1 -0
- package/lib/commonjs/hooks/useOnramp.js +1 -1
- package/lib/commonjs/hooks/useOnramp.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +1 -1
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/Checkout.js +2 -0
- package/lib/commonjs/types/Checkout.js.map +1 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/PaymentMethodMessagingElement.js +2 -0
- package/lib/module/components/PaymentMethodMessagingElement.js.map +1 -0
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/connect/Components.js +1 -1
- package/lib/module/connect/Components.js.map +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/module/connect/EmbeddedComponent.js +1 -1
- package/lib/module/connect/EmbeddedComponent.js.map +1 -1
- package/lib/module/connect/ModalCloseButton.js +1 -1
- package/lib/module/connect/ModalCloseButton.js.map +1 -1
- package/lib/module/connect/NavigationBar.js +1 -1
- package/lib/module/connect/NavigationBar.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/hooks/useCheckout.js +2 -0
- package/lib/module/hooks/useCheckout.js.map +1 -0
- package/lib/module/hooks/useOnramp.js +1 -1
- package/lib/module/hooks/useOnramp.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeNavigationBar.js +1 -1
- package/lib/module/specs/NativePaymentMethodMessagingElement.js +1 -1
- package/lib/module/specs/NativePaymentMethodMessagingElement.js.map +1 -1
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/Checkout.js +2 -0
- package/lib/module/types/Checkout.js.map +1 -0
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts +41 -0
- package/lib/typescript/src/components/PaymentMethodMessagingElement.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useCheckout.d.ts +21 -0
- package/lib/typescript/src/hooks/useCheckout.d.ts.map +1 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts +1 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +3 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts +1 -6
- package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +13 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/Checkout.d.ts +336 -0
- package/lib/typescript/src/types/Checkout.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentMethod.d.ts +1 -5
- package/lib/typescript/src/types/PaymentMethod.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +22 -6
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts +16 -1
- package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts.map +1 -1
- package/package.json +8 -5
- package/src/components/PaymentMethodMessagingElement.tsx +109 -0
- package/src/hooks/useCheckout.tsx +168 -0
- package/src/hooks/useOnramp.tsx +9 -3
- package/src/index.tsx +4 -0
- package/src/specs/NativePaymentMethodMessagingElement.ts +0 -7
- package/src/specs/NativeStripeSdkModule.ts +50 -0
- package/src/types/Checkout.ts +377 -0
- package/src/types/PaymentMethod.ts +0 -6
- package/src/types/PaymentSheet.ts +29 -6
- package/src/types/components/PaymentMethodMessagingElementComponent.tsx +17 -1
- package/stripe-react-native.podspec +8 -8
- package/android/spotless.gradle +0 -19
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* All types for the Checkout Session API.
|
|
3
|
+
* @internal
|
|
4
|
+
*/
|
|
5
|
+
export namespace Checkout {
|
|
6
|
+
/**
|
|
7
|
+
* Configuration options for a `useCheckout` instance.
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export interface Configuration {
|
|
11
|
+
/**
|
|
12
|
+
* Controls whether adaptive pricing is requested for this session.
|
|
13
|
+
*
|
|
14
|
+
* When allowed, Stripe may present prices in the customer's local
|
|
15
|
+
* currency alongside the merchant's settlement currency.
|
|
16
|
+
*
|
|
17
|
+
* Default: `{ allowed: true }`.
|
|
18
|
+
*/
|
|
19
|
+
adaptivePricing?: AdaptivePricing;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Options for adaptive pricing behavior.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export interface AdaptivePricing {
|
|
27
|
+
/**
|
|
28
|
+
* Whether the integration allows adaptive pricing for this session.
|
|
29
|
+
*
|
|
30
|
+
* Set to `false` to prevent Stripe from activating adaptive pricing even
|
|
31
|
+
* if the Checkout Session is configured for it on the server.
|
|
32
|
+
*
|
|
33
|
+
* Default: `true`.
|
|
34
|
+
*/
|
|
35
|
+
allowed: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The loading state of the checkout session.
|
|
40
|
+
*
|
|
41
|
+
* Returned as `state` from `useCheckout`. React re-renders automatically
|
|
42
|
+
* whenever the session changes.
|
|
43
|
+
*
|
|
44
|
+
* - `loading` – a mutation or refresh is in flight; `session` is the most
|
|
45
|
+
* recently loaded value and may be stale.
|
|
46
|
+
* - `loaded` – session is current and ready.
|
|
47
|
+
*
|
|
48
|
+
* Before the initial session load completes, `state` is `null`.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export type State =
|
|
52
|
+
| {
|
|
53
|
+
/**
|
|
54
|
+
* `loading` while a mutation or refresh is in flight.
|
|
55
|
+
*
|
|
56
|
+
* The associated `session` value is the most recently loaded copy and
|
|
57
|
+
* may be stale.
|
|
58
|
+
*/
|
|
59
|
+
status: 'loading';
|
|
60
|
+
/** The most recently loaded session value. */
|
|
61
|
+
session: Session;
|
|
62
|
+
}
|
|
63
|
+
| {
|
|
64
|
+
/** `loaded` when the session is current and ready to use. */
|
|
65
|
+
status: 'loaded';
|
|
66
|
+
/** The latest checkout session value from Stripe. */
|
|
67
|
+
session: Session;
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The status of a checkout session.
|
|
72
|
+
*
|
|
73
|
+
* - `unknown` - A status not recognized by this version of the SDK.
|
|
74
|
+
* - `open` - The checkout session is still in progress.
|
|
75
|
+
* - `complete` - The checkout session is complete.
|
|
76
|
+
* - `expired` - The checkout session has expired.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export type Status = 'unknown' | 'open' | 'complete' | 'expired';
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* The payment status of a checkout session.
|
|
83
|
+
*
|
|
84
|
+
* - `unknown` - A payment status not recognized by this version of the SDK.
|
|
85
|
+
* - `paid` - The payment funds are available in your account.
|
|
86
|
+
* - `unpaid` - The payment funds are not yet available in your account.
|
|
87
|
+
* - `noPaymentRequired` - No payment is currently required for the session.
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export type PaymentStatus =
|
|
91
|
+
| 'unknown'
|
|
92
|
+
| 'paid'
|
|
93
|
+
| 'unpaid'
|
|
94
|
+
| 'noPaymentRequired';
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* A read-only snapshot of a Stripe Checkout Session.
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
export interface Session {
|
|
101
|
+
/** Unique identifier for this checkout session. */
|
|
102
|
+
id: string;
|
|
103
|
+
/** The current session state, if available. */
|
|
104
|
+
status?: Status;
|
|
105
|
+
/** The payment status for this checkout session. */
|
|
106
|
+
paymentStatus: PaymentStatus;
|
|
107
|
+
/** Three-letter ISO 4217 currency code in lowercase (e.g. `"usd"`). */
|
|
108
|
+
currency?: string;
|
|
109
|
+
/** Indicates whether this session was created in live mode. */
|
|
110
|
+
livemode: boolean;
|
|
111
|
+
/** A summary of monetary totals for this session, if available. */
|
|
112
|
+
totals?: Totals;
|
|
113
|
+
/** The line items purchased by the customer. */
|
|
114
|
+
lineItems: LineItem[];
|
|
115
|
+
/** The shipping rate options available for this session. */
|
|
116
|
+
shippingOptions: ShippingOption[];
|
|
117
|
+
/** The discounts applied to this session. */
|
|
118
|
+
discounts: Discount[];
|
|
119
|
+
/** The Stripe customer ID attached to this session, if any. */
|
|
120
|
+
customerId?: string;
|
|
121
|
+
/** The customer's email address, if available. */
|
|
122
|
+
customerEmail?: string;
|
|
123
|
+
/** The billing address set via `updateBillingAddress`, if any. */
|
|
124
|
+
billingAddress?: AddressUpdate;
|
|
125
|
+
/** The shipping address set via `updateShippingAddress`, if any. */
|
|
126
|
+
shippingAddress?: AddressUpdate;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Monetary totals for a checkout session.
|
|
131
|
+
*
|
|
132
|
+
* All amounts are in the smallest currency unit (e.g. cents for USD).
|
|
133
|
+
* @internal
|
|
134
|
+
*/
|
|
135
|
+
export interface Totals {
|
|
136
|
+
/** The subtotal amount before discounts, shipping, and tax. */
|
|
137
|
+
subtotal: number;
|
|
138
|
+
/** The final total after discounts, shipping, and tax. */
|
|
139
|
+
total: number;
|
|
140
|
+
/** The amount currently due from the customer. */
|
|
141
|
+
due: number;
|
|
142
|
+
/** The total discount amount applied to the session. */
|
|
143
|
+
discount: number;
|
|
144
|
+
/** The total shipping amount. */
|
|
145
|
+
shipping: number;
|
|
146
|
+
/** The total tax amount applied to the session. */
|
|
147
|
+
tax: number;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* A line item in a checkout session.
|
|
152
|
+
* @internal
|
|
153
|
+
*/
|
|
154
|
+
export interface LineItem {
|
|
155
|
+
/** Unique identifier for this line item. */
|
|
156
|
+
id: string;
|
|
157
|
+
/** The display name shown for this line item. */
|
|
158
|
+
name: string;
|
|
159
|
+
/** The quantity for this line item. */
|
|
160
|
+
quantity: number;
|
|
161
|
+
/** The per-unit price in the smallest currency unit. */
|
|
162
|
+
unitAmount: number;
|
|
163
|
+
/** Three-letter ISO 4217 currency code in lowercase. */
|
|
164
|
+
currency: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A shipping option available in a checkout session.
|
|
169
|
+
* @internal
|
|
170
|
+
*/
|
|
171
|
+
export interface ShippingOption {
|
|
172
|
+
/** The shipping rate identifier. */
|
|
173
|
+
id: string;
|
|
174
|
+
/** The display name shown to the customer. */
|
|
175
|
+
displayName: string;
|
|
176
|
+
/** The shipping amount in the smallest currency unit. */
|
|
177
|
+
amount: number;
|
|
178
|
+
/** Three-letter ISO 4217 currency code in lowercase. */
|
|
179
|
+
currency: string;
|
|
180
|
+
/** The estimated delivery window shown to the customer, if available. */
|
|
181
|
+
deliveryEstimate?: string;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* A discount applied to a checkout session.
|
|
186
|
+
* @internal
|
|
187
|
+
*/
|
|
188
|
+
export interface Discount {
|
|
189
|
+
/** The coupon associated with this discount. */
|
|
190
|
+
coupon: Coupon;
|
|
191
|
+
/** The promotion code used to apply this discount, if any. */
|
|
192
|
+
promotionCode?: string;
|
|
193
|
+
/** The discount amount in the smallest currency unit. */
|
|
194
|
+
amount: number;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* A coupon associated with a checkout discount.
|
|
199
|
+
* @internal
|
|
200
|
+
*/
|
|
201
|
+
export interface Coupon {
|
|
202
|
+
/** The coupon identifier. */
|
|
203
|
+
id: string;
|
|
204
|
+
/** The display name of the coupon, if one exists. */
|
|
205
|
+
name?: string;
|
|
206
|
+
/** The percentage off, if this is a percentage-based coupon. */
|
|
207
|
+
percentOff?: number;
|
|
208
|
+
/** The fixed amount off, in the smallest currency unit, if applicable. */
|
|
209
|
+
amountOff?: number;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* A locally stored address override for checkout.
|
|
214
|
+
*
|
|
215
|
+
* Address updates are merged into PaymentSheet configuration and may also be
|
|
216
|
+
* sent to Stripe when tax calculation depends on the billing or shipping
|
|
217
|
+
* address.
|
|
218
|
+
* @internal
|
|
219
|
+
*/
|
|
220
|
+
export interface AddressUpdate {
|
|
221
|
+
/** The customer's or recipient's name, if provided. */
|
|
222
|
+
name?: string;
|
|
223
|
+
/** The customer's or recipient's phone number, if provided. */
|
|
224
|
+
phone?: string;
|
|
225
|
+
/** The postal address to use for the update. */
|
|
226
|
+
address: Address;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* A postal address used for billing, shipping, or tax updates.
|
|
231
|
+
* @internal
|
|
232
|
+
*/
|
|
233
|
+
export interface Address {
|
|
234
|
+
/** The country for this address, such as `"US"`. */
|
|
235
|
+
country: string;
|
|
236
|
+
/** The first address line. */
|
|
237
|
+
line1?: string;
|
|
238
|
+
/** The second address line. */
|
|
239
|
+
line2?: string;
|
|
240
|
+
/** The city, district, suburb, town, or village. */
|
|
241
|
+
city?: string;
|
|
242
|
+
/** The state, county, province, or region. */
|
|
243
|
+
state?: string;
|
|
244
|
+
/** The postal or ZIP code. */
|
|
245
|
+
postalCode?: string;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
/**
|
|
249
|
+
* A Checkout-specific error returned from `useCheckout` or a Checkout
|
|
250
|
+
* mutation method.
|
|
251
|
+
* @internal
|
|
252
|
+
*/
|
|
253
|
+
export interface Error {
|
|
254
|
+
/** A machine-readable error code describing the failure. */
|
|
255
|
+
code: ErrorCode;
|
|
256
|
+
/** A human-readable message describing the failure. */
|
|
257
|
+
message: string;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* The set of Checkout-specific error codes.
|
|
262
|
+
*
|
|
263
|
+
* - `Failed` - The operation could not be completed.
|
|
264
|
+
* - `InvalidClientSecret` - The provided Checkout Session client secret is
|
|
265
|
+
* invalid.
|
|
266
|
+
* - `SessionNotOpen` - The Checkout Session is no longer open for updates.
|
|
267
|
+
* - `SheetCurrentlyPresented` - The operation is unavailable while
|
|
268
|
+
* PaymentSheet is being presented.
|
|
269
|
+
* - `Canceled` - The operation was canceled before completion.
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
export type ErrorCode =
|
|
273
|
+
| 'Failed'
|
|
274
|
+
| 'InvalidClientSecret'
|
|
275
|
+
| 'SessionNotOpen'
|
|
276
|
+
| 'SheetCurrentlyPresented'
|
|
277
|
+
| 'Canceled';
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* A handle to a live Checkout Session.
|
|
282
|
+
*
|
|
283
|
+
* Returned by `useCheckout`. Call mutation methods to update the session;
|
|
284
|
+
* the hook's `state` updates automatically after each mutation.
|
|
285
|
+
* @internal
|
|
286
|
+
*/
|
|
287
|
+
export interface Checkout {
|
|
288
|
+
/** @internal Opaque key for the native Checkout instance. Used by `initPaymentSheet`. */
|
|
289
|
+
readonly sessionKey: string;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Sets the shipping address for this checkout.
|
|
293
|
+
*
|
|
294
|
+
* The address is stored locally and merged into PaymentSheet configuration
|
|
295
|
+
* when presenting payment UI. If automatic tax is enabled and the tax
|
|
296
|
+
* address source is "shipping", the address is also sent to the server to
|
|
297
|
+
* compute updated tax amounts.
|
|
298
|
+
*
|
|
299
|
+
* @param address - The shipping address to set.
|
|
300
|
+
* @param name - The recipient's name.
|
|
301
|
+
* @param phone - The recipient's phone number.
|
|
302
|
+
*/
|
|
303
|
+
updateShippingAddress(
|
|
304
|
+
address: Checkout.Address,
|
|
305
|
+
name?: string,
|
|
306
|
+
phone?: string
|
|
307
|
+
): Promise<void>;
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Sets the billing address for this checkout.
|
|
311
|
+
*
|
|
312
|
+
* The address is stored locally and merged into PaymentSheet configuration
|
|
313
|
+
* when presenting payment UI. If automatic tax is enabled and the tax
|
|
314
|
+
* address source is "billing", the address is also sent to the server to
|
|
315
|
+
* compute updated tax amounts.
|
|
316
|
+
*
|
|
317
|
+
* @param address - The billing address to set.
|
|
318
|
+
* @param name - The customer's name.
|
|
319
|
+
* @param phone - The customer's phone number.
|
|
320
|
+
*/
|
|
321
|
+
updateBillingAddress(
|
|
322
|
+
address: Checkout.Address,
|
|
323
|
+
name?: string,
|
|
324
|
+
phone?: string
|
|
325
|
+
): Promise<void>;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Applies a promotion code to the session.
|
|
329
|
+
* - Parameter code: The promotion code to apply (e.g. `"SUMMER2026"`).
|
|
330
|
+
* - Throws: `CheckoutError` if applying the promotion code fails.
|
|
331
|
+
* @internal
|
|
332
|
+
*/
|
|
333
|
+
applyPromotionCode(code: string): Promise<void>;
|
|
334
|
+
|
|
335
|
+
/**
|
|
336
|
+
* Removes the currently applied promotion code.
|
|
337
|
+
* - Throws: `CheckoutError` if removing the promotion code fails.
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
removePromotionCode(): Promise<void>;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Updates the quantity of a line item.
|
|
344
|
+
* @param lineItemId - The ID of the line item to update.
|
|
345
|
+
* @param quantity - The new quantity to set.
|
|
346
|
+
* - Throws: `CheckoutError` if updating the line item quantity fails.
|
|
347
|
+
* @internal
|
|
348
|
+
*/
|
|
349
|
+
updateLineItemQuantity(lineItemId: string, quantity: number): Promise<void>;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Selects a shipping option for the session.
|
|
353
|
+
* @param id - The ID of the shipping rate to select.
|
|
354
|
+
* - Throws: `CheckoutError` if selecting the shipping option fails.
|
|
355
|
+
* @internal
|
|
356
|
+
*/
|
|
357
|
+
selectShippingOption(id: string): Promise<void>;
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Sets the customer's tax ID on the session.
|
|
361
|
+
* @param type - The tax ID type (e.g. `"eu_vat"`).
|
|
362
|
+
* @param value - The tax ID value (e.g. `"DE123456789"`).
|
|
363
|
+
* - Throws: `CheckoutError` if updating the tax ID fails.
|
|
364
|
+
* @internal
|
|
365
|
+
*/
|
|
366
|
+
updateTaxId(type: string, value: string): Promise<void>;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Refreshes the session by fetching the latest copy from Stripe.
|
|
370
|
+
*
|
|
371
|
+
* Call this after making server-side changes to the Checkout Session
|
|
372
|
+
* so the local state stays in sync.
|
|
373
|
+
* - Throws: `CheckoutError` if refreshing the session fails.
|
|
374
|
+
* @internal
|
|
375
|
+
*/
|
|
376
|
+
refresh(): Promise<void>;
|
|
377
|
+
}
|
|
@@ -20,7 +20,6 @@ export interface Result {
|
|
|
20
20
|
Fpx: FpxResult;
|
|
21
21
|
Ideal: IdealResult;
|
|
22
22
|
SepaDebit: SepaDebitResult;
|
|
23
|
-
Upi: UpiResult;
|
|
24
23
|
USBankAccount: USBankAccountResult;
|
|
25
24
|
}
|
|
26
25
|
|
|
@@ -254,10 +253,6 @@ export interface SepaDebitResult {
|
|
|
254
253
|
last4?: string;
|
|
255
254
|
}
|
|
256
255
|
|
|
257
|
-
export interface UpiResult {
|
|
258
|
-
vpa?: string;
|
|
259
|
-
}
|
|
260
|
-
|
|
261
256
|
export type USBankAccountResult = {
|
|
262
257
|
routingNumber?: string;
|
|
263
258
|
accountHolderType?: BankAcccountHolderType;
|
|
@@ -286,7 +281,6 @@ export type Type =
|
|
|
286
281
|
| 'Bancontact'
|
|
287
282
|
| 'Multibanco'
|
|
288
283
|
| 'Oxxo'
|
|
289
|
-
| 'Upi'
|
|
290
284
|
| 'USBankAccount'
|
|
291
285
|
| 'PayPal'
|
|
292
286
|
| 'Unknown';
|
|
@@ -15,6 +15,7 @@ import type { FutureUsage } from './PaymentIntent';
|
|
|
15
15
|
import type { Result } from './PaymentMethod';
|
|
16
16
|
import type { StripeError } from './Errors';
|
|
17
17
|
import type { Result as ConfirmationTokenResult } from './ConfirmationToken';
|
|
18
|
+
import type { Checkout } from './Checkout';
|
|
18
19
|
|
|
19
20
|
export type SetupParamsBase = IntentParams & {
|
|
20
21
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
@@ -46,7 +47,7 @@ export type SetupParamsBase = IntentParams & {
|
|
|
46
47
|
defaultShippingDetails?: AddressDetails;
|
|
47
48
|
/** If true, allows payment methods that do not move money at the end of the checkout. Defaults to false.
|
|
48
49
|
*
|
|
49
|
-
* Some payment methods can
|
|
50
|
+
* Some payment methods can't guarantee you will receive funds from your customer at the end of the checkout
|
|
50
51
|
* because they take time to settle (eg. most bank debits, like SEPA or ACH) or require customer action to
|
|
51
52
|
* complete (e.g. OXXO, Konbini, Boleto). If this is set to true, make sure your integration listens to webhooks
|
|
52
53
|
* for notifications on whether a payment has succeeded or not.
|
|
@@ -65,7 +66,7 @@ export type SetupParamsBase = IntentParams & {
|
|
|
65
66
|
* You can override the default order in which payment methods are displayed in PaymentSheet with a list of payment method types.
|
|
66
67
|
* See https://stripe.com/docs/api/payment_methods/object#payment_method_object-type for the list of valid types. You may also pass external payment methods.
|
|
67
68
|
* - Example: ["card", "external_paypal", "klarna"]
|
|
68
|
-
* - Note: If you omit payment methods from this list, they
|
|
69
|
+
* - Note: If you omit payment methods from this list, they'll be automatically ordered by Stripe after the ones you provide. Invalid payment methods are ignored.
|
|
69
70
|
*/
|
|
70
71
|
paymentMethodOrder?: Array<String>;
|
|
71
72
|
/** This is an experimental feature that may be removed at any time.
|
|
@@ -112,9 +113,30 @@ export type SetupParamsBase = IntentParams & {
|
|
|
112
113
|
};
|
|
113
114
|
};
|
|
114
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Parameters for initializing PaymentSheet from a Checkout Session.
|
|
118
|
+
* Use when you have called `useCheckout` and the state is `loaded`.
|
|
119
|
+
* @checkoutSessionsPreview
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
122
|
+
export type CheckoutSetupParams = {
|
|
123
|
+
/** A fully loaded Checkout instance whose `state.status` is `'loaded'`. */
|
|
124
|
+
checkout: Checkout;
|
|
125
|
+
paymentIntentClientSecret?: never;
|
|
126
|
+
setupIntentClientSecret?: never;
|
|
127
|
+
intentConfiguration?: never;
|
|
128
|
+
customerEphemeralKeySecret?: never;
|
|
129
|
+
customerSessionClientSecret?: never;
|
|
130
|
+
} & Omit<
|
|
131
|
+
SetupParamsBase,
|
|
132
|
+
| 'paymentIntentClientSecret'
|
|
133
|
+
| 'setupIntentClientSecret'
|
|
134
|
+
| 'intentConfiguration'
|
|
135
|
+
>;
|
|
136
|
+
|
|
115
137
|
export type SetupParams =
|
|
116
138
|
| (SetupParamsBase & {
|
|
117
|
-
/** A short-lived token that allows the SDK to access a Customer
|
|
139
|
+
/** A short-lived token that allows the SDK to access a Customer's payment methods. */
|
|
118
140
|
customerEphemeralKeySecret: string;
|
|
119
141
|
customerSessionClientSecret?: never;
|
|
120
142
|
})
|
|
@@ -123,7 +145,8 @@ export type SetupParams =
|
|
|
123
145
|
/** The client secret of this Customer Session. Used on the client to set up secure access to the given customer. */
|
|
124
146
|
customerSessionClientSecret: string;
|
|
125
147
|
})
|
|
126
|
-
| SetupParamsBase
|
|
148
|
+
| SetupParamsBase
|
|
149
|
+
| CheckoutSetupParams;
|
|
127
150
|
|
|
128
151
|
export type IntentParams =
|
|
129
152
|
| {
|
|
@@ -406,7 +429,7 @@ export type PrimaryButtonColorConfig = {
|
|
|
406
429
|
successTextColor?: ThemedColor;
|
|
407
430
|
};
|
|
408
431
|
|
|
409
|
-
/** A color that
|
|
432
|
+
/** A color that's either a single hex or a light/dark pair */
|
|
410
433
|
export type ThemedColor = string | { light: string; dark: string };
|
|
411
434
|
|
|
412
435
|
/** Represents edge insets */
|
|
@@ -649,7 +672,7 @@ export type Mode = PaymentMode | SetupMode;
|
|
|
649
672
|
export enum CaptureMethod {
|
|
650
673
|
/** (Default) Stripe automatically captures funds when the customer authorizes the payment. */
|
|
651
674
|
Automatic = 'Automatic',
|
|
652
|
-
/** Place a hold on the funds when the customer authorizes the payment, but don
|
|
675
|
+
/** Place a hold on the funds when the customer authorizes the payment, but don't capture the funds until later. (Not all payment methods support this.) */
|
|
653
676
|
Manual = 'Manual',
|
|
654
677
|
/** Asynchronously capture funds when the customer authorizes the payment.
|
|
655
678
|
- Note: Recommended over `CaptureMethod.Automatic` due to improved latency, but may require additional integration changes.
|
|
@@ -25,9 +25,25 @@ export enum PaymentMethodMessagingElementStyle {
|
|
|
25
25
|
Light = 'light',
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
export interface PaymentMethodMessagingElementFont {
|
|
29
|
+
/**
|
|
30
|
+
* The font used for the element text.
|
|
31
|
+
*
|
|
32
|
+
* On iOS, this should be the "PostScript name" found in Font Book after installing the font.
|
|
33
|
+
* On Android, this should be the name of the font file (containing only lowercase alphanumeric characters) in android/app/src/main/res/font
|
|
34
|
+
*
|
|
35
|
+
* @default The OS's system font
|
|
36
|
+
*/
|
|
37
|
+
family?: string;
|
|
38
|
+
/** The font size for text in the element. This value is required to be greater than 0.
|
|
39
|
+
* @default The OS's default text size.
|
|
40
|
+
*/
|
|
41
|
+
size?: number;
|
|
42
|
+
}
|
|
43
|
+
|
|
28
44
|
export interface PaymentMethodMessagingElementAppearance {
|
|
29
45
|
/** Font settings for the element. */
|
|
30
|
-
font?:
|
|
46
|
+
font?: PaymentMethodMessagingElementFont;
|
|
31
47
|
/** The color used for the element text. */
|
|
32
48
|
textColor?: PaymentSheetTypes.ThemedColor;
|
|
33
49
|
/** The color used for the text that links to available BNPL plans. */
|
|
@@ -2,7 +2,7 @@ require 'json'
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
# Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
|
|
5
|
-
stripe_version = '~> 25.
|
|
5
|
+
stripe_version = '~> 25.12.0'
|
|
6
6
|
|
|
7
7
|
fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
|
|
8
8
|
|
|
@@ -17,13 +17,6 @@ Pod::Spec.new do |s|
|
|
|
17
17
|
s.platforms = { ios: '13.0' }
|
|
18
18
|
s.source = { git: 'https://github.com/stripe/stripe-react-native.git', tag: s.version.to_s }
|
|
19
19
|
|
|
20
|
-
s.source_files = 'ios/**/*.{h,m,mm,swift}'
|
|
21
|
-
s.exclude_files = [ 'ios/Tests/', 'ios/NewArch/' ]
|
|
22
|
-
# These headers contain c++ code so make sure they are private to avoid
|
|
23
|
-
# being exported to the umbrella header, which is used by swift interop.
|
|
24
|
-
# StripeSwiftInterop.h will cause circular dependency issues.
|
|
25
|
-
s.private_header_files = [ 'ios/StripeSdk.h', 'ios/StripeSwiftInterop.h' ]
|
|
26
|
-
|
|
27
20
|
s.header_dir = 'stripe_react_native'
|
|
28
21
|
s.pod_target_xcconfig = {
|
|
29
22
|
'USE_HEADERMAP' => 'YES',
|
|
@@ -44,6 +37,12 @@ Pod::Spec.new do |s|
|
|
|
44
37
|
end
|
|
45
38
|
|
|
46
39
|
s.subspec 'Core' do |core|
|
|
40
|
+
core.source_files = 'ios/**/*.{h,m,mm,swift}'
|
|
41
|
+
core.exclude_files = [ 'ios/Tests/', 'ios/NewArch/', 'ios/StripeOnrampSdk.h', 'ios/StripeOnrampSdk.mm' ]
|
|
42
|
+
# These headers contain c++ code so make sure they are private to avoid
|
|
43
|
+
# being exported to the umbrella header, which is used by swift interop.
|
|
44
|
+
# StripeSwiftInterop.h will cause circular dependency issues.
|
|
45
|
+
core.private_header_files = [ 'ios/StripeSdk.h', 'ios/StripeSwiftInterop.h' ]
|
|
47
46
|
core.dependency 'React-Core'
|
|
48
47
|
core.dependency 'Stripe', stripe_version
|
|
49
48
|
core.dependency 'StripePaymentSheet', stripe_version
|
|
@@ -54,6 +53,7 @@ Pod::Spec.new do |s|
|
|
|
54
53
|
end
|
|
55
54
|
|
|
56
55
|
s.subspec 'Onramp' do |onramp|
|
|
56
|
+
onramp.source_files = [ 'ios/StripeOnrampSdk.h', 'ios/StripeOnrampSdk.mm' ]
|
|
57
57
|
onramp.dependency 'stripe-react-native/Core'
|
|
58
58
|
onramp.dependency 'StripeCryptoOnramp', stripe_version
|
|
59
59
|
end
|
package/android/spotless.gradle
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
apply plugin: 'com.diffplug.spotless'
|
|
2
|
-
|
|
3
|
-
allprojects {
|
|
4
|
-
repositories {
|
|
5
|
-
google()
|
|
6
|
-
mavenCentral()
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
spotless {
|
|
12
|
-
kotlin {
|
|
13
|
-
target 'src/**/*.kt'
|
|
14
|
-
ktlint("1.5.0").setEditorConfigPath("$projectDir/../.editorconfig")
|
|
15
|
-
trimTrailingWhitespace()
|
|
16
|
-
indentWithSpaces()
|
|
17
|
-
endWithNewline()
|
|
18
|
-
}
|
|
19
|
-
}
|