@stripe/stripe-react-native 0.23.3 → 0.25.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 +47 -10
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +72 -16
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +20 -3
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +1 -1
- package/ios/ApplePayButtonManager.m +1 -0
- package/ios/ApplePayButtonView.swift +2 -0
- package/ios/ApplePayUtils.swift +116 -15
- package/ios/ApplePayViewController.swift +21 -8
- package/ios/Errors.swift +1 -0
- package/ios/PaymentPassFinder.swift +9 -5
- package/ios/PushProvisioning/AddToWalletButtonView.swift +1 -1
- package/ios/PushProvisioning/PushProvisioningUtils.swift +8 -19
- package/ios/StripeSdk+PaymentSheet.swift +166 -0
- package/ios/StripeSdk-Bridging-Header.h +1 -0
- package/ios/StripeSdk.m +17 -1
- package/ios/StripeSdk.swift +67 -139
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js +1 -1
- package/lib/commonjs/hooks/usePaymentSheet.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/PlatformPay.js +1 -1
- package/lib/commonjs/types/PlatformPay.js.map +1 -1
- package/lib/commonjs/types/PushProvisioning.js.map +1 -1
- package/lib/commonjs/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/usePaymentSheet.js +1 -1
- package/lib/module/hooks/usePaymentSheet.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/PlatformPay.js +1 -1
- package/lib/module/types/PlatformPay.js.map +1 -1
- package/lib/module/types/PushProvisioning.js.map +1 -1
- package/lib/module/types/components/ApplePayButtonComponent.js.map +1 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +3 -1
- package/lib/typescript/src/components/PlatformPayButton.d.ts +6 -1
- package/lib/typescript/src/functions.d.ts +1 -1
- package/lib/typescript/src/hooks/usePaymentSheet.d.ts +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +1 -1
- package/lib/typescript/src/types/Errors.d.ts +2 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +17 -1
- package/lib/typescript/src/types/PlatformPay.d.ts +64 -1
- package/lib/typescript/src/types/PushProvisioning.d.ts +3 -1
- package/lib/typescript/src/types/components/ApplePayButtonComponent.d.ts +1 -0
- package/package.json +1 -1
- package/src/NativeStripeSdk.tsx +13 -1
- package/src/components/PlatformPayButton.tsx +31 -3
- package/src/functions.ts +34 -21
- package/src/hooks/usePaymentSheet.tsx +2 -2
- package/src/hooks/useStripe.tsx +8 -4
- package/src/types/Errors.ts +1 -0
- package/src/types/PaymentSheet.ts +33 -3
- package/src/types/PlatformPay.ts +72 -1
- package/src/types/PushProvisioning.ts +3 -1
- package/src/types/components/ApplePayButtonComponent.ts +1 -0
- package/stripe-react-native.podspec +1 -1
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import type { BillingDetails, AddressDetails } from './Common';
|
|
2
2
|
import type { CartSummaryItem } from './ApplePay';
|
|
3
|
+
import type {
|
|
4
|
+
ButtonType,
|
|
5
|
+
RecurringPaymentRequest,
|
|
6
|
+
AutomaticReloadPaymentRequest,
|
|
7
|
+
MultiMerchantRequest,
|
|
8
|
+
} from './PlatformPay';
|
|
3
9
|
|
|
4
10
|
export type SetupParams = ClientSecretParams & {
|
|
5
11
|
/** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
|
|
@@ -57,9 +63,26 @@ export type ApplePayParams = {
|
|
|
57
63
|
/**
|
|
58
64
|
* An array of CartSummaryItem item objects that summarize the amount of the payment. If you're using a SetupIntent
|
|
59
65
|
* for a recurring payment, you should set this to display the amount you intend to charge. */
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
66
|
+
cartItems?: CartSummaryItem[];
|
|
67
|
+
/** Sets the text displayed by the call to action button in the Apple Pay sheet. */
|
|
68
|
+
buttonType?: ButtonType;
|
|
69
|
+
/** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */
|
|
70
|
+
request?:
|
|
71
|
+
| RecurringPaymentRequest
|
|
72
|
+
| AutomaticReloadPaymentRequest
|
|
73
|
+
| MultiMerchantRequest;
|
|
74
|
+
/** Callback function for setting the order details (retrieved from your server) to give users the
|
|
75
|
+
* ability to track and manage their purchases in Wallet. Stripe calls your implementation after the
|
|
76
|
+
* payment is complete, but before iOS dismisses the Apple Pay sheet. You must call the `completion`
|
|
77
|
+
* function, or else the Apple Pay sheet will hang. */
|
|
78
|
+
setOrderTracking?: (
|
|
79
|
+
completion: (
|
|
80
|
+
orderIdentifier: string,
|
|
81
|
+
orderTypeIdentifier: string,
|
|
82
|
+
authenticationToken: string,
|
|
83
|
+
webServiceUrl: string
|
|
84
|
+
) => void
|
|
85
|
+
) => void;
|
|
63
86
|
};
|
|
64
87
|
|
|
65
88
|
export type GooglePayParams = {
|
|
@@ -232,3 +255,10 @@ export interface PaymentOption {
|
|
|
232
255
|
label: string;
|
|
233
256
|
image: string;
|
|
234
257
|
}
|
|
258
|
+
|
|
259
|
+
export type PresentOptions = {
|
|
260
|
+
/** The number of milliseconds (after presenting) before the Payment Sheet closes automatically, at which point
|
|
261
|
+
*`presentPaymentSheet` will resolve with an `error.code` of `PaymentSheetError.Timeout`. The default is no timeout.
|
|
262
|
+
*/
|
|
263
|
+
timeout?: number;
|
|
264
|
+
};
|
package/src/types/PlatformPay.ts
CHANGED
|
@@ -69,6 +69,77 @@ export type ApplePayBaseParams = {
|
|
|
69
69
|
supportedCountries?: Array<string>;
|
|
70
70
|
};
|
|
71
71
|
|
|
72
|
+
export type ApplePayConfirmParams = {
|
|
73
|
+
/** A typical request is for a one-time payment. To support different types of payment requests, include a PaymentRequestType. Only supported on iOS 16 and up. */
|
|
74
|
+
request?:
|
|
75
|
+
| RecurringPaymentRequest
|
|
76
|
+
| AutomaticReloadPaymentRequest
|
|
77
|
+
| MultiMerchantRequest;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export enum PaymentRequestType {
|
|
81
|
+
Recurring = 'Recurring',
|
|
82
|
+
AutomaticReload = 'AutomaticReload',
|
|
83
|
+
MultiMerchant = 'MultiMerchant',
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/** Use this for a recurring payment, typically a subscription. */
|
|
87
|
+
export type RecurringPaymentRequest = {
|
|
88
|
+
type: PaymentRequestType.Recurring;
|
|
89
|
+
/** A description that you provide of the recurring payment and that Apple Pay displays to the user in the sheet. */
|
|
90
|
+
description: string;
|
|
91
|
+
/** A URL to a web page where the user can update or delete the payment method for the recurring payment. */
|
|
92
|
+
managementUrl: string;
|
|
93
|
+
/** The regular billing cycle for the payment, including start and end dates, an interval, and an interval count. */
|
|
94
|
+
billing: RecurringCartSummaryItem;
|
|
95
|
+
/** Same as the billing property, but use this if the purchase has a trial period. */
|
|
96
|
+
trialBilling?: RecurringCartSummaryItem;
|
|
97
|
+
/** A localized billing agreement that the sheet displays to the user before the user authorizes the payment. */
|
|
98
|
+
billingAgreement?: string;
|
|
99
|
+
/** A URL you provide to receive life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
|
|
100
|
+
* For more information about handling merchant token life-cycle notifications, see Receiving and handling merchant token notifications.
|
|
101
|
+
*/
|
|
102
|
+
tokenNotificationURL?: string;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/** Use this for an automatic reload or refill payment, such as a store card top-up. */
|
|
106
|
+
export type AutomaticReloadPaymentRequest = {
|
|
107
|
+
type: PaymentRequestType.AutomaticReload;
|
|
108
|
+
/** A description that you provide of the recurring payment and that Apple Pay displays to the user in the sheet. */
|
|
109
|
+
description: string;
|
|
110
|
+
/** A URL to a web page where the user can update or delete the payment method for the recurring payment. */
|
|
111
|
+
managementUrl: string;
|
|
112
|
+
/** A short, localized description of the item. */
|
|
113
|
+
label: string;
|
|
114
|
+
/** This is the amount that is automatically applied to the account when the account balance drops below the threshold amount. */
|
|
115
|
+
reloadAmount: string;
|
|
116
|
+
/** The balance an account reaches before you apply the automatic reload amount. */
|
|
117
|
+
thresholdAmount: string;
|
|
118
|
+
/** A localized billing agreement that the sheet displays to the user before the user authorizes the payment. */
|
|
119
|
+
billingAgreement?: string;
|
|
120
|
+
/** A URL you provide to receive life-cycle notifications from the Apple Pay servers about the Apple Pay merchant token for the recurring payment.
|
|
121
|
+
* For more information about handling merchant token life-cycle notifications, see Receiving and handling merchant token notifications.
|
|
122
|
+
*/
|
|
123
|
+
tokenNotificationURL?: string;
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
/** Use this to indicate payments for multiple merchants. */
|
|
127
|
+
export type MultiMerchantRequest = {
|
|
128
|
+
type: PaymentRequestType.MultiMerchant;
|
|
129
|
+
merchants: Array<{
|
|
130
|
+
/** The Apple Pay merchant identifier. */
|
|
131
|
+
merchantIdentifier: string;
|
|
132
|
+
/** An external identifier for the merchant. */
|
|
133
|
+
externalIdentifier: string;
|
|
134
|
+
/** The merchant’s display name that the Apple Pay server associates with the payment token. */
|
|
135
|
+
merchantName: string;
|
|
136
|
+
/** The merchant’s top-level domain that the Apple Pay server associates with the payment token. */
|
|
137
|
+
merchantDomain?: string;
|
|
138
|
+
/** The amount to authorize for the payment token. */
|
|
139
|
+
amount: string;
|
|
140
|
+
}>;
|
|
141
|
+
};
|
|
142
|
+
|
|
72
143
|
export type ApplePayPaymentMethodParams = {
|
|
73
144
|
/** Set this value to true to display the coupon code field, or pass the 'couponCode' field to autofill with a coupon code. Defaults to false. If true, you must implement the PlatformPayButton component's `onCouponCodeEntered` callback and call `updatePlatformPaySheet` from there. */
|
|
74
145
|
supportsCouponCode?: boolean;
|
|
@@ -158,7 +229,7 @@ export type ConfirmParams = {
|
|
|
158
229
|
/** Defines Google Pay behavior. Android only. */
|
|
159
230
|
googlePay?: GooglePayBaseParams;
|
|
160
231
|
/** Defines Apple Pay behavior. iOS only. */
|
|
161
|
-
applePay?: ApplePayBaseParams;
|
|
232
|
+
applePay?: ApplePayBaseParams & ApplePayConfirmParams;
|
|
162
233
|
};
|
|
163
234
|
|
|
164
235
|
export enum ButtonType {
|
|
@@ -39,12 +39,14 @@ export type IsCardInWalletResult =
|
|
|
39
39
|
export type CanAddCardToWalletParams = {
|
|
40
40
|
/** The `primary_account_identifier` value from the issued card. Can be an empty string. */
|
|
41
41
|
primaryAccountIdentifier: string | null;
|
|
42
|
-
/** Last 4 digits of the card number. */
|
|
42
|
+
/** Last 4 digits of the card number. Required for Android. */
|
|
43
43
|
cardLastFour: string;
|
|
44
44
|
/** iOS only. Set this to `true` until shipping through TestFlight || App Store. If false, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */
|
|
45
45
|
testEnv?: boolean;
|
|
46
46
|
/** iOS only. Set this to `true` if: your user has an Apple Watch device currently paired, and you want to check that device for the presence of the specified card. */
|
|
47
47
|
hasPairedAppleWatch?: boolean;
|
|
48
|
+
/** Android only, defaults to `true`. Set this to `false` if you'd like to allow users without NFC-enabled devices to add cards to the wallet. NFC is required for paying in stores. */
|
|
49
|
+
supportsTapToPay?: boolean;
|
|
48
50
|
};
|
|
49
51
|
|
|
50
52
|
export type CanAddCardToWalletResult =
|