From e96c57c0d8e686db9ef7f229e0f6b0fa1c38e7df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Sat, 1 Feb 2025 14:35:20 +0900 Subject: [PATCH 01/45] feat(identity): call savedAlive --- .../getcapacitor/community/stripe/identity/StripeIdentity.kt | 3 +++ .../community/stripe/identity/StripeIdentityPlugin.kt | 2 ++ 2 files changed, 5 insertions(+) diff --git a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt index 888058bd..16857b41 100644 --- a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt +++ b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt @@ -77,6 +77,7 @@ class StripeIdentity( IdentityVerificationSheetEvent.Completed.webEventName ) ) + bridge.releaseCall(callbackId) } fun onVerificationCancelled(bridge: Bridge, callbackId: String?) { @@ -88,6 +89,7 @@ class StripeIdentity( IdentityVerificationSheetEvent.Canceled.webEventName ) ) + bridge.releaseCall(callbackId) } fun onVerificationFailed(bridge: Bridge, callbackId: String?) { @@ -99,5 +101,6 @@ class StripeIdentity( IdentityVerificationSheetEvent.Failed.webEventName ) ) + bridge.releaseCall(callbackId) } } diff --git a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt index 8b70c9aa..75992af1 100644 --- a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt +++ b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt @@ -66,6 +66,8 @@ class StripeIdentityPlugin : Plugin() { @PluginMethod fun present(call: PluginCall) { identityVerificationCallbackId = call.callbackId + + call.setKeepAlive(true); bridge.saveCall(call) implementation.present(call) From a8c4340cdf1aa5d8e1fb14ddb8019e13a84b1cff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Sat, 1 Feb 2025 14:39:55 +0900 Subject: [PATCH 02/45] chore --- packages/identity/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/identity/package.json b/packages/identity/package.json index bdf225ff..00c2c968 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-identity", - "version": "6.5.0", + "version": "6.5.0-issues368-0", "engines": { "node": ">=18.0.0" }, From cfee262f2aacd00ec9287c0c6f490ecf1261ec03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 18 Jun 2025 22:11:25 +0900 Subject: [PATCH 03/45] fix(event): added missing terminalDiscoveringReaders and terminalCancelDiscoveredReaders https://github.com/capacitor-community/stripe/issues/437 --- .../getcapacitor/community/stripe/terminal/StripeTerminal.kt | 5 +++++ .../ios/Sources/StripeTerminalPlugin/StripeTerminal.swift | 3 +++ .../ios/Sources/StripeTerminalPlugin/TerminalEvents.swift | 1 + 3 files changed, 9 insertions(+) diff --git a/packages/terminal/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.kt b/packages/terminal/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.kt index 0dbee971..f89fd66d 100644 --- a/packages/terminal/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.kt +++ b/packages/terminal/android/src/main/java/com/getcapacitor/community/stripe/terminal/StripeTerminal.kt @@ -203,6 +203,11 @@ class StripeTerminal( return } + notifyListeners( + TerminalEnumEvent.DiscoveringReaders.webEventName, + emptyObject + ) + discoveryCancelable = Terminal.getInstance() .discoverReaders( config, diff --git a/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift b/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift index bcca7c1f..e92b7592 100644 --- a/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift +++ b/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift @@ -59,6 +59,8 @@ public class StripeTerminal: NSObject, DiscoveryDelegate, TerminalDelegate, Read } self.discoverCall = call + self.plugin?.notifyListeners(TerminalEvents.DiscoveringReaders.rawValue, data: [:]) + self.discoverCancelable = Terminal.shared.discoverReaders(config, delegate: self) { error in if let error = error { print("discoverReaders failed: \(error)") @@ -377,6 +379,7 @@ public class StripeTerminal: NSObject, DiscoveryDelegate, TerminalDelegate, Read if let error = error { call.reject(error.localizedDescription) } else { + self.plugin?.notifyListeners(TerminalEvents.CancelDiscoveredReaders.rawValue, data: [:]) call.resolve() } } diff --git a/packages/terminal/ios/Sources/StripeTerminalPlugin/TerminalEvents.swift b/packages/terminal/ios/Sources/StripeTerminalPlugin/TerminalEvents.swift index ab2115f1..31d53ebb 100644 --- a/packages/terminal/ios/Sources/StripeTerminalPlugin/TerminalEvents.swift +++ b/packages/terminal/ios/Sources/StripeTerminalPlugin/TerminalEvents.swift @@ -3,6 +3,7 @@ public enum TerminalEvents: String { case DiscoveringReaders = "terminalDiscoveringReaders" case DiscoveredReaders = "terminalDiscoveredReaders" case ConnectedReader = "terminalConnectedReader" + case CancelDiscoveredReaders = "terminalCancelDiscoveredReaders" case DisconnectedReader = "terminalDisconnectedReader" case ConnectionStatusChange = "terminalConnectionStatusChange" case UnexpectedReaderDisconnect = "terminalUnexpectedReaderDisconnect" From ac6d38ed84c554c4078234b7e871137af8dca719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 18 Jun 2025 23:25:39 +0900 Subject: [PATCH 04/45] feat(android): support options --- .../stripe/helper/PaymentSheetHelper.kt | 73 +++++++++++++ .../stripe/paymentflow/PaymentFlowExecutor.kt | 23 +++- .../paymentsheet/PaymentSheetExecutor.kt | 101 +++++------------- packages/payment/src/shared/index.ts | 39 +++++++ 4 files changed, 158 insertions(+), 78 deletions(-) create mode 100644 packages/payment/android/src/main/java/com/getcapacitor/community/stripe/helper/PaymentSheetHelper.kt diff --git a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/helper/PaymentSheetHelper.kt b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/helper/PaymentSheetHelper.kt new file mode 100644 index 00000000..15296b8a --- /dev/null +++ b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/helper/PaymentSheetHelper.kt @@ -0,0 +1,73 @@ +package com.getcapacitor.community.stripe.helper + +import com.getcapacitor.JSObject +import com.stripe.android.paymentsheet.PaymentSheet +import com.stripe.android.paymentsheet.addresselement.AddressDetails +import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration +import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode +import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode + +class PaymentSheetHelper { + fun fromJSObjectToBillingDetails(obj: JSObject?): PaymentSheet.BillingDetails { + if (obj == null) return PaymentSheet.BillingDetails() + val address = fromJSObjectToAddress(obj.getJSObject("address", null)) + return PaymentSheet.BillingDetails( + address = address, + email = obj.getString("email", null), + name = obj.getString("name", null), + phone = obj.getString("phone", null) + ) + } + + fun fromJSObjectToShippingDetails(obj: JSObject?): AddressDetails? { + if (obj == null) return null + val address = fromJSObjectToAddress(obj.getJSObject("address", null)) + return AddressDetails( + name = obj.getString("name", null), + address = address, + phoneNumber = obj.getString("phone", null), + isCheckboxSelected = obj.getBoolean("isCheckboxSelected", false) + ) + } + + fun fromJSObjectToBillingCollectionConfig(obj: JSObject?): BillingDetailsCollectionConfiguration { + if (obj == null) return BillingDetailsCollectionConfiguration() + + val name = parseCollectionMode(obj.getString("name")) + val phone = parseCollectionMode(obj.getString("phone")) + val email = parseCollectionMode(obj.getString("email")) + val address = parseAddressCollectionMode(obj.getString("address")) + + return BillingDetailsCollectionConfiguration( + name = name, + phone = phone, + email = email, + address = address, + attachDefaultsToPaymentMethod = false + ) + } + + private fun fromJSObjectToAddress(obj: JSObject?): PaymentSheet.Address { + if (obj == null) return PaymentSheet.Address() + return PaymentSheet.Address( + country = obj.getString("country", null), + city = obj.getString("city", null), + line1 = obj.getString("line1", null), + line2 = obj.getString("line2", null), + postalCode = obj.getString("postalCode", null), + state = obj.getString("state", null) + ) + } + + private fun parseCollectionMode(mode: String?): CollectionMode = when (mode) { + "always" -> CollectionMode.Always + "never" -> CollectionMode.Never + else -> CollectionMode.Automatic + } + + private fun parseAddressCollectionMode(mode: String?): AddressCollectionMode = when (mode) { + "full" -> AddressCollectionMode.Full + "never" -> AddressCollectionMode.Never + else -> AddressCollectionMode.Automatic + } +} \ No newline at end of file diff --git a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt index 1cac8d6f..4f849f4f 100644 --- a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt +++ b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt @@ -6,6 +6,7 @@ import androidx.core.util.Supplier import com.getcapacitor.Bridge import com.getcapacitor.JSObject import com.getcapacitor.PluginCall +import com.getcapacitor.community.stripe.helper.PaymentSheetHelper import com.getcapacitor.community.stripe.models.Executor import com.google.android.gms.common.util.BiConsumer import com.stripe.android.paymentsheet.PaymentSheet @@ -72,8 +73,20 @@ class PaymentFlowExecutor( ) PaymentSheet.CustomerConfiguration(customerId, customerEphemeralKeySecret!!) else null + val defaultBillingDetailsConfiguration = PaymentSheetHelper().fromJSObjectToBillingDetails(call.getObject("defaultBillingDetails", null)) + val shippingDetailsConfiguration = PaymentSheetHelper().fromJSObjectToShippingDetails(call.getObject("shippingDetails", null)); + val billingDetailsCollectionConfiguration = PaymentSheetHelper().fromJSObjectToBillingCollectionConfig( + call.getObject("billingDetailsCollectionConfiguration", null) + ) + if (!enableGooglePay!!) { - paymentConfiguration = PaymentSheet.Configuration(merchantDisplayName, customer) + paymentConfiguration = PaymentSheet.Configuration( + merchantDisplayName, + customer, + shippingDetails = shippingDetailsConfiguration, + defaultBillingDetails = defaultBillingDetailsConfiguration, + billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration, + ) } else { val GooglePayEnvironment = call.getBoolean("GooglePayIsTesting", false) @@ -87,9 +100,13 @@ class PaymentFlowExecutor( paymentConfiguration = PaymentSheet.Configuration( merchantDisplayName, customer, - PaymentSheet.GooglePayConfiguration( + shippingDetails = shippingDetailsConfiguration, + defaultBillingDetails = defaultBillingDetailsConfiguration, + billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration, + googlePay = PaymentSheet.GooglePayConfiguration( environment, - call.getString("countryCode", "US")!! + call.getString("countryCode", "US")!!, + call.getString("currencyCode", null) ) ) } diff --git a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt index af30e7b1..1a2bbe2a 100644 --- a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt +++ b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt @@ -6,12 +6,14 @@ import androidx.core.util.Supplier import com.getcapacitor.Bridge import com.getcapacitor.JSObject import com.getcapacitor.PluginCall +import com.getcapacitor.community.stripe.helper.PaymentSheetHelper import com.getcapacitor.community.stripe.models.Executor import com.google.android.gms.common.util.BiConsumer import com.stripe.android.paymentsheet.PaymentSheet import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode import com.stripe.android.paymentsheet.PaymentSheetResult +import com.stripe.android.paymentsheet.addresselement.AddressDetails class PaymentSheetExecutor( contextSupplier: Supplier, @@ -77,62 +79,21 @@ class PaymentSheetExecutor( ) PaymentSheet.CustomerConfiguration(customerId, customerEphemeralKeySecret!!) else null - var billingDetailsCollectionConfiguration: PaymentSheet.BillingDetailsCollectionConfiguration? = null - val bdCollectionConfiguration = - call.getObject("billingDetailsCollectionConfiguration", null) - if (bdCollectionConfiguration != null) { - val emailCollectionMode = bdCollectionConfiguration.getString("email") - val nameCollectionMode = bdCollectionConfiguration.getString("name") - val phoneCollectionMode = bdCollectionConfiguration.getString("phone") - val addressCollectionMode = bdCollectionConfiguration.getString("address") - - val nameMode = when (nameCollectionMode) { - "always" -> CollectionMode.Always - "never" -> CollectionMode.Never - else -> CollectionMode.Automatic - } - - val phoneMode = when (phoneCollectionMode) { - "always" -> CollectionMode.Always - "never" -> CollectionMode.Never - else -> CollectionMode.Automatic - } - - val emailMode = when (emailCollectionMode) { - "always" -> CollectionMode.Always - "never" -> CollectionMode.Never - else -> CollectionMode.Automatic - } - val addressMode = when (addressCollectionMode) { - "full" -> AddressCollectionMode.Full - "never" -> AddressCollectionMode.Never - else -> AddressCollectionMode.Automatic - } - - billingDetailsCollectionConfiguration = - PaymentSheet.BillingDetailsCollectionConfiguration( - nameMode, - phoneMode, - emailMode, - addressMode, - attachDefaultsToPaymentMethod = false - ) - } + val defaultBillingDetailsConfiguration = PaymentSheetHelper().fromJSObjectToBillingDetails(call.getObject("defaultBillingDetails", null)) + val shippingDetailsConfiguration = PaymentSheetHelper().fromJSObjectToShippingDetails(call.getObject("shippingDetails", null)); + val billingDetailsCollectionConfiguration = PaymentSheetHelper().fromJSObjectToBillingCollectionConfig( + call.getObject("billingDetailsCollectionConfiguration", null) + ) if (!enableGooglePay!!) { - paymentConfiguration = if (bdCollectionConfiguration != null) { - PaymentSheet.Configuration( - merchantDisplayName, - customer, - billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration!! - ) - } else { - PaymentSheet.Configuration( - merchantDisplayName, - customer, - ) - } + paymentConfiguration = PaymentSheet.Configuration( + merchantDisplayName, + customer, + shippingDetails = shippingDetailsConfiguration, + defaultBillingDetails = defaultBillingDetailsConfiguration, + billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration + ) } else { val googlePayEnvironment = call.getBoolean("GooglePayIsTesting", false) @@ -143,28 +104,18 @@ class PaymentSheetExecutor( environment = PaymentSheet.GooglePayConfiguration.Environment.Test } - paymentConfiguration = if (bdCollectionConfiguration != null) { - PaymentSheet.Configuration( - merchantDisplayName, - customer, - billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration!!, - googlePay = PaymentSheet.GooglePayConfiguration( - environment, - call.getString("countryCode", "US")!!, - call.getString("currencyCode", null) - ), - ) - } else { - PaymentSheet.Configuration( - merchantDisplayName, - customer, - googlePay = PaymentSheet.GooglePayConfiguration( - environment, - call.getString("countryCode", "US")!!, - call.getString("currencyCode", null) - ), - ) - } + paymentConfiguration = PaymentSheet.Configuration( + merchantDisplayName, + customer, + shippingDetails = shippingDetailsConfiguration, + defaultBillingDetails = defaultBillingDetailsConfiguration, + billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration, + googlePay = PaymentSheet.GooglePayConfiguration( + environment, + call.getString("countryCode", "US")!!, + call.getString("currencyCode", null) + ), + ) } notifyListenersFunction.accept(PaymentSheetEvents.Loaded.webEventName, emptyObject) diff --git a/packages/payment/src/shared/index.ts b/packages/payment/src/shared/index.ts index 98908b29..03320d9b 100644 --- a/packages/payment/src/shared/index.ts +++ b/packages/payment/src/shared/index.ts @@ -42,6 +42,32 @@ export type AddressCollectionMode = 'automatic' | 'full' | 'never'; */ export type CollectionMode = 'automatic' | 'always' | 'never'; +interface Address { + /** + * Two-letter country code (ISO 3166-1 alpha-2). + */ + country?: string; + city?: string; + line1?: string; + line2?: string; + postalCode?: string; + state?: string; +} + +interface AddressDetails { + name?: string; + address?: Address; + phone?: string; + isCheckboxSelected?: boolean; +} + +interface DefaultBillingDetails { + email?: string; + name?: string; + phone?: string; + address?: Address; +} + interface BillingDetailsCollectionConfiguration { /** * Configuration for how billing details are collected during checkout. @@ -53,8 +79,21 @@ interface BillingDetailsCollectionConfiguration { } export interface BasePaymentOption { + /** + * Optional defaultBillingDetails + * https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details + */ + defaultBillingDetails?: DefaultBillingDetails; + + /** + * Optional shippingDetails + * https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses + */ + shippingDetails?: AddressDetails; + /** * Optional billingDetailsCollectionConfiguration + * https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection */ billingDetailsCollectionConfiguration?: BillingDetailsCollectionConfiguration; From 99ee5b57214a4c710eac139b913917d64866c0db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 18 Jun 2025 23:40:14 +0900 Subject: [PATCH 05/45] refactor(ios): add PaymentSheetHelper --- demo/angular/ios/App/Podfile.lock | 12 ++++---- .../PaymentFlow/PaymentFlowExecutor.swift | 19 ++++++++++++ .../PaymentSheet/PaymentSheetExecutor.swift | 29 +++---------------- .../StripePlugin/PaymentSheetHelper.swift | 25 ++++++++++++++++ 4 files changed, 54 insertions(+), 31 deletions(-) create mode 100644 packages/payment/ios/Sources/StripePlugin/PaymentSheetHelper.swift diff --git a/demo/angular/ios/App/Podfile.lock b/demo/angular/ios/App/Podfile.lock index 6ad5ad85..b73c74ec 100644 --- a/demo/angular/ios/App/Podfile.lock +++ b/demo/angular/ios/App/Podfile.lock @@ -1,14 +1,14 @@ PODS: - Capacitor (7.0.1): - CapacitorCordova - - CapacitorCommunityStripe (7.0.3): + - CapacitorCommunityStripe (7.1.2): - Capacitor - StripeApplePay (~> 24.12.1) - StripePaymentSheet (~> 24.12.1) - - CapacitorCommunityStripeIdentity (7.0.3): + - CapacitorCommunityStripeIdentity (7.1.2): - Capacitor - StripeIdentity (~> 24.12.1) - - CapacitorCommunityStripeTerminal (7.0.3): + - CapacitorCommunityStripeTerminal (7.1.2): - Capacitor - StripeTerminal (~> 4.3.0) - CapacitorCordova (7.0.1) @@ -72,9 +72,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Capacitor: de199cba6c8b20995428ad0b7cb0bc6ca625ffd4 - CapacitorCommunityStripe: 71b0af35d137fb931d2589535795dea1d71e4b98 - CapacitorCommunityStripeIdentity: 9d5d9b063ecbad96ac8e75aafa614af5365813e6 - CapacitorCommunityStripeTerminal: ed4bb76bd81fa4a9d78e0ff83ceff8973c86939c + CapacitorCommunityStripe: 5d3431d36c4ca3aeb6a1afe6a1eba8edcf5025bd + CapacitorCommunityStripeIdentity: 646ac7c75d25c9ca1f804e02c327b240d304a4c6 + CapacitorCommunityStripeTerminal: 2b54bcf6e5a0d2e6955073b9bdb1140abd1dd059 CapacitorCordova: 63d476958d5022d76f197031e8b7ea3519988c64 StripeApplePay: 3caeb241c08f79b5f11024a96409317b50347e71 StripeCameraCore: 72e4e03df07aaa942de761104818850e2c5d85e1 diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift index 0df3609d..d0b6bf6a 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift @@ -61,6 +61,25 @@ class PaymentFlowExecutor: NSObject { if customerId != nil && customerEphemeralKeySecret != nil { configuration.customer = .init(id: customerId!, ephemeralKeySecret: customerEphemeralKeySecret!) } + + let billingDetailsCollectionConfiguration = call.getObject("billingDetailsCollectionConfiguration") ?? nil + if billingDetailsCollectionConfiguration != nil { + billingDetailsCollectionConfiguration?.forEach({ (key: String, value: JSValue) in + let val: String = value as? String ?? "automatic" + switch key { + case "email": + configuration.billingDetailsCollectionConfiguration.email = PaymentSheetHelper().getCollectionModeValue(mode: val) + case "name": + configuration.billingDetailsCollectionConfiguration.name = PaymentSheetHelper().getCollectionModeValue(mode: val) + case "phone": + configuration.billingDetailsCollectionConfiguration.phone = PaymentSheetHelper().getCollectionModeValue(mode: val) + case "address": + configuration.billingDetailsCollectionConfiguration.address = PaymentSheetHelper().getAddressCollectionModeValue(mode: val) + default: + return + } + }) + } if setupIntentClientSecret != nil { PaymentSheet.FlowController.create(setupIntentClientSecret: setupIntentClientSecret!, diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift index c0919d2a..02228768 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift @@ -68,13 +68,13 @@ class PaymentSheetExecutor: NSObject { let val: String = value as? String ?? "automatic" switch key { case "email": - configuration.billingDetailsCollectionConfiguration.email = getCollectionModeValue(mode: val) + configuration.billingDetailsCollectionConfiguration.email = PaymentSheetHelper().getCollectionModeValue(mode: val) case "name": - configuration.billingDetailsCollectionConfiguration.name = getCollectionModeValue(mode: val) + configuration.billingDetailsCollectionConfiguration.name = PaymentSheetHelper().getCollectionModeValue(mode: val) case "phone": - configuration.billingDetailsCollectionConfiguration.phone = getCollectionModeValue(mode: val) + configuration.billingDetailsCollectionConfiguration.phone = PaymentSheetHelper().getCollectionModeValue(mode: val) case "address": - configuration.billingDetailsCollectionConfiguration.address = getAddressCollectionModeValue(mode: val) + configuration.billingDetailsCollectionConfiguration.address = PaymentSheetHelper().getAddressCollectionModeValue(mode: val) default: return } @@ -112,25 +112,4 @@ class PaymentSheetExecutor: NSObject { } } - func getCollectionModeValue(mode: String) -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode { - switch mode { - case "always": - return .always - case "never": - return .never - default: - return .automatic - } - } - - func getAddressCollectionModeValue(mode: String) -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode { - switch mode { - case "full": - return .full - case "never": - return .never - default: - return .automatic - } - } } diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentSheetHelper.swift b/packages/payment/ios/Sources/StripePlugin/PaymentSheetHelper.swift new file mode 100644 index 00000000..98be5c0c --- /dev/null +++ b/packages/payment/ios/Sources/StripePlugin/PaymentSheetHelper.swift @@ -0,0 +1,25 @@ +import StripePaymentSheet + +class PaymentSheetHelper { + func getCollectionModeValue(mode: String) -> PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode { + switch mode { + case "always": + return .always + case "never": + return .never + default: + return .automatic + } + } + + func getAddressCollectionModeValue(mode: String) -> PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode { + switch mode { + case "full": + return .full + case "never": + return .never + default: + return .automatic + } + } +} From bd05dc7e867695fafe6d968c1319ebf8a70ca226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 00:11:10 +0900 Subject: [PATCH 06/45] chore(): run docgen --- packages/payment/README.md | 104 +++++++++++++++++++++++++------------ 1 file changed, 70 insertions(+), 34 deletions(-) diff --git a/packages/payment/README.md b/packages/payment/README.md index b76c6b19..a100a657 100644 --- a/packages/payment/README.md +++ b/packages/payment/README.md @@ -683,23 +683,57 @@ addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: stri #### CreatePaymentFlowOption -| Prop | Type | Description | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ----------------------- | -| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration | | -| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | -| **`customerId`** | string | Any documentation call 'customer' | | -| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | -| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | -| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | -| **`GooglePayIsTesting`** | boolean | | false, | -| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | -| **`merchantDisplayName`** | string | | "App Name" | -| **`returnURL`** | string | | "" | -| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | -| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | -| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | +| Prop | Type | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | +| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | +| **`shippingDetails`** | AddressDetails | Optional shippingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | +| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | +| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | +| **`customerId`** | string | Any documentation call 'customer' | | +| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | +| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | +| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | +| **`GooglePayIsTesting`** | boolean | | false, | +| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | +| **`merchantDisplayName`** | string | | "App Name" | +| **`returnURL`** | string | | "" | +| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | +| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | +| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | + + +#### DefaultBillingDetails + +| Prop | Type | +| ------------- | ------------------------------------------- | +| **`email`** | string | +| **`name`** | string | +| **`phone`** | string | +| **`address`** | Address | + + +#### Address + +| Prop | Type | Description | +| ---------------- | ------------------- | --------------------------------------------- | +| **`country`** | string | Two-letter country code (ISO 3166-1 alpha-2). | +| **`city`** | string | | +| **`line1`** | string | | +| **`line2`** | string | | +| **`postalCode`** | string | | +| **`state`** | string | | + + +#### AddressDetails + +| Prop | Type | +| ------------------------ | ------------------------------------------- | +| **`name`** | string | +| **`address`** | Address | +| **`phone`** | string | +| **`isCheckboxSelected`** | boolean | #### BillingDetailsCollectionConfiguration @@ -714,23 +748,25 @@ addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: stri #### CreatePaymentSheetOption -| Prop | Type | Description | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | ----------------------- | -| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration | | -| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | -| **`customerId`** | string | Any documentation call 'customer' | | -| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | -| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | -| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | -| **`GooglePayIsTesting`** | boolean | | false, | -| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | -| **`merchantDisplayName`** | string | | "App Name" | -| **`returnURL`** | string | | "" | -| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | -| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | -| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | +| Prop | Type | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | +| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | +| **`shippingDetails`** | AddressDetails | Optional shippingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | +| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | +| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | +| **`customerId`** | string | Any documentation call 'customer' | | +| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | +| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | +| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | +| **`GooglePayIsTesting`** | boolean | | false, | +| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | +| **`merchantDisplayName`** | string | | "App Name" | +| **`returnURL`** | string | | "" | +| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | +| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | +| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | ### Type Aliases From 4d863e76813834b7ea5aabdeff3cce7b5abac9df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 00:44:19 +0900 Subject: [PATCH 07/45] chore(ios): add defaultBillingDetails for payment sheet --- .../PaymentFlow/PaymentFlowExecutor.swift | 27 +++++++++++++++++++ .../PaymentSheet/PaymentSheetExecutor.swift | 27 +++++++++++++++++++ 2 files changed, 54 insertions(+) diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift index d0b6bf6a..0222641c 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift @@ -80,6 +80,33 @@ class PaymentFlowExecutor: NSObject { } }) } + + let defaultBillingDetails = call.getObject("defaultBillingDetails") ?? nil + if defaultBillingDetails != nil { + defaultBillingDetails?.forEach({ (key: String, value: JSValue) in + switch key { + case "email": + configuration.defaultBillingDetails.email = value as? String + case "name": + configuration.defaultBillingDetails.name = value as? String + case "phone": + configuration.defaultBillingDetails.phone = value as? String + case "address": + let val = value as? JSObject + let address = PaymentSheet.Address( + city: val?["city"] as? String, + country: val?["country"] as? String, + line1: val?["line1"] as? String, + line2: val?["line2"] as? String, + postalCode: val?["postalCode"] as? String, + state: val?["state"] as? String, + ) + configuration.defaultBillingDetails.address = address + default: + return + } + }) + } if setupIntentClientSecret != nil { PaymentSheet.FlowController.create(setupIntentClientSecret: setupIntentClientSecret!, diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift index 02228768..7aff4f6d 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift @@ -80,6 +80,33 @@ class PaymentSheetExecutor: NSObject { } }) } + + let defaultBillingDetails = call.getObject("defaultBillingDetails") ?? nil + if defaultBillingDetails != nil { + defaultBillingDetails?.forEach({ (key: String, value: JSValue) in + switch key { + case "email": + configuration.defaultBillingDetails.email = value as? String + case "name": + configuration.defaultBillingDetails.name = value as? String + case "phone": + configuration.defaultBillingDetails.phone = value as? String + case "address": + let val = value as? JSObject + let address = PaymentSheet.Address( + city: val?["city"] as? String, + country: val?["country"] as? String, + line1: val?["line1"] as? String, + line2: val?["line2"] as? String, + postalCode: val?["postalCode"] as? String, + state: val?["state"] as? String, + ) + configuration.defaultBillingDetails.address = address + default: + return + } + }) + } if setupIntentClientSecret != nil { self.paymentSheet = PaymentSheet(setupIntentClientSecret: setupIntentClientSecret!, configuration: configuration) From a404f989cff3f0e61bf14cdaf4d53eb9a8f4ab3d Mon Sep 17 00:00:00 2001 From: Masahiko Sakakibara Date: Thu, 19 Jun 2025 08:43:14 +0900 Subject: [PATCH 08/45] Update packages/payment/src/shared/index.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/payment/src/shared/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/payment/src/shared/index.ts b/packages/payment/src/shared/index.ts index 03320d9b..c97bc715 100644 --- a/packages/payment/src/shared/index.ts +++ b/packages/payment/src/shared/index.ts @@ -42,7 +42,7 @@ export type AddressCollectionMode = 'automatic' | 'full' | 'never'; */ export type CollectionMode = 'automatic' | 'always' | 'never'; -interface Address { +export interface Address { /** * Two-letter country code (ISO 3166-1 alpha-2). */ From af874a1276168b33fe93bb758f5839dde1c2b1ff Mon Sep 17 00:00:00 2001 From: Masahiko Sakakibara Date: Thu, 19 Jun 2025 08:43:23 +0900 Subject: [PATCH 09/45] Update packages/payment/src/shared/index.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/payment/src/shared/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/payment/src/shared/index.ts b/packages/payment/src/shared/index.ts index c97bc715..4a82f65c 100644 --- a/packages/payment/src/shared/index.ts +++ b/packages/payment/src/shared/index.ts @@ -54,7 +54,7 @@ export interface Address { state?: string; } -interface AddressDetails { +export interface AddressDetails { name?: string; address?: Address; phone?: string; From d04a7bf4544eeb6774f6915afe755e0118301326 Mon Sep 17 00:00:00 2001 From: Masahiko Sakakibara Date: Thu, 19 Jun 2025 08:43:31 +0900 Subject: [PATCH 10/45] Update packages/payment/src/shared/index.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/payment/src/shared/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/payment/src/shared/index.ts b/packages/payment/src/shared/index.ts index 4a82f65c..b313e44d 100644 --- a/packages/payment/src/shared/index.ts +++ b/packages/payment/src/shared/index.ts @@ -61,7 +61,7 @@ export interface AddressDetails { isCheckboxSelected?: boolean; } -interface DefaultBillingDetails { +export interface DefaultBillingDetails { email?: string; name?: string; phone?: string; From 6f86739483d428fd944156bb6c6fbfd972424046 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 16:24:03 +0900 Subject: [PATCH 11/45] fix(ios): fix address type --- .../PaymentFlow/PaymentFlowExecutor.swift | 33 +++++++++++-------- .../PaymentSheet/PaymentSheetExecutor.swift | 33 +++++++++++-------- 2 files changed, 40 insertions(+), 26 deletions(-) diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift index 0222641c..b3e93ef3 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift @@ -86,22 +86,29 @@ class PaymentFlowExecutor: NSObject { defaultBillingDetails?.forEach({ (key: String, value: JSValue) in switch key { case "email": - configuration.defaultBillingDetails.email = value as? String + if let val = value as? String { + configuration.defaultBillingDetails.email = val + } case "name": - configuration.defaultBillingDetails.name = value as? String + if let val = value as? String { + configuration.defaultBillingDetails.name = val + } case "phone": - configuration.defaultBillingDetails.phone = value as? String + if let val = value as? String { + configuration.defaultBillingDetails.phone = val + } case "address": - let val = value as? JSObject - let address = PaymentSheet.Address( - city: val?["city"] as? String, - country: val?["country"] as? String, - line1: val?["line1"] as? String, - line2: val?["line2"] as? String, - postalCode: val?["postalCode"] as? String, - state: val?["state"] as? String, - ) - configuration.defaultBillingDetails.address = address + if let val = value as? JSObject { + let address = PaymentSheet.Address( + city: val["city"] as? String, + country: val["country"] as? String, + line1: val["line1"] as? String, + line2: val["line2"] as? String, + postalCode: val["postalCode"] as? String, + state: val["state"] as? String + ) + configuration.defaultBillingDetails.address = address + } default: return } diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift index 7aff4f6d..6da6fb9f 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift @@ -86,22 +86,29 @@ class PaymentSheetExecutor: NSObject { defaultBillingDetails?.forEach({ (key: String, value: JSValue) in switch key { case "email": - configuration.defaultBillingDetails.email = value as? String + if let val = value as? String { + configuration.defaultBillingDetails.email = val + } case "name": - configuration.defaultBillingDetails.name = value as? String + if let val = value as? String { + configuration.defaultBillingDetails.name = val + } case "phone": - configuration.defaultBillingDetails.phone = value as? String + if let val = value as? String { + configuration.defaultBillingDetails.phone = val + } case "address": - let val = value as? JSObject - let address = PaymentSheet.Address( - city: val?["city"] as? String, - country: val?["country"] as? String, - line1: val?["line1"] as? String, - line2: val?["line2"] as? String, - postalCode: val?["postalCode"] as? String, - state: val?["state"] as? String, - ) - configuration.defaultBillingDetails.address = address + if let val = value as? JSObject { + let address = PaymentSheet.Address( + city: val["city"] as? String, + country: val["country"] as? String, + line1: val["line1"] as? String, + line2: val["line2"] as? String, + postalCode: val["postalCode"] as? String, + state: val["state"] as? String + ) + configuration.defaultBillingDetails.address = address + } default: return } From fcb8d73a823a9f3c681b5d5f5559f909781b8552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 17:16:52 +0900 Subject: [PATCH 12/45] feat(payment): add billingDetailsCollectionConfiguration demo --- .../app/src/main/assets/capacitor.config.json | 3 +- .../angular/ios/App/App/capacitor.config.json | 1 - demo/angular/src/app/demo/demo.page.ts | 20 +++++ packages/payment/README.md | 76 +++++++++---------- packages/payment/src/shared/index.ts | 3 + 5 files changed, 62 insertions(+), 41 deletions(-) diff --git a/demo/angular/android/app/src/main/assets/capacitor.config.json b/demo/angular/android/app/src/main/assets/capacitor.config.json index 134a984c..824c6aeb 100644 --- a/demo/angular/android/app/src/main/assets/capacitor.config.json +++ b/demo/angular/android/app/src/main/assets/capacitor.config.json @@ -1,6 +1,5 @@ { "appId": "io.ionic.starter", "appName": "capacitor-stripe", - "webDir": "www/browser", - "bundledWebRuntime": false + "webDir": "www/browser" } diff --git a/demo/angular/ios/App/App/capacitor.config.json b/demo/angular/ios/App/App/capacitor.config.json index 951b875a..7a14ecd1 100644 --- a/demo/angular/ios/App/App/capacitor.config.json +++ b/demo/angular/ios/App/App/capacitor.config.json @@ -2,7 +2,6 @@ "appId": "io.ionic.starter", "appName": "capacitor-stripe", "webDir": "www/browser", - "bundledWebRuntime": false, "packageClassList": [ "StripePlugin", "StripeIdentityPlugin", diff --git a/demo/angular/src/app/demo/demo.page.ts b/demo/angular/src/app/demo/demo.page.ts index 9cfc5e33..d59b0bf6 100644 --- a/demo/angular/src/app/demo/demo.page.ts +++ b/demo/angular/src/app/demo/demo.page.ts @@ -1,5 +1,6 @@ import { Component, OnInit } from '@angular/core'; import { + Address, ApplePayEventsEnum, CreatePaymentSheetOption, GooglePayEventsEnum, @@ -192,6 +193,25 @@ export class DemoPage implements OnInit { customerEphemeralKeySecret: ephemeralKey, customerId: customer, merchantDisplayName: 'rdlabo', + billingDetailsCollectionConfiguration: { + email: 'always', + name: 'always', + phone: 'always', + address: 'full', + }, + defaultBillingDetails: { + email: 'info@example.com', + name: 'Masahiko Sakakibara', + phone: '+15551234567', + address: { + city: 'San Francisco', + country: 'US', + line1: '123 Market St', + line2: '', + postalCode: '94107', + state: 'CA', + } + } }); } else { const { paymentIntent } = await firstValueFrom( diff --git a/packages/payment/README.md b/packages/payment/README.md index a100a657..eefe339e 100644 --- a/packages/payment/README.md +++ b/packages/payment/README.md @@ -683,25 +683,25 @@ addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: stri #### CreatePaymentFlowOption -| Prop | Type | Description | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | -| **`shippingDetails`** | AddressDetails | Optional shippingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | -| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | -| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | -| **`customerId`** | string | Any documentation call 'customer' | | -| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | -| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | -| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | -| **`GooglePayIsTesting`** | boolean | | false, | -| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | -| **`merchantDisplayName`** | string | | "App Name" | -| **`returnURL`** | string | | "" | -| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | -| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | -| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | +| Prop | Type | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | +| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | +| **`shippingDetails`** | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | +| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | +| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | +| **`customerId`** | string | Any documentation call 'customer' | | +| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | +| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | +| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | +| **`GooglePayIsTesting`** | boolean | | false, | +| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | +| **`merchantDisplayName`** | string | | "App Name" | +| **`returnURL`** | string | | "" | +| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | +| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | +| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | #### DefaultBillingDetails @@ -748,25 +748,25 @@ addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: stri #### CreatePaymentSheetOption -| Prop | Type | Description | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | -| **`shippingDetails`** | AddressDetails | Optional shippingDetails https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | -| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | -| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | -| **`customerId`** | string | Any documentation call 'customer' | | -| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | -| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | -| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | -| **`GooglePayIsTesting`** | boolean | | false, | -| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | -| **`merchantDisplayName`** | string | | "App Name" | -| **`returnURL`** | string | | "" | -| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | -| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | -| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | +| Prop | Type | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | +| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | +| **`shippingDetails`** | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | +| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | +| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | +| **`customerId`** | string | Any documentation call 'customer' | | +| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | +| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | +| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | +| **`GooglePayIsTesting`** | boolean | | false, | +| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | +| **`merchantDisplayName`** | string | | "App Name" | +| **`returnURL`** | string | | "" | +| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | +| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | +| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | ### Type Aliases diff --git a/packages/payment/src/shared/index.ts b/packages/payment/src/shared/index.ts index b313e44d..d99c2d9e 100644 --- a/packages/payment/src/shared/index.ts +++ b/packages/payment/src/shared/index.ts @@ -81,18 +81,21 @@ interface BillingDetailsCollectionConfiguration { export interface BasePaymentOption { /** * Optional defaultBillingDetails + * This is ios/android only. not support web. * https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details */ defaultBillingDetails?: DefaultBillingDetails; /** * Optional shippingDetails + * This is android only. ios requires an address element. * https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses */ shippingDetails?: AddressDetails; /** * Optional billingDetailsCollectionConfiguration + * This is ios/android only. not support web. * https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection */ billingDetailsCollectionConfiguration?: BillingDetailsCollectionConfiguration; From 37e94d006fd042101a0f6141c351d3dfa814200f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 18:18:49 +0900 Subject: [PATCH 13/45] feat(identity): deprecated present result, and suggest to use listener. --- packages/identity/README.md | 59 +++++++++++++---- .../IdentityVerificationSheetEvent.kt | 1 + .../stripe/identity/StripeIdentity.kt | 66 ++++++++++++++----- .../stripe/identity/StripeIdentityPlugin.kt | 3 +- .../IdentityVerificationSheetEvents.swift | 1 + .../StripeIdentityPlugin/StripeIdentity.swift | 15 +++++ packages/identity/src/definitions.ts | 55 +++++++++++++++- packages/identity/src/events.enum.ts | 1 + packages/identity/src/web.ts | 22 +++++-- 9 files changed, 184 insertions(+), 39 deletions(-) diff --git a/packages/identity/README.md b/packages/identity/README.md index 8d48a729..f82c8a67 100644 --- a/packages/identity/README.md +++ b/packages/identity/README.md @@ -33,18 +33,22 @@ If you want to implement, we recommend to read https://stripe.com/docs/identity ```ts import { StripeIdentity } from '@capacitor-community/stripe-identity'; +const listener = await StripeIdentity.addListener(IdentityVerificationSheetEventsEnum.VerificationResult, (result) => { + console.log(result); + listener.remove(); +}); + // initialize is needed only for Web Platform await StripeIdentity.initialize({ publishableKey, }); - await StripeIdentity.create({ ephemeralKeySecret, verificationId, // clientSecret is needed only for Web Platform clientSecret }); -const result = await StripeIdentity.present(); +await StripeIdentity.present(); ``` ## API @@ -56,6 +60,7 @@ const result = await StripeIdentity.present(); * [`present()`](#present) * [`addListener(IdentityVerificationSheetEventsEnum.Loaded, ...)`](#addlisteneridentityverificationsheeteventsenumloaded-) * [`addListener(IdentityVerificationSheetEventsEnum.FailedToLoad, ...)`](#addlisteneridentityverificationsheeteventsenumfailedtoload-) +* [`addListener(IdentityVerificationSheetEventsEnum.VerificationResult, ...)`](#addlisteneridentityverificationsheeteventsenumverificationresult-) * [`addListener(IdentityVerificationSheetEventsEnum.Completed, ...)`](#addlisteneridentityverificationsheeteventsenumcompleted-) * [`addListener(IdentityVerificationSheetEventsEnum.Canceled, ...)`](#addlisteneridentityverificationsheeteventsenumcanceled-) * [`addListener(IdentityVerificationSheetEventsEnum.Failed, ...)`](#addlisteneridentityverificationsheeteventsenumfailed-) @@ -97,10 +102,10 @@ create(options: CreateIdentityVerificationSheetOption) => Promise ### present() ```typescript -present() => Promise<{ identityVerificationResult: IdentityVerificationSheetResultInterface; }> +present() => Promise ``` -**Returns:** Promise<{ identityVerificationResult: IdentityVerificationSheetResultInterface; }> +**Returns:** Promise<deprecatedIdentityVerificationResult> -------------------- @@ -137,6 +142,22 @@ addListener(eventName: IdentityVerificationSheetEventsEnum.FailedToLoad, listene -------------------- +### addListener(IdentityVerificationSheetEventsEnum.VerificationResult, ...) + +```typescript +addListener(eventName: IdentityVerificationSheetEventsEnum.VerificationResult, listenerFunc: (result: IdentityVerificationResult) => void) => Promise +``` + +| Param | Type | +| ------------------ | ---------------------------------------------------------------------------------------------------------------------- | +| **`eventName`** | IdentityVerificationSheetEventsEnum.VerificationResult | +| **`listenerFunc`** | (result: IdentityVerificationResult) => void | + +**Returns:** Promise<PluginListenerHandle> + +-------------------- + + ### addListener(IdentityVerificationSheetEventsEnum.Completed, ...) ```typescript @@ -204,6 +225,13 @@ addListener(eventName: IdentityVerificationSheetEventsEnum.Failed, listenerFunc: | **`clientSecret`** | string | This client secret is used only for the web platform. | +#### deprecatedIdentityVerificationResult + +| Prop | Type | +| -------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| **`identityVerificationResult`** | IdentityVerificationSheetResultInterface | + + #### PluginListenerHandle | Prop | Type | @@ -218,6 +246,14 @@ addListener(eventName: IdentityVerificationSheetEventsEnum.Failed, listenerFunc: | **`message`** | string | +#### IdentityVerificationResult + +| Prop | Type | +| ------------ | ------------------------------------------------------------------------------------------------------------- | +| **`result`** | IdentityVerificationSheetResultInterface | +| **`error`** | StripeIdentityError | + + ### Type Aliases @@ -231,12 +267,13 @@ addListener(eventName: IdentityVerificationSheetEventsEnum.Failed, listenerFunc: #### IdentityVerificationSheetEventsEnum -| Members | Value | -| ------------------ | ---------------------------------------------------- | -| **`Loaded`** | 'identityVerificationSheetLoaded' | -| **`FailedToLoad`** | 'identityVerificationSheetFailedToLoad' | -| **`Completed`** | 'identityVerificationSheetCompleted' | -| **`Canceled`** | 'identityVerificationSheetCanceled' | -| **`Failed`** | 'identityVerificationSheetFailed' | +| Members | Value | +| ------------------------ | ---------------------------------------------------- | +| **`Loaded`** | 'identityVerificationSheetLoaded' | +| **`FailedToLoad`** | 'identityVerificationSheetFailedToLoad' | +| **`Completed`** | 'identityVerificationSheetCompleted' | +| **`Canceled`** | 'identityVerificationSheetCanceled' | +| **`Failed`** | 'identityVerificationSheetFailed' | +| **`VerificationResult`** | 'identityVerificationResult' | diff --git a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/IdentityVerificationSheetEvent.kt b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/IdentityVerificationSheetEvent.kt index 16d00412..7c8a9516 100644 --- a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/IdentityVerificationSheetEvent.kt +++ b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/IdentityVerificationSheetEvent.kt @@ -7,4 +7,5 @@ enum class IdentityVerificationSheetEvent(val webEventName: String) { Completed("identityVerificationSheetCompleted"), Canceled("identityVerificationSheetCanceled"), Failed("identityVerificationSheetFailed"), + VerificationResult("identityVerificationResult"), } diff --git a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt index 16857b41..9139aa0a 100644 --- a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt +++ b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentity.kt @@ -69,38 +69,70 @@ class StripeIdentity( } fun onVerificationCompleted(bridge: Bridge, callbackId: String?) { - val call = bridge.getSavedCall(callbackId) - notifyListeners(IdentityVerificationSheetEvent.Completed.webEventName, emptyObject) - call.resolve( + notifyListeners(IdentityVerificationSheetEvent.VerificationResult.webEventName, JSObject().put( - "identityVerificationResult", + "result", IdentityVerificationSheetEvent.Completed.webEventName ) ) - bridge.releaseCall(callbackId) + + val call = bridge.getSavedCall(callbackId) + notifyListeners(IdentityVerificationSheetEvent.Completed.webEventName, emptyObject) + if (call !== null) { + call.resolve( + JSObject().put( + "identityVerificationResult", + IdentityVerificationSheetEvent.Completed.webEventName + ) + ) + bridge.releaseCall(callbackId) + } } fun onVerificationCancelled(bridge: Bridge, callbackId: String?) { - val call = bridge.getSavedCall(callbackId) - notifyListeners(IdentityVerificationSheetEvent.Canceled.webEventName, emptyObject) - call.resolve( + notifyListeners(IdentityVerificationSheetEvent.VerificationResult.webEventName, JSObject().put( - "identityVerificationResult", + "result", IdentityVerificationSheetEvent.Canceled.webEventName ) ) - bridge.releaseCall(callbackId) + + val call = bridge.getSavedCall(callbackId) + notifyListeners(IdentityVerificationSheetEvent.Canceled.webEventName, emptyObject) + if (call !== null) { + call.resolve( + JSObject().put( + "identityVerificationResult", + IdentityVerificationSheetEvent.Canceled.webEventName + ) + ) + bridge.releaseCall(callbackId) + } } - fun onVerificationFailed(bridge: Bridge, callbackId: String?) { + fun onVerificationFailed(bridge: Bridge, errorMessage: String?, callbackId: String?) { + notifyListeners(IdentityVerificationSheetEvent.VerificationResult.webEventName, + JSObject() + .put( + "result", + IdentityVerificationSheetEvent.Failed.webEventName + ) + .put( + "error", + JSObject().put("message", errorMessage) + ) + ) + val call = bridge.getSavedCall(callbackId) notifyListeners(IdentityVerificationSheetEvent.Failed.webEventName, emptyObject) - call.resolve( - JSObject().put( - "identityVerificationResult", - IdentityVerificationSheetEvent.Failed.webEventName + if (call !== null) { + call.resolve( + JSObject().put( + "identityVerificationResult", + IdentityVerificationSheetEvent.Failed.webEventName + ) ) - ) - bridge.releaseCall(callbackId) + bridge.releaseCall(callbackId) + } } } diff --git a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt index 75992af1..9a2cc06c 100644 --- a/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt +++ b/packages/identity/android/src/main/java/com/getcapacitor/community/stripe/identity/StripeIdentityPlugin.kt @@ -48,7 +48,8 @@ class StripeIdentityPlugin : Plugin() { } else if (verificationFlowResult is VerificationFlowResult.Failed) { // If the flow fails, you should display the localized error // message to your user using throwable.getLocalizedMessage() - implementation.onVerificationFailed(bridge, identityVerificationCallbackId) + val errorMessage = verificationFlowResult.throwable.localizedMessage; + implementation.onVerificationFailed(bridge, errorMessage, identityVerificationCallbackId) } } } diff --git a/packages/identity/ios/Sources/StripeIdentityPlugin/IdentityVerificationSheetEvents.swift b/packages/identity/ios/Sources/StripeIdentityPlugin/IdentityVerificationSheetEvents.swift index 157550eb..c47eaa64 100644 --- a/packages/identity/ios/Sources/StripeIdentityPlugin/IdentityVerificationSheetEvents.swift +++ b/packages/identity/ios/Sources/StripeIdentityPlugin/IdentityVerificationSheetEvents.swift @@ -4,4 +4,5 @@ public enum IdentityVerificationSheetEvents: String { case Completed = "identityVerificationSheetCompleted" case Canceled = "identityVerificationSheetCanceled" case Failed = "identityVerificationSheetFailed" + case VerificationResult = "identityVerificationResult" } diff --git a/packages/identity/ios/Sources/StripeIdentityPlugin/StripeIdentity.swift b/packages/identity/ios/Sources/StripeIdentityPlugin/StripeIdentity.swift index a3726503..3f9cdb07 100644 --- a/packages/identity/ios/Sources/StripeIdentityPlugin/StripeIdentity.swift +++ b/packages/identity/ios/Sources/StripeIdentityPlugin/StripeIdentity.swift @@ -54,12 +54,20 @@ import StripeIdentity // The user has completed uploading their documents. // Let them know that the verification is processing. print("Verification Flow Completed!") + self.plugin?.notifyListeners(IdentityVerificationSheetEvents.VerificationResult.rawValue, data: [ + "result": IdentityVerificationSheetEvents.Completed.rawValue + ]) + self.plugin?.notifyListeners(IdentityVerificationSheetEvents.Completed.rawValue, data: [:]) call.resolve(["identityVerificationResult": IdentityVerificationSheetEvents.Completed.rawValue]) case .flowCanceled: // The user did not complete uploading their documents. // You should allow them to try again. print("Verification Flow Canceled!") + self.plugin?.notifyListeners(IdentityVerificationSheetEvents.VerificationResult.rawValue, data: [ + "result": IdentityVerificationSheetEvents.Canceled.rawValue + ]) + self.plugin?.notifyListeners(IdentityVerificationSheetEvents.Canceled.rawValue, data: [:]) call.resolve(["identityVerificationResult": IdentityVerificationSheetEvents.Canceled.rawValue]) case .flowFailed(let error): @@ -67,6 +75,13 @@ import StripeIdentity // message to your user using error.localizedDescription print("Verification Flow Failed!") print(error.localizedDescription) + self.plugin?.notifyListeners(IdentityVerificationSheetEvents.VerificationResult.rawValue, data: [ + "result": IdentityVerificationSheetEvents.Failed.rawValue, + "error": [ + "message": error.localizedDescription + ] + ]) + self.plugin?.notifyListeners(IdentityVerificationSheetEvents.Failed.rawValue, data: ["message": error.localizedDescription]) call.resolve(["identityVerificationResult": IdentityVerificationSheetEvents.Failed.rawValue]) } diff --git a/packages/identity/src/definitions.ts b/packages/identity/src/definitions.ts index 63445201..11507486 100644 --- a/packages/identity/src/definitions.ts +++ b/packages/identity/src/definitions.ts @@ -5,14 +5,34 @@ import type { CreateIdentityVerificationSheetOption, InitializeIdentityVerificat export * from './events.enum'; export interface StripeIdentityError { + code?: string; message: string; } + +/** + * @deprecated + * `identityVerificationResult` is deprecated and will be removed in the next major version (v8). + * + * + * This property relies on a PluginCall that cannot be persisted reliably across Android lifecycle events. + * Due to limitations in the Capacitor plugin system, the saved call is lost when the activity is destroyed + * (e.g., due to backgrounding, rotation, or process death). + * To avoid inconsistent behavior and potential crashes, please migrate to a stateless design where any necessary data + * is persisted explicitly and reprocessed on app resume or reload. + */ +export interface deprecatedIdentityVerificationResult { + identityVerificationResult: IdentityVerificationSheetResultInterface; +} + +export interface IdentityVerificationResult { + result: IdentityVerificationSheetResultInterface; + error?: StripeIdentityError; +} + export interface StripeIdentityPlugin { initialize(options: InitializeIdentityVerificationSheetOption): Promise; create(options: CreateIdentityVerificationSheetOption): Promise; - present(): Promise<{ - identityVerificationResult: IdentityVerificationSheetResultInterface; - }>; + present(): Promise; addListener( eventName: IdentityVerificationSheetEventsEnum.Loaded, @@ -24,16 +44,45 @@ export interface StripeIdentityPlugin { listenerFunc: (info: StripeIdentityError) => void, ): Promise; + addListener( + eventName: IdentityVerificationSheetEventsEnum.VerificationResult, + listenerFunc: (result: IdentityVerificationResult) => void, + ): Promise; + + /** + * @deprecated + * Listening to verification results via `present()` is deprecated. + * + * Please use `addListener(IdentityVerificationSheetEventsEnum.VerificationResult, listener)` instead. + * This new event-based approach provides better reliability across app lifecycle events such as backgrounding, + * rotation, and process restarts. + */ addListener( eventName: IdentityVerificationSheetEventsEnum.Completed, listenerFunc: () => void, ): Promise; + /** + * @deprecated + * Listening to verification results via `present()` is deprecated. + * + * Please use `addListener(IdentityVerificationSheetEventsEnum.VerificationResult, listener)` instead. + * This new event-based approach provides better reliability across app lifecycle events such as backgrounding, + * rotation, and process restarts. + */ addListener( eventName: IdentityVerificationSheetEventsEnum.Canceled, listenerFunc: () => void, ): Promise; + /** + * @deprecated + * Listening to verification results via `present()` is deprecated. + * + * Please use `addListener(IdentityVerificationSheetEventsEnum.VerificationResult, listener)` instead. + * This new event-based approach provides better reliability across app lifecycle events such as backgrounding, + * rotation, and process restarts. + */ addListener( eventName: IdentityVerificationSheetEventsEnum.Failed, listenerFunc: (info: StripeIdentityError) => void, diff --git a/packages/identity/src/events.enum.ts b/packages/identity/src/events.enum.ts index e14da92f..7d8cc73f 100644 --- a/packages/identity/src/events.enum.ts +++ b/packages/identity/src/events.enum.ts @@ -4,6 +4,7 @@ export enum IdentityVerificationSheetEventsEnum { Completed = 'identityVerificationSheetCompleted', Canceled = 'identityVerificationSheetCanceled', Failed = 'identityVerificationSheetFailed', + VerificationResult = 'identityVerificationResult' } export type IdentityVerificationSheetResultInterface = diff --git a/packages/identity/src/web.ts b/packages/identity/src/web.ts index 3564d586..ed22ee37 100644 --- a/packages/identity/src/web.ts +++ b/packages/identity/src/web.ts @@ -2,9 +2,8 @@ import { WebPlugin } from '@capacitor/core'; import type { Stripe } from '@stripe/stripe-js'; import { loadStripe } from '@stripe/stripe-js'; -import type { StripeIdentityPlugin } from './definitions'; +import type { deprecatedIdentityVerificationResult, StripeIdentityPlugin } from './definitions'; import { IdentityVerificationSheetEventsEnum } from './definitions'; -import type { IdentityVerificationSheetResultInterface } from './events.enum'; export interface InitializeIdentityVerificationSheetOption { publishableKey: string; @@ -30,9 +29,7 @@ export class StripeIdentityWeb extends WebPlugin implements StripeIdentityPlugin this.clientSecret = options.clientSecret; this.notifyListeners(IdentityVerificationSheetEventsEnum.Loaded, null); } - async present(): Promise<{ - identityVerificationResult: IdentityVerificationSheetResultInterface; - }> { + async present(): Promise { if (!this.stripe) { throw new Error('Stripe is not initialized.'); } @@ -46,18 +43,29 @@ export class StripeIdentityWeb extends WebPlugin implements StripeIdentityPlugin this.notifyListeners(IdentityVerificationSheetEventsEnum.Canceled, { message, }); + + this.notifyListeners(IdentityVerificationSheetEventsEnum.VerificationResult, { + result: IdentityVerificationSheetEventsEnum.Canceled, + }); return { identityVerificationResult: IdentityVerificationSheetEventsEnum.Canceled, }; } - this.notifyListeners(IdentityVerificationSheetEventsEnum.Failed, { - message, + this.notifyListeners(IdentityVerificationSheetEventsEnum.Failed, error); + + this.notifyListeners(IdentityVerificationSheetEventsEnum.VerificationResult, { + result: IdentityVerificationSheetEventsEnum.Failed, + error, }); return { identityVerificationResult: IdentityVerificationSheetEventsEnum.Failed, }; } this.notifyListeners(IdentityVerificationSheetEventsEnum.Completed, null); + + this.notifyListeners(IdentityVerificationSheetEventsEnum.VerificationResult, { + result: IdentityVerificationSheetEventsEnum.Completed, + }); return { identityVerificationResult: IdentityVerificationSheetEventsEnum.Completed, }; From 3f82f4974ce06e5746d829e727011be1312d0d38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 18:31:51 +0900 Subject: [PATCH 14/45] feat(identity): add demo code --- demo/angular/src/app/identity/identity.page.ts | 10 ++++++++++ packages/identity/README.md | 1 + 2 files changed, 11 insertions(+) diff --git a/demo/angular/src/app/identity/identity.page.ts b/demo/angular/src/app/identity/identity.page.ts index 7d3f736e..75636e27 100644 --- a/demo/angular/src/app/identity/identity.page.ts +++ b/demo/angular/src/app/identity/identity.page.ts @@ -45,6 +45,11 @@ const happyPathItems: ITestItems[] = [ name: 'presentIdentityVerificationSheet', expect: [IdentityVerificationSheetEventsEnum.Completed], }, + { + type: 'event', + name: IdentityVerificationSheetEventsEnum.VerificationResult, + expect: IdentityVerificationSheetEventsEnum.Completed, + }, { type: 'event', name: IdentityVerificationSheetEventsEnum.Completed, @@ -69,6 +74,11 @@ const cancelPathItems: ITestItems[] = [ name: 'presentIdentityVerificationSheet', expect: [IdentityVerificationSheetEventsEnum.Canceled], }, + { + type: 'event', + name: IdentityVerificationSheetEventsEnum.VerificationResult, + expect: IdentityVerificationSheetEventsEnum.Canceled, + }, { type: 'event', name: IdentityVerificationSheetEventsEnum.Canceled, diff --git a/packages/identity/README.md b/packages/identity/README.md index f82c8a67..99d760e9 100644 --- a/packages/identity/README.md +++ b/packages/identity/README.md @@ -243,6 +243,7 @@ addListener(eventName: IdentityVerificationSheetEventsEnum.Failed, listenerFunc: | Prop | Type | | ------------- | ------------------- | +| **`code`** | string | | **`message`** | string | From 2270b5258554a4ab15ea0e6cd589d368e82350c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 19:16:31 +0900 Subject: [PATCH 15/45] feat(packages): update every packages Note: StripePaymentSheet@24.26.0 is broken at payment flow --- demo/angular/ios/App/Podfile.lock | 84 +++++++++---------- .../CapacitorCommunityStripeIdentity.podspec | 2 +- packages/identity/Package.swift | 2 +- packages/identity/android/build.gradle | 2 +- .../payment/CapacitorCommunityStripe.podspec | 4 +- packages/payment/Package.swift | 2 +- packages/payment/android/build.gradle | 2 +- .../CapacitorCommunityStripeTerminal.podspec | 2 +- packages/terminal/Package.swift | 2 +- packages/terminal/android/build.gradle | 6 +- 10 files changed, 54 insertions(+), 54 deletions(-) diff --git a/demo/angular/ios/App/Podfile.lock b/demo/angular/ios/App/Podfile.lock index b73c74ec..cb78f510 100644 --- a/demo/angular/ios/App/Podfile.lock +++ b/demo/angular/ios/App/Podfile.lock @@ -3,41 +3,41 @@ PODS: - CapacitorCordova - CapacitorCommunityStripe (7.1.2): - Capacitor - - StripeApplePay (~> 24.12.1) - - StripePaymentSheet (~> 24.12.1) + - StripeApplePay (~> 24.15.0) + - StripePaymentSheet (~> 24.15.0) - CapacitorCommunityStripeIdentity (7.1.2): - Capacitor - - StripeIdentity (~> 24.12.1) + - StripeIdentity (~> 24.15.0) - CapacitorCommunityStripeTerminal (7.1.2): - Capacitor - - StripeTerminal (~> 4.3.0) + - StripeTerminal (~> 4.5.0) - CapacitorCordova (7.0.1) - - StripeApplePay (24.12.1): - - StripeCore (= 24.12.1) - - StripeCameraCore (24.12.1): - - StripeCore (= 24.12.1) - - StripeCore (24.12.1) - - StripeIdentity (24.12.1): - - StripeCameraCore (= 24.12.1) - - StripeCore (= 24.12.1) - - StripeUICore (= 24.12.1) - - StripePayments (24.12.1): - - StripeCore (= 24.12.1) - - StripePayments/Stripe3DS2 (= 24.12.1) - - StripePayments/Stripe3DS2 (24.12.1): - - StripeCore (= 24.12.1) - - StripePaymentSheet (24.12.1): - - StripeApplePay (= 24.12.1) - - StripeCore (= 24.12.1) - - StripePayments (= 24.12.1) - - StripePaymentsUI (= 24.12.1) - - StripePaymentsUI (24.12.1): - - StripeCore (= 24.12.1) - - StripePayments (= 24.12.1) - - StripeUICore (= 24.12.1) - - StripeTerminal (4.3.0) - - StripeUICore (24.12.1): - - StripeCore (= 24.12.1) + - StripeApplePay (24.15.0): + - StripeCore (= 24.15.0) + - StripeCameraCore (24.15.0): + - StripeCore (= 24.15.0) + - StripeCore (24.15.0) + - StripeIdentity (24.15.0): + - StripeCameraCore (= 24.15.0) + - StripeCore (= 24.15.0) + - StripeUICore (= 24.15.0) + - StripePayments (24.15.0): + - StripeCore (= 24.15.0) + - StripePayments/Stripe3DS2 (= 24.15.0) + - StripePayments/Stripe3DS2 (24.15.0): + - StripeCore (= 24.15.0) + - StripePaymentSheet (24.15.0): + - StripeApplePay (= 24.15.0) + - StripeCore (= 24.15.0) + - StripePayments (= 24.15.0) + - StripePaymentsUI (= 24.15.0) + - StripePaymentsUI (24.15.0): + - StripeCore (= 24.15.0) + - StripePayments (= 24.15.0) + - StripeUICore (= 24.15.0) + - StripeTerminal (4.5.0) + - StripeUICore (24.15.0): + - StripeCore (= 24.15.0) DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" @@ -72,19 +72,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Capacitor: de199cba6c8b20995428ad0b7cb0bc6ca625ffd4 - CapacitorCommunityStripe: 5d3431d36c4ca3aeb6a1afe6a1eba8edcf5025bd - CapacitorCommunityStripeIdentity: 646ac7c75d25c9ca1f804e02c327b240d304a4c6 - CapacitorCommunityStripeTerminal: 2b54bcf6e5a0d2e6955073b9bdb1140abd1dd059 + CapacitorCommunityStripe: d01bdaa2e1225207a123d9134fdd1d0a5f6facdc + CapacitorCommunityStripeIdentity: 07d2969d4ba850b38ed08d41d160ae22d21767b0 + CapacitorCommunityStripeTerminal: 1ef715f2c23af1340b8b53aedc1eda09ce83da48 CapacitorCordova: 63d476958d5022d76f197031e8b7ea3519988c64 - StripeApplePay: 3caeb241c08f79b5f11024a96409317b50347e71 - StripeCameraCore: 72e4e03df07aaa942de761104818850e2c5d85e1 - StripeCore: fba9a10801900090b54a4384b85384e55643cbf6 - StripeIdentity: b08076afd1249983f99220dec7f2c5e1fa6af778 - StripePayments: 83c1b5d7b782d23030b606427726a793fee5d169 - StripePaymentSheet: b0c28bbb9b0704cdacd54facb84654d841202cec - StripePaymentsUI: 9b84384e81adc9c24f599f1a8991fb52c767fc62 - StripeTerminal: 056d0d3b5e2f2edbc5f8b6314ec5f2b037898c72 - StripeUICore: 186f245526e86ab02578abcc6bb6d27cc34084c6 + StripeApplePay: e7a2f5fa07cbdba9c56cb7586cbfd4e7e32ed895 + StripeCameraCore: c040c0f17fe3aa8b4d86c04aba733a0bc3f67b58 + StripeCore: 224f995bb108e3be3bdf6cfab918657edf325559 + StripeIdentity: c8e2ca8194721d65ca0a3435800305d05a74418c + StripePayments: 07ad9e3c5f22e0b068874c47c2ec37663f1b7aa5 + StripePaymentSheet: f576ebb935f7bf3ef956d302ade75b9148906a65 + StripePaymentsUI: d0549558424d3884b3fb7b8f3905ea685e750600 + StripeTerminal: 29fc3756591e0ae42f7cd43619b4293cdcfa9374 + StripeUICore: dbd893086aa4fe697517624af2f1f0cea3218ac8 PODFILE CHECKSUM: c75ca255b97ee461832b20e6cdf6d1da533d4019 diff --git a/packages/identity/CapacitorCommunityStripeIdentity.podspec b/packages/identity/CapacitorCommunityStripeIdentity.podspec index ba5ffe06..d8167abd 100644 --- a/packages/identity/CapacitorCommunityStripeIdentity.podspec +++ b/packages/identity/CapacitorCommunityStripeIdentity.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripeIdentity', '~> 24.12.1' + s.dependency 'StripeIdentity', '~> 24.15.0' s.swift_version = '5.1' end diff --git a/packages/identity/Package.swift b/packages/identity/Package.swift index e01b9085..67bd0bba 100644 --- a/packages/identity/Package.swift +++ b/packages/identity/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.12.1") + .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.15.0") ], targets: [ .target( diff --git a/packages/identity/android/build.gradle b/packages/identity/android/build.gradle index 088be386..73d9ebcd 100644 --- a/packages/identity/android/build.gradle +++ b/packages/identity/android/build.gradle @@ -5,7 +5,7 @@ ext { androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1' playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+' - identityVersion = project.hasProperty('identityVersion') ? rootProject.ext.identityVersion : '21.12.+' + identityVersion = project.hasProperty('identityVersion') ? rootProject.ext.identityVersion : '21.18.+' } buildscript { diff --git a/packages/payment/CapacitorCommunityStripe.podspec b/packages/payment/CapacitorCommunityStripe.podspec index 6b71e5fc..2dc2b332 100644 --- a/packages/payment/CapacitorCommunityStripe.podspec +++ b/packages/payment/CapacitorCommunityStripe.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripePaymentSheet', '~> 24.12.1' - s.dependency 'StripeApplePay', '~> 24.12.1' + s.dependency 'StripePaymentSheet', '~> 24.15.0' + s.dependency 'StripeApplePay', '~> 24.15.0' s.swift_version = '5.1' end diff --git a/packages/payment/Package.swift b/packages/payment/Package.swift index 004a1664..ee6cbb2a 100644 --- a/packages/payment/Package.swift +++ b/packages/payment/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.12.1") + .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.15.0") ], targets: [ .target( diff --git a/packages/payment/android/build.gradle b/packages/payment/android/build.gradle index 44300b40..7e73392e 100644 --- a/packages/payment/android/build.gradle +++ b/packages/payment/android/build.gradle @@ -5,7 +5,7 @@ ext { androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1' playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+' - stripeAndroidVersion = project.hasProperty('stripeAndroidVersion') ? rootProject.ext.stripeAndroidVersion : '21.12.+' + stripeAndroidVersion = project.hasProperty('stripeAndroidVersion') ? rootProject.ext.stripeAndroidVersion : '21.18.+' gsonVersion = project.hasProperty('gsonVersion') ? rootProject.ext.gsonVersion : '2.10.+' } diff --git a/packages/terminal/CapacitorCommunityStripeTerminal.podspec b/packages/terminal/CapacitorCommunityStripeTerminal.podspec index c1859605..d20d4b2a 100644 --- a/packages/terminal/CapacitorCommunityStripeTerminal.podspec +++ b/packages/terminal/CapacitorCommunityStripeTerminal.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripeTerminal', '~> 4.3.0' + s.dependency 'StripeTerminal', '~> 4.5.0' s.swift_version = '5.1' end diff --git a/packages/terminal/Package.swift b/packages/terminal/Package.swift index 0bcc9753..fec19c75 100644 --- a/packages/terminal/Package.swift +++ b/packages/terminal/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-terminal-ios.git", exact: "4.3.0") + .package(url: "https://github.com/stripe/stripe-terminal-ios.git", exact: "4.5.0") ], targets: [ .target( diff --git a/packages/terminal/android/build.gradle b/packages/terminal/android/build.gradle index 9f098c43..7ec626f5 100644 --- a/packages/terminal/android/build.gradle +++ b/packages/terminal/android/build.gradle @@ -6,9 +6,9 @@ ext { playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+' volleyVersion = project.hasProperty('volleyVersion') ? rootProject.ext.volleyVersion : '1.2.1' - stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '4.3.0' - stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '4.3.0' - stripeterminalHandoffClientVersion = project.hasProperty('stripeterminalHandoffClientVersion') ? rootProject.ext.stripeterminalHandoffClientVersion : '4.3.0' + stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '4.5.0' + stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '4.5.0' + stripeterminalHandoffClientVersion = project.hasProperty('stripeterminalHandoffClientVersion') ? rootProject.ext.stripeterminalHandoffClientVersion : '4.5.0' } buildscript { From 6988b3cf98d28b20024a8c03feceb59bc3b64040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 19 Jun 2025 19:31:44 +0900 Subject: [PATCH 16/45] chore(ci): add --stacktrace --info --debug to gradlew --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 27128827..d59271fb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,7 @@ jobs: - name: Build Android Debug APK working-directory: ./demo/angular/android - run: ./gradlew assembleDebug + run: ./gradlew assembleDebug --stacktrace - name: Upload a Build Artifact uses: actions/upload-artifact@v4 From c95e30401541974d33d023220696c14eb6a61fca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 20 Jun 2025 00:25:10 +0900 Subject: [PATCH 17/45] 7.2.0-0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a86e0522..8c774c72 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.1.2", + "version": "7.2.0-0", "engines": { "node": ">=20.0.0" }, From e2d51b9362e7a0c4593933ea15af6e984160b745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 20 Jun 2025 00:33:03 +0900 Subject: [PATCH 18/45] released --- demo/angular/ios/App/Podfile.lock | 12 ++++++------ packages/identity/package-lock.json | 4 ++-- packages/identity/package.json | 2 +- packages/payment/package-lock.json | 4 ++-- packages/payment/package.json | 2 +- packages/terminal/package-lock.json | 4 ++-- packages/terminal/package.json | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/demo/angular/ios/App/Podfile.lock b/demo/angular/ios/App/Podfile.lock index cb78f510..45ede13b 100644 --- a/demo/angular/ios/App/Podfile.lock +++ b/demo/angular/ios/App/Podfile.lock @@ -1,14 +1,14 @@ PODS: - Capacitor (7.0.1): - CapacitorCordova - - CapacitorCommunityStripe (7.1.2): + - CapacitorCommunityStripe (7.2.0-0): - Capacitor - StripeApplePay (~> 24.15.0) - StripePaymentSheet (~> 24.15.0) - - CapacitorCommunityStripeIdentity (7.1.2): + - CapacitorCommunityStripeIdentity (7.2.0-0): - Capacitor - StripeIdentity (~> 24.15.0) - - CapacitorCommunityStripeTerminal (7.1.2): + - CapacitorCommunityStripeTerminal (7.2.0-0): - Capacitor - StripeTerminal (~> 4.5.0) - CapacitorCordova (7.0.1) @@ -72,9 +72,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Capacitor: de199cba6c8b20995428ad0b7cb0bc6ca625ffd4 - CapacitorCommunityStripe: d01bdaa2e1225207a123d9134fdd1d0a5f6facdc - CapacitorCommunityStripeIdentity: 07d2969d4ba850b38ed08d41d160ae22d21767b0 - CapacitorCommunityStripeTerminal: 1ef715f2c23af1340b8b53aedc1eda09ce83da48 + CapacitorCommunityStripe: a77d559454ace3f86f3aa0c697d11af9e2c9cc2d + CapacitorCommunityStripeIdentity: f8114787ba95bfa47d65560c9ec89cc9e1733ae0 + CapacitorCommunityStripeTerminal: 31e91aff05d23d0aaf816ac7b7faaef850e87453 CapacitorCordova: 63d476958d5022d76f197031e8b7ea3519988c64 StripeApplePay: e7a2f5fa07cbdba9c56cb7586cbfd4e7e32ed895 StripeCameraCore: c040c0f17fe3aa8b4d86c04aba733a0bc3f67b58 diff --git a/packages/identity/package-lock.json b/packages/identity/package-lock.json index aa109a96..4018e22d 100644 --- a/packages/identity/package-lock.json +++ b/packages/identity/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.1.2", + "version": "7.2.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-identity", - "version": "7.1.2", + "version": "7.2.0-0", "license": "MIT", "dependencies": { "@stripe/stripe-js": "^2.1.11" diff --git a/packages/identity/package.json b/packages/identity/package.json index 1c8d5069..2c9e3ec2 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.1.2", + "version": "7.2.0-0", "engines": { "node": ">=20.0.0" }, diff --git a/packages/payment/package-lock.json b/packages/payment/package-lock.json index afd1ba3f..87e93215 100644 --- a/packages/payment/package-lock.json +++ b/packages/payment/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe", - "version": "7.1.2", + "version": "7.2.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe", - "version": "7.1.2", + "version": "7.2.0-0", "license": "MIT", "devDependencies": { "@capacitor/android": "^7.0.0", diff --git a/packages/payment/package.json b/packages/payment/package.json index 097f0cba..5793da80 100644 --- a/packages/payment/package.json +++ b/packages/payment/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.1.2", + "version": "7.2.0-0", "engines": { "node": ">=20.0.0" }, diff --git a/packages/terminal/package-lock.json b/packages/terminal/package-lock.json index 8ede5fef..77cc9f72 100644 --- a/packages/terminal/package-lock.json +++ b/packages/terminal/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.1.2", + "version": "7.2.0-0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-terminal", - "version": "7.1.2", + "version": "7.2.0-0", "license": "MIT", "dependencies": { "@stripe/terminal-js": "^0.13.0" diff --git a/packages/terminal/package.json b/packages/terminal/package.json index 28b439d0..2caa6bd7 100644 --- a/packages/terminal/package.json +++ b/packages/terminal/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.1.2", + "version": "7.2.0-0", "engines": { "node": ">=20.0.0" }, From aab0b5dc2763e87e5c2928ba0046d86202e83ff4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 20 Jun 2025 09:46:18 +0900 Subject: [PATCH 19/45] fix(terminal): fix bluetoothScan run sometimes --- .../angular/src/app/terminal/terminal.page.ts | 1 + packages/terminal/README.md | 20 +++++++++++++++---- .../StripeTerminalPlugin/StripeTerminal.swift | 19 +++++++++++++++++- packages/terminal/src/definitions.ts | 20 ++++++++++++++++++- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/demo/angular/src/app/terminal/terminal.page.ts b/demo/angular/src/app/terminal/terminal.page.ts index 5c5aa6c3..f42bba95 100644 --- a/demo/angular/src/app/terminal/terminal.page.ts +++ b/demo/angular/src/app/terminal/terminal.page.ts @@ -254,6 +254,7 @@ export class TerminalPage { locationId: [TerminalConnectTypes.Usb].includes(readerType) ? 'tml_Ff37mAmk1XdBYT' // Auckland, New Zealand : 'tml_FOUOdQVIxvVdvN', // San Francisco, CA 94110 + bluetoothScanWaitTime: 2000, }).catch((e) => { this.helper.updateItem(this.eventItems, 'discoverReaders', false); throw e; diff --git a/packages/terminal/README.md b/packages/terminal/README.md index 7f1d5c0c..f8353ae5 100644 --- a/packages/terminal/README.md +++ b/packages/terminal/README.md @@ -283,12 +283,12 @@ initialize(options: { tokenProviderEndpoint?: string; isTest: boolean; }) => Pro ### discoverReaders(...) ```typescript -discoverReaders(options: { type: TerminalConnectTypes; locationId?: string; }) => Promise<{ readers: ReaderInterface[]; }> +discoverReaders(options: DiscoverReadersOptions) => Promise<{ readers: ReaderInterface[]; }> ``` -| Param | Type | -| ------------- | ----------------------------------------------------------------------------------------------------- | -| **`options`** | { type: TerminalConnectTypes; locationId?: string; } | +| Param | Type | +| ------------- | ------------------------------------------------------------------------- | +| **`options`** | DiscoverReadersOptions | **Returns:** Promise<{ readers: ReaderInterface[]; }> @@ -492,6 +492,9 @@ addListener(eventName: TerminalEventsEnum.RequestedConnectionToken, listenerFunc addListener(eventName: TerminalEventsEnum.DiscoveredReaders, listenerFunc: ({ readers }: { readers: ReaderInterface[]; }) => void) => Promise ``` +When searching for iOS Bluetooth, this will be executed multiple times. +https://docs.stripe.com/terminal/payments/connect-reader?terminal-sdk-platform=ios&reader-type=bluetooth + | Param | Type | | ------------------ | ----------------------------------------------------------------------------------- | | **`eventName`** | TerminalEventsEnum.DiscoveredReaders | @@ -923,6 +926,15 @@ addListener(eventName: TerminalEventsEnum.ReaderReconnectFailed, listenerFunc: ( ### Interfaces +#### DiscoverReadersOptions + +| Prop | Type | Description | +| --------------------------- | --------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| **`type`** | TerminalConnectTypes | | +| **`locationId`** | string | | +| **`bluetoothScanWaitTime`** | number | Only applies to Bluetooth scan discovery (iOS only). During discovery, readers are reported via DiscoveryDelegate.didUpdateDiscoveredReaders. This timeout controls how long to wait before resolving the `discoverReaders` method with the current list. If this setting is not specified or is set to 0, the initial scan results will be returned. | + + #### PluginListenerHandle | Prop | Type | diff --git a/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift b/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift index e92b7592..946626b0 100644 --- a/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift +++ b/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift @@ -58,9 +58,24 @@ public class StripeTerminal: NSObject, DiscoveryDelegate, TerminalDelegate, Read return } - self.discoverCall = call self.plugin?.notifyListeners(TerminalEvents.DiscoveringReaders.rawValue, data: [:]) + + let bluetoothScanWaitTime = call.getDouble("bluetoothScanWaitTime") ?? 0 + if (self.type == .bluetoothScan && bluetoothScanWaitTime != 0) { + DispatchQueue.main.asyncAfter(deadline: .now() + bluetoothScanWaitTime / 1000.0) { + var readersJSObject: JSArray = [] + for reader in self.discoveredReadersList ?? [] { + readersJSObject.append(self.convertReaderInterface(reader: reader)) + } + call.resolve([ + "readers": readersJSObject + ]) + } + } else { + self.discoverCall = call + } + self.discoverCancelable = Terminal.shared.discoverReaders(config, delegate: self) { error in if let error = error { print("discoverReaders failed: \(error)") @@ -80,6 +95,8 @@ public class StripeTerminal: NSObject, DiscoveryDelegate, TerminalDelegate, Read self.discoveredReadersList = readers self.plugin?.notifyListeners(TerminalEvents.DiscoveredReaders.rawValue, data: ["readers": readersJSObject]) + + // If self.type == .bluetoothScan, discoverCall is nil self.discoverCall?.resolve([ "readers": readersJSObject ]) diff --git a/packages/terminal/src/definitions.ts b/packages/terminal/src/definitions.ts index f0653e29..10601677 100644 --- a/packages/terminal/src/definitions.ts +++ b/packages/terminal/src/definitions.ts @@ -91,11 +91,25 @@ export type Cart = { lineItems: CartLineItem[]; }; +export interface DiscoverReadersOptions { + type: TerminalConnectTypes; + locationId?: string; + + /** + * Only applies to Bluetooth scan discovery (iOS only). + * During discovery, readers are reported via DiscoveryDelegate.didUpdateDiscoveredReaders. + * This timeout controls how long to wait before resolving the `discoverReaders` method with the current list. + * + * If this setting is not specified or is set to 0, the initial scan results will be returned. + */ + bluetoothScanWaitTime?: number; +} + export * from './events.enum'; export * from './stripe.enum'; export interface StripeTerminalPlugin { initialize(options: { tokenProviderEndpoint?: string; isTest: boolean }): Promise; - discoverReaders(options: { type: TerminalConnectTypes; locationId?: string }): Promise<{ + discoverReaders(options: DiscoverReadersOptions): Promise<{ readers: ReaderInterface[]; }>; setConnectionToken(options: { token: string }): Promise; @@ -146,6 +160,10 @@ export interface StripeTerminalPlugin { listenerFunc: () => void, ): Promise; + /** + * When searching for iOS Bluetooth, this will be executed multiple times. + * https://docs.stripe.com/terminal/payments/connect-reader?terminal-sdk-platform=ios&reader-type=bluetooth + */ addListener( eventName: TerminalEventsEnum.DiscoveredReaders, listenerFunc: ({ readers }: { readers: ReaderInterface[] }) => void, From f8ac981bed528f62b08aa7967e2f635150ff7780 Mon Sep 17 00:00:00 2001 From: Masahiko Sakakibara Date: Fri, 20 Jun 2025 10:42:20 +0900 Subject: [PATCH 20/45] Update packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .../ios/Sources/StripeTerminalPlugin/StripeTerminal.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift b/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift index 946626b0..e2c8da6d 100644 --- a/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift +++ b/packages/terminal/ios/Sources/StripeTerminalPlugin/StripeTerminal.swift @@ -63,6 +63,9 @@ public class StripeTerminal: NSObject, DiscoveryDelegate, TerminalDelegate, Read let bluetoothScanWaitTime = call.getDouble("bluetoothScanWaitTime") ?? 0 if (self.type == .bluetoothScan && bluetoothScanWaitTime != 0) { + // When bluetoothScanWaitTime is non-zero, we defer the resolution of the call + // using a timer. In this case, discoverCall is not assigned because the resolution + // logic is handled asynchronously after the wait time. DispatchQueue.main.asyncAfter(deadline: .now() + bluetoothScanWaitTime / 1000.0) { var readersJSObject: JSArray = [] for reader in self.discoveredReadersList ?? [] { From 189756d1f1d339b7c57929d49d2c9f9a04d50a89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 20 Jun 2025 10:48:52 +0900 Subject: [PATCH 21/45] 7.2.0-1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8c774c72..a564875b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0-0", + "version": "7.2.0-1", "engines": { "node": ">=20.0.0" }, From a87e7229d36411cd2fb79d4a8029fea11334b6be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 20 Jun 2025 10:50:35 +0900 Subject: [PATCH 22/45] released --- packages/identity/package-lock.json | 4 ++-- packages/identity/package.json | 2 +- packages/payment/package-lock.json | 4 ++-- packages/payment/package.json | 2 +- packages/terminal/package-lock.json | 4 ++-- packages/terminal/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/identity/package-lock.json b/packages/identity/package-lock.json index 4018e22d..38d4e49e 100644 --- a/packages/identity/package-lock.json +++ b/packages/identity/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0-0", + "version": "7.2.0-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0-0", + "version": "7.2.0-1", "license": "MIT", "dependencies": { "@stripe/stripe-js": "^2.1.11" diff --git a/packages/identity/package.json b/packages/identity/package.json index 2c9e3ec2..fba0cd36 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0-0", + "version": "7.2.0-1", "engines": { "node": ">=20.0.0" }, diff --git a/packages/payment/package-lock.json b/packages/payment/package-lock.json index 87e93215..15d96def 100644 --- a/packages/payment/package-lock.json +++ b/packages/payment/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0-0", + "version": "7.2.0-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe", - "version": "7.2.0-0", + "version": "7.2.0-1", "license": "MIT", "devDependencies": { "@capacitor/android": "^7.0.0", diff --git a/packages/payment/package.json b/packages/payment/package.json index 5793da80..e6caa5d5 100644 --- a/packages/payment/package.json +++ b/packages/payment/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0-0", + "version": "7.2.0-1", "engines": { "node": ">=20.0.0" }, diff --git a/packages/terminal/package-lock.json b/packages/terminal/package-lock.json index 77cc9f72..e3aedf52 100644 --- a/packages/terminal/package-lock.json +++ b/packages/terminal/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0-0", + "version": "7.2.0-1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0-0", + "version": "7.2.0-1", "license": "MIT", "dependencies": { "@stripe/terminal-js": "^0.13.0" diff --git a/packages/terminal/package.json b/packages/terminal/package.json index 2caa6bd7..990ce0b6 100644 --- a/packages/terminal/package.json +++ b/packages/terminal/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0-0", + "version": "7.2.0-1", "engines": { "node": ">=20.0.0" }, From 46653040a6b81f79bbd037b0cd43340796d2689b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 20 Jun 2025 10:51:08 +0900 Subject: [PATCH 23/45] 7.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a564875b..bf2405d2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0-1", + "version": "7.2.0", "engines": { "node": ">=20.0.0" }, From 907729e44e2d5dfdd37cb1b60756d35e2eaa0ae6 Mon Sep 17 00:00:00 2001 From: Yan Loetzer Date: Fri, 20 Jun 2025 09:14:15 +0100 Subject: [PATCH 24/45] Update README.md to increase Stripe SDK verison for Stripe Terminal. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 05cb1835..516eacf9 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ To use the latest Stripe Android, you need to version these up. To use the lates + identityVersion = '21.3.+' // If you use @capacitor-community/stripe-terminal: -+ stripeterminalCoreVersion = '4.1.0' -+ stripeterminalTapToPayVersion = '4.1.0' ++ stripeterminalCoreVersion = '4.5.0' ++ stripeterminalTapToPayVersion = '4.5.0' } ``` From 13ddcbfdf85bcbd21075326cddda082fc311d8d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Sun, 22 Jun 2025 13:19:04 +0900 Subject: [PATCH 25/45] released --- packages/identity/package-lock.json | 4 ++-- packages/identity/package.json | 2 +- packages/payment/package-lock.json | 4 ++-- packages/payment/package.json | 2 +- packages/terminal/package-lock.json | 4 ++-- packages/terminal/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/identity/package-lock.json b/packages/identity/package-lock.json index 38d4e49e..c0b4320b 100644 --- a/packages/identity/package-lock.json +++ b/packages/identity/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0-1", + "version": "7.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0-1", + "version": "7.2.0", "license": "MIT", "dependencies": { "@stripe/stripe-js": "^2.1.11" diff --git a/packages/identity/package.json b/packages/identity/package.json index fba0cd36..7d7c4e69 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0-1", + "version": "7.2.0", "engines": { "node": ">=20.0.0" }, diff --git a/packages/payment/package-lock.json b/packages/payment/package-lock.json index 15d96def..bd52d66f 100644 --- a/packages/payment/package-lock.json +++ b/packages/payment/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0-1", + "version": "7.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe", - "version": "7.2.0-1", + "version": "7.2.0", "license": "MIT", "devDependencies": { "@capacitor/android": "^7.0.0", diff --git a/packages/payment/package.json b/packages/payment/package.json index e6caa5d5..9f19422b 100644 --- a/packages/payment/package.json +++ b/packages/payment/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0-1", + "version": "7.2.0", "engines": { "node": ">=20.0.0" }, diff --git a/packages/terminal/package-lock.json b/packages/terminal/package-lock.json index e3aedf52..f12f1636 100644 --- a/packages/terminal/package-lock.json +++ b/packages/terminal/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0-1", + "version": "7.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0-1", + "version": "7.2.0", "license": "MIT", "dependencies": { "@stripe/terminal-js": "^0.13.0" diff --git a/packages/terminal/package.json b/packages/terminal/package.json index 990ce0b6..04e8a9bd 100644 --- a/packages/terminal/package.json +++ b/packages/terminal/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0-1", + "version": "7.2.0", "engines": { "node": ">=20.0.0" }, From dbe0cafdc7cfa2457a794fd26409aa6bf2dbb48e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Tue, 24 Jun 2025 11:09:56 +0900 Subject: [PATCH 26/45] chore(payment): update StripePaymentSheet to 24.16.1 --- demo/angular/ios/App/Podfile.lock | 84 +++++++++---------- .../CapacitorCommunityStripeIdentity.podspec | 2 +- packages/identity/Package.swift | 2 +- .../payment/CapacitorCommunityStripe.podspec | 4 +- packages/payment/Package.swift | 2 +- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/demo/angular/ios/App/Podfile.lock b/demo/angular/ios/App/Podfile.lock index 45ede13b..199ece9a 100644 --- a/demo/angular/ios/App/Podfile.lock +++ b/demo/angular/ios/App/Podfile.lock @@ -1,43 +1,43 @@ PODS: - Capacitor (7.0.1): - CapacitorCordova - - CapacitorCommunityStripe (7.2.0-0): + - CapacitorCommunityStripe (7.2.0): - Capacitor - - StripeApplePay (~> 24.15.0) - - StripePaymentSheet (~> 24.15.0) - - CapacitorCommunityStripeIdentity (7.2.0-0): + - StripeApplePay (~> 24.16.1) + - StripePaymentSheet (~> 24.16.1) + - CapacitorCommunityStripeIdentity (7.2.0): - Capacitor - - StripeIdentity (~> 24.15.0) - - CapacitorCommunityStripeTerminal (7.2.0-0): + - StripeIdentity (~> 24.16.1) + - CapacitorCommunityStripeTerminal (7.2.0): - Capacitor - StripeTerminal (~> 4.5.0) - CapacitorCordova (7.0.1) - - StripeApplePay (24.15.0): - - StripeCore (= 24.15.0) - - StripeCameraCore (24.15.0): - - StripeCore (= 24.15.0) - - StripeCore (24.15.0) - - StripeIdentity (24.15.0): - - StripeCameraCore (= 24.15.0) - - StripeCore (= 24.15.0) - - StripeUICore (= 24.15.0) - - StripePayments (24.15.0): - - StripeCore (= 24.15.0) - - StripePayments/Stripe3DS2 (= 24.15.0) - - StripePayments/Stripe3DS2 (24.15.0): - - StripeCore (= 24.15.0) - - StripePaymentSheet (24.15.0): - - StripeApplePay (= 24.15.0) - - StripeCore (= 24.15.0) - - StripePayments (= 24.15.0) - - StripePaymentsUI (= 24.15.0) - - StripePaymentsUI (24.15.0): - - StripeCore (= 24.15.0) - - StripePayments (= 24.15.0) - - StripeUICore (= 24.15.0) + - StripeApplePay (24.16.1): + - StripeCore (= 24.16.1) + - StripeCameraCore (24.16.1): + - StripeCore (= 24.16.1) + - StripeCore (24.16.1) + - StripeIdentity (24.16.1): + - StripeCameraCore (= 24.16.1) + - StripeCore (= 24.16.1) + - StripeUICore (= 24.16.1) + - StripePayments (24.16.1): + - StripeCore (= 24.16.1) + - StripePayments/Stripe3DS2 (= 24.16.1) + - StripePayments/Stripe3DS2 (24.16.1): + - StripeCore (= 24.16.1) + - StripePaymentSheet (24.16.1): + - StripeApplePay (= 24.16.1) + - StripeCore (= 24.16.1) + - StripePayments (= 24.16.1) + - StripePaymentsUI (= 24.16.1) + - StripePaymentsUI (24.16.1): + - StripeCore (= 24.16.1) + - StripePayments (= 24.16.1) + - StripeUICore (= 24.16.1) - StripeTerminal (4.5.0) - - StripeUICore (24.15.0): - - StripeCore (= 24.15.0) + - StripeUICore (24.16.1): + - StripeCore (= 24.16.1) DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" @@ -72,19 +72,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Capacitor: de199cba6c8b20995428ad0b7cb0bc6ca625ffd4 - CapacitorCommunityStripe: a77d559454ace3f86f3aa0c697d11af9e2c9cc2d - CapacitorCommunityStripeIdentity: f8114787ba95bfa47d65560c9ec89cc9e1733ae0 - CapacitorCommunityStripeTerminal: 31e91aff05d23d0aaf816ac7b7faaef850e87453 + CapacitorCommunityStripe: 82fdfc30b65aee21b0a40ce2529068edf4ffe423 + CapacitorCommunityStripeIdentity: 5f32c804b673fe6679fdfdb176a934f51696ac39 + CapacitorCommunityStripeTerminal: dd4f8c0c98b9e927fb8e408187ba4e59e4e43f44 CapacitorCordova: 63d476958d5022d76f197031e8b7ea3519988c64 - StripeApplePay: e7a2f5fa07cbdba9c56cb7586cbfd4e7e32ed895 - StripeCameraCore: c040c0f17fe3aa8b4d86c04aba733a0bc3f67b58 - StripeCore: 224f995bb108e3be3bdf6cfab918657edf325559 - StripeIdentity: c8e2ca8194721d65ca0a3435800305d05a74418c - StripePayments: 07ad9e3c5f22e0b068874c47c2ec37663f1b7aa5 - StripePaymentSheet: f576ebb935f7bf3ef956d302ade75b9148906a65 - StripePaymentsUI: d0549558424d3884b3fb7b8f3905ea685e750600 + StripeApplePay: 4303d484ec3b43d96b73a3127470674f8484a27d + StripeCameraCore: acc675f63989d9f919a733add3225c6dcee548ca + StripeCore: 45ccc543ea1d54f00f03dd4813b4ab1071ae5d34 + StripeIdentity: 87480865e135349a478057c935a7f217df00ce57 + StripePayments: 3f3cd1970de45f1d26d263bb5a6be5cfd9df93eb + StripePaymentSheet: edfe0ecd4d1d25ac3a3bda7c53e80e7c2df7a1e0 + StripePaymentsUI: f3e663c841a0c9303e315f61db145f96667db9c0 StripeTerminal: 29fc3756591e0ae42f7cd43619b4293cdcfa9374 - StripeUICore: dbd893086aa4fe697517624af2f1f0cea3218ac8 + StripeUICore: 1ddbdd49d9fde119d9e64c17e7e79d49c29ccb98 PODFILE CHECKSUM: c75ca255b97ee461832b20e6cdf6d1da533d4019 diff --git a/packages/identity/CapacitorCommunityStripeIdentity.podspec b/packages/identity/CapacitorCommunityStripeIdentity.podspec index d8167abd..3e40e5ad 100644 --- a/packages/identity/CapacitorCommunityStripeIdentity.podspec +++ b/packages/identity/CapacitorCommunityStripeIdentity.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripeIdentity', '~> 24.15.0' + s.dependency 'StripeIdentity', '~> 24.16.1' s.swift_version = '5.1' end diff --git a/packages/identity/Package.swift b/packages/identity/Package.swift index 67bd0bba..3c0c2f85 100644 --- a/packages/identity/Package.swift +++ b/packages/identity/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.15.0") + .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.16.1") ], targets: [ .target( diff --git a/packages/payment/CapacitorCommunityStripe.podspec b/packages/payment/CapacitorCommunityStripe.podspec index 2dc2b332..c3bf1821 100644 --- a/packages/payment/CapacitorCommunityStripe.podspec +++ b/packages/payment/CapacitorCommunityStripe.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripePaymentSheet', '~> 24.15.0' - s.dependency 'StripeApplePay', '~> 24.15.0' + s.dependency 'StripePaymentSheet', '~> 24.16.1' + s.dependency 'StripeApplePay', '~> 24.16.1' s.swift_version = '5.1' end diff --git a/packages/payment/Package.swift b/packages/payment/Package.swift index ee6cbb2a..268e19cc 100644 --- a/packages/payment/Package.swift +++ b/packages/payment/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.15.0") + .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.16.1") ], targets: [ .target( From 26dfc5dde017f7cbdd18c7401da801180e296f9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Mon, 8 Sep 2025 16:42:21 +0900 Subject: [PATCH 27/45] feat(terminal): update terminal packages. --- .../CapacitorCommunityStripeTerminal.podspec | 2 +- packages/terminal/Package.swift | 2 +- packages/terminal/package-lock.json | 28 +++++++++++++------ packages/terminal/package.json | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/packages/terminal/CapacitorCommunityStripeTerminal.podspec b/packages/terminal/CapacitorCommunityStripeTerminal.podspec index d20d4b2a..6992411e 100644 --- a/packages/terminal/CapacitorCommunityStripeTerminal.podspec +++ b/packages/terminal/CapacitorCommunityStripeTerminal.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripeTerminal', '~> 4.5.0' + s.dependency 'StripeTerminal', '~> 4.7.0' s.swift_version = '5.1' end diff --git a/packages/terminal/Package.swift b/packages/terminal/Package.swift index fec19c75..9f75f129 100644 --- a/packages/terminal/Package.swift +++ b/packages/terminal/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-terminal-ios.git", exact: "4.5.0") + .package(url: "https://github.com/stripe/stripe-terminal-ios.git", exact: "4.7.0") ], targets: [ .target( diff --git a/packages/terminal/package-lock.json b/packages/terminal/package-lock.json index f12f1636..36525cf0 100644 --- a/packages/terminal/package-lock.json +++ b/packages/terminal/package-lock.json @@ -9,7 +9,7 @@ "version": "7.2.0", "license": "MIT", "dependencies": { - "@stripe/terminal-js": "^0.13.0" + "@stripe/terminal-js": "^0.24.0" }, "devDependencies": { "@capacitor/android": "^7.0.0", @@ -769,11 +769,13 @@ ] }, "node_modules/@stripe/terminal-js": { - "version": "0.13.0", + "version": "0.24.0", + "resolved": "https://registry.npmjs.org/@stripe/terminal-js/-/terminal-js-0.24.0.tgz", + "integrity": "sha512-fStlSPqit2t99o40ZCFUZe4WiB0J+tQDND4Kcy+5mIq3fqd9PF4QBVYlaC5iAc05Zu0iSH9UhA4QOC+feJC2sQ==", "license": "MIT", "dependencies": { - "stripe": "^8.184.0", - "ws": "6.2.2" + "stripe": "^8.222.0", + "ws": "6.2.3" } }, "node_modules/@types/estree": { @@ -1179,6 +1181,8 @@ }, "node_modules/async-limiter": { "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", + "integrity": "sha512-csOlWGAcRFJaI6m+F2WKdnMKr4HhdhFVBk0H/QbJFMCr+uO2kwohwXQPxw/9OCxp05r5ghVBFSyioixx3gfkNQ==", "license": "MIT" }, "node_modules/at-least-node": { @@ -1206,7 +1210,9 @@ "license": "MIT" }, "node_modules/brace-expansion": { - "version": "1.1.11", + "version": "1.1.12", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.12.tgz", + "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", "dependencies": { @@ -1322,7 +1328,9 @@ "license": "MIT" }, "node_modules/cross-spawn": { - "version": "7.0.3", + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", "dev": true, "license": "MIT", "dependencies": { @@ -2127,7 +2135,9 @@ } }, "node_modules/glob/node_modules/brace-expansion": { - "version": "2.0.1", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", "dev": true, "license": "MIT", "dependencies": { @@ -3938,7 +3948,9 @@ "license": "ISC" }, "node_modules/ws": { - "version": "6.2.2", + "version": "6.2.3", + "resolved": "https://registry.npmjs.org/ws/-/ws-6.2.3.tgz", + "integrity": "sha512-jmTjYU0j60B+vHey6TfR3Z7RD61z/hmxBS3VMSGIrroOWXQEneK1zNuotOUrGyBHQj0yrpsLHPWtigEFd13ndA==", "license": "MIT", "dependencies": { "async-limiter": "~1.0.0" diff --git a/packages/terminal/package.json b/packages/terminal/package.json index 04e8a9bd..51389d88 100644 --- a/packages/terminal/package.json +++ b/packages/terminal/package.json @@ -81,6 +81,6 @@ } }, "dependencies": { - "@stripe/terminal-js": "^0.13.0" + "@stripe/terminal-js": "^0.24.0" } } From ef0c7bd5f639997441bdd858eab02600ee1db276 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Mon, 8 Sep 2025 16:44:25 +0900 Subject: [PATCH 28/45] feat(demo): update to ng20 --- demo/angular/angular.json | 32 +++++++++++-- demo/angular/ios/App/Podfile.lock | 74 +++++++++++++++---------------- demo/angular/karma.conf.js | 2 +- demo/angular/package.json | 28 ++++++------ demo/angular/tsconfig.json | 4 +- 5 files changed, 82 insertions(+), 58 deletions(-) diff --git a/demo/angular/angular.json b/demo/angular/angular.json index 7fa7abe5..cc135bcf 100644 --- a/demo/angular/angular.json +++ b/demo/angular/angular.json @@ -11,7 +11,7 @@ "prefix": "app", "architect": { "build": { - "builder": "@angular-devkit/build-angular:application", + "builder": "@angular/build:application", "options": { "outputPath": "www", "index": "src/index.html", @@ -71,7 +71,7 @@ "defaultConfiguration": "production" }, "serve": { - "builder": "@angular-devkit/build-angular:dev-server", + "builder": "@angular/build:dev-server", "configurations": { "production": { "buildTarget": "app:build:production" @@ -86,13 +86,13 @@ "defaultConfiguration": "development" }, "extract-i18n": { - "builder": "@angular-devkit/build-angular:extract-i18n", + "builder": "@angular/build:extract-i18n", "options": { "buildTarget": "app:build" } }, "test": { - "builder": "@angular-devkit/build-angular:karma", + "builder": "@angular/build:karma", "options": { "main": "src/test.ts", "polyfills": "src/polyfills.ts", @@ -148,6 +148,30 @@ }, "@ionic/angular-toolkit:page": { "styleext": "scss" + }, + "@schematics/angular:component": { + "type": "component" + }, + "@schematics/angular:directive": { + "type": "directive" + }, + "@schematics/angular:service": { + "type": "service" + }, + "@schematics/angular:guard": { + "typeSeparator": "." + }, + "@schematics/angular:interceptor": { + "typeSeparator": "." + }, + "@schematics/angular:module": { + "typeSeparator": "." + }, + "@schematics/angular:pipe": { + "typeSeparator": "." + }, + "@schematics/angular:resolver": { + "typeSeparator": "." } } } diff --git a/demo/angular/ios/App/Podfile.lock b/demo/angular/ios/App/Podfile.lock index 199ece9a..4e9757e0 100644 --- a/demo/angular/ios/App/Podfile.lock +++ b/demo/angular/ios/App/Podfile.lock @@ -10,34 +10,34 @@ PODS: - StripeIdentity (~> 24.16.1) - CapacitorCommunityStripeTerminal (7.2.0): - Capacitor - - StripeTerminal (~> 4.5.0) + - StripeTerminal (~> 4.7.0) - CapacitorCordova (7.0.1) - - StripeApplePay (24.16.1): - - StripeCore (= 24.16.1) - - StripeCameraCore (24.16.1): - - StripeCore (= 24.16.1) - - StripeCore (24.16.1) - - StripeIdentity (24.16.1): - - StripeCameraCore (= 24.16.1) - - StripeCore (= 24.16.1) - - StripeUICore (= 24.16.1) - - StripePayments (24.16.1): - - StripeCore (= 24.16.1) - - StripePayments/Stripe3DS2 (= 24.16.1) - - StripePayments/Stripe3DS2 (24.16.1): - - StripeCore (= 24.16.1) - - StripePaymentSheet (24.16.1): - - StripeApplePay (= 24.16.1) - - StripeCore (= 24.16.1) - - StripePayments (= 24.16.1) - - StripePaymentsUI (= 24.16.1) - - StripePaymentsUI (24.16.1): - - StripeCore (= 24.16.1) - - StripePayments (= 24.16.1) - - StripeUICore (= 24.16.1) - - StripeTerminal (4.5.0) - - StripeUICore (24.16.1): - - StripeCore (= 24.16.1) + - StripeApplePay (24.16.2): + - StripeCore (= 24.16.2) + - StripeCameraCore (24.16.2): + - StripeCore (= 24.16.2) + - StripeCore (24.16.2) + - StripeIdentity (24.16.2): + - StripeCameraCore (= 24.16.2) + - StripeCore (= 24.16.2) + - StripeUICore (= 24.16.2) + - StripePayments (24.16.2): + - StripeCore (= 24.16.2) + - StripePayments/Stripe3DS2 (= 24.16.2) + - StripePayments/Stripe3DS2 (24.16.2): + - StripeCore (= 24.16.2) + - StripePaymentSheet (24.16.2): + - StripeApplePay (= 24.16.2) + - StripeCore (= 24.16.2) + - StripePayments (= 24.16.2) + - StripePaymentsUI (= 24.16.2) + - StripePaymentsUI (24.16.2): + - StripeCore (= 24.16.2) + - StripePayments (= 24.16.2) + - StripeUICore (= 24.16.2) + - StripeTerminal (4.7.0) + - StripeUICore (24.16.2): + - StripeCore (= 24.16.2) DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" @@ -74,17 +74,17 @@ SPEC CHECKSUMS: Capacitor: de199cba6c8b20995428ad0b7cb0bc6ca625ffd4 CapacitorCommunityStripe: 82fdfc30b65aee21b0a40ce2529068edf4ffe423 CapacitorCommunityStripeIdentity: 5f32c804b673fe6679fdfdb176a934f51696ac39 - CapacitorCommunityStripeTerminal: dd4f8c0c98b9e927fb8e408187ba4e59e4e43f44 + CapacitorCommunityStripeTerminal: 59cfad2cecc0781d7f4a84529f65e3e161a4fcaa CapacitorCordova: 63d476958d5022d76f197031e8b7ea3519988c64 - StripeApplePay: 4303d484ec3b43d96b73a3127470674f8484a27d - StripeCameraCore: acc675f63989d9f919a733add3225c6dcee548ca - StripeCore: 45ccc543ea1d54f00f03dd4813b4ab1071ae5d34 - StripeIdentity: 87480865e135349a478057c935a7f217df00ce57 - StripePayments: 3f3cd1970de45f1d26d263bb5a6be5cfd9df93eb - StripePaymentSheet: edfe0ecd4d1d25ac3a3bda7c53e80e7c2df7a1e0 - StripePaymentsUI: f3e663c841a0c9303e315f61db145f96667db9c0 - StripeTerminal: 29fc3756591e0ae42f7cd43619b4293cdcfa9374 - StripeUICore: 1ddbdd49d9fde119d9e64c17e7e79d49c29ccb98 + StripeApplePay: 66dc43ec1284904a2cf4c5a0906f86296d23afbd + StripeCameraCore: 4bfdf6b43536346102c61ae46c634f275deb5b78 + StripeCore: f3a62397cecaf4da1827bcf07de7312ec1f3b96e + StripeIdentity: 1ed535d6873f17781f53552a7e9397b90ccdfab3 + StripePayments: b3e7817d821ceedd469008d17d94a1494ff1b624 + StripePaymentSheet: f4f5b71cef665f05a185c29b2d4b59e7dd8c117d + StripePaymentsUI: d489e73bf790da1c74e642021475b1a09a4a4500 + StripeTerminal: 960112008f29d0ec0ecf69e26856b91a0dc2b722 + StripeUICore: 723e5024c83acb5ba5e71335e110a471b182a74d PODFILE CHECKSUM: c75ca255b97ee461832b20e6cdf6d1da533d4019 diff --git a/demo/angular/karma.conf.js b/demo/angular/karma.conf.js index 49eb12fa..51268534 100644 --- a/demo/angular/karma.conf.js +++ b/demo/angular/karma.conf.js @@ -10,7 +10,7 @@ module.exports = function (config) { require('karma-chrome-launcher'), require('karma-jasmine-html-reporter'), require('karma-coverage'), - require('@angular-devkit/build-angular/plugins/karma') + ], client: { jasmine: { diff --git a/demo/angular/package.json b/demo/angular/package.json index 60f56294..e17f4674 100644 --- a/demo/angular/package.json +++ b/demo/angular/package.json @@ -15,12 +15,12 @@ }, "private": true, "dependencies": { - "@angular/common": "^19.2.9", - "@angular/core": "^19.2.9", - "@angular/forms": "^19.2.9", - "@angular/platform-browser": "^19.2.9", - "@angular/platform-browser-dynamic": "^19.2.9", - "@angular/router": "^19.2.9", + "@angular/common": "^20.2.4", + "@angular/core": "^20.2.4", + "@angular/forms": "^20.2.4", + "@angular/platform-browser": "^20.2.4", + "@angular/platform-browser-dynamic": "^20.2.4", + "@angular/router": "^20.2.4", "@capacitor-community/stripe": "file:../../packages/payment", "@capacitor-community/stripe-identity": "file:../../packages/identity", "@capacitor-community/stripe-terminal": "file:../../packages/terminal", @@ -34,11 +34,11 @@ "zone.js": "~0.15.0" }, "devDependencies": { - "@angular-devkit/build-angular": "^19.2.10", - "@angular/cli": "^19.2.10", - "@angular/compiler": "^19.2.9", - "@angular/compiler-cli": "^19.2.9", - "@angular/language-service": "^19.2.9", + "@angular/build": "^20.2.2", + "@angular/cli": "^20.2.2", + "@angular/compiler": "^20.2.4", + "@angular/compiler-cli": "^20.2.4", + "@angular/language-service": "^20.2.4", "@capacitor/cli": "^7.0.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.25.1", @@ -46,8 +46,8 @@ "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", "@types/node": "^12.11.1", - "angular-eslint": "19.3.0", - "eslint": "^9.23.0", + "angular-eslint": "20.2.0", + "eslint": "^9.28.0", "jasmine-core": "~3.8.0", "jasmine-spec-reporter": "~5.0.0", "karma": "~6.3.16", @@ -59,7 +59,7 @@ "prettier": "^3.5.3", "protractor": "~7.0.0", "typescript": "^5.8.3", - "typescript-eslint": "8.27.0" + "typescript-eslint": "^8.33.1" }, "description": "An Ionic project" } diff --git a/demo/angular/tsconfig.json b/demo/angular/tsconfig.json index 7c07208a..248410a7 100644 --- a/demo/angular/tsconfig.json +++ b/demo/angular/tsconfig.json @@ -14,13 +14,13 @@ "sourceMap": true, "declaration": false, "experimentalDecorators": true, - "moduleResolution": "node", + "moduleResolution": "bundler", "importHelpers": true, "target": "es2022", "module": "es2022", "lib": [ "es2022", - "dom", + "dom" ], "useDefineForClassFields": false }, From d81f06619b79d2979b2db36bf8bfb3ff9a13c536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Mon, 8 Sep 2025 16:59:09 +0900 Subject: [PATCH 29/45] feat(demo): ng generate @angular/core:inject --- demo/angular/src/app/demo/demo.page.ts | 9 +++++++-- demo/angular/src/app/flow/flow.page.ts | 13 ++++++++----- demo/angular/src/app/identity/identity.page.ts | 13 ++++++++----- demo/angular/src/app/shared/helper.service.ts | 9 +++++++-- demo/angular/src/app/sheet/sheet.page.ts | 13 ++++++++----- demo/angular/src/app/terminal/terminal.page.ts | 11 +++++++---- 6 files changed, 45 insertions(+), 23 deletions(-) diff --git a/demo/angular/src/app/demo/demo.page.ts b/demo/angular/src/app/demo/demo.page.ts index d59b0bf6..6344dc45 100644 --- a/demo/angular/src/app/demo/demo.page.ts +++ b/demo/angular/src/app/demo/demo.page.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, OnInit, inject } from '@angular/core'; import { Address, ApplePayEventsEnum, @@ -39,6 +39,8 @@ import { ], }) export class DemoPage implements OnInit { + private http = inject(HttpClient); + processSheet: 'willReady' | 'Ready' = 'willReady'; processFlow: 'willReady' | 'Ready' | 'canConfirm' = 'willReady'; processApplePay: 'willReady' | 'Ready' = 'willReady'; @@ -46,7 +48,10 @@ export class DemoPage implements OnInit { isApplePayAvailable = false; isGooglePayAvailable = false; - constructor(private http: HttpClient) {} + /** Inserted by Angular inject() migration for backwards compatibility */ + constructor(...args: unknown[]); + + constructor() {} async ngOnInit() { Stripe.addListener(PaymentSheetEventsEnum.Loaded, () => { diff --git a/demo/angular/src/app/flow/flow.page.ts b/demo/angular/src/app/flow/flow.page.ts index 3f6ced19..1da273d1 100644 --- a/demo/angular/src/app/flow/flow.page.ts +++ b/demo/angular/src/app/flow/flow.page.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, inject } from '@angular/core'; import { ITestItems } from '../shared/interfaces'; import { PaymentFlowEventsEnum, Stripe } from '@capacitor-community/stripe'; import { PluginListenerHandle } from '@capacitor/core'; @@ -100,13 +100,16 @@ const cancelPathItems: ITestItems[] = [ ], }) export class FlowPage { + private http = inject(HttpClient); + private helper = inject(HelperService); + public eventItems: ITestItems[] = []; private readonly listenerHandlers: PluginListenerHandle[] = []; - constructor( - private http: HttpClient, - private helper: HelperService, - ) { + /** Inserted by Angular inject() migration for backwards compatibility */ + constructor(...args: unknown[]); + + constructor() { addIcons({ playOutline, notificationsCircleOutline, checkmarkCircle }); } diff --git a/demo/angular/src/app/identity/identity.page.ts b/demo/angular/src/app/identity/identity.page.ts index 75636e27..57f58cb8 100644 --- a/demo/angular/src/app/identity/identity.page.ts +++ b/demo/angular/src/app/identity/identity.page.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, inject } from '@angular/core'; import { ITestItems } from '../shared/interfaces'; import { IdentityVerificationSheetEventsEnum, @@ -102,13 +102,16 @@ const cancelPathItems: ITestItems[] = [ ], }) export class IdentityPage { + private http = inject(HttpClient); + private helper = inject(HelperService); + public eventItems: ITestItems[] = []; private readonly listenerHandlers: PluginListenerHandle[] = []; - constructor( - private http: HttpClient, - private helper: HelperService, - ) { + /** Inserted by Angular inject() migration for backwards compatibility */ + constructor(...args: unknown[]); + + constructor() { addIcons({ playOutline, notificationsCircleOutline, checkmarkCircle }); } diff --git a/demo/angular/src/app/shared/helper.service.ts b/demo/angular/src/app/shared/helper.service.ts index 160a3893..b114ad72 100644 --- a/demo/angular/src/app/shared/helper.service.ts +++ b/demo/angular/src/app/shared/helper.service.ts @@ -1,11 +1,16 @@ -import { Injectable, NgZone } from '@angular/core'; +import { Injectable, NgZone, inject } from '@angular/core'; import { ITestItems } from './interfaces'; @Injectable({ providedIn: 'root', }) export class HelperService { - constructor(private zone: NgZone) {} + private zone = inject(NgZone); + + /** Inserted by Angular inject() migration for backwards compatibility */ + constructor(...args: unknown[]); + + constructor() {} /** * items is not Deep Copy, this is substitution diff --git a/demo/angular/src/app/sheet/sheet.page.ts b/demo/angular/src/app/sheet/sheet.page.ts index 91528c95..84901ae0 100644 --- a/demo/angular/src/app/sheet/sheet.page.ts +++ b/demo/angular/src/app/sheet/sheet.page.ts @@ -1,4 +1,4 @@ -import { Component } from '@angular/core'; +import { Component, inject } from '@angular/core'; import { PaymentSheetEventsEnum, Stripe } from '@capacitor-community/stripe'; import { ITestItems } from '../shared/interfaces'; import { environment } from '../../environments/environment'; @@ -89,13 +89,16 @@ const cancelPathItems: ITestItems[] = [ ], }) export class SheetPage { + private http = inject(HttpClient); + private helper = inject(HelperService); + public eventItems: ITestItems[] = []; private readonly listenerHandlers: PluginListenerHandle[] = []; - constructor( - private http: HttpClient, - private helper: HelperService, - ) { + /** Inserted by Angular inject() migration for backwards compatibility */ + constructor(...args: unknown[]); + + constructor() { addIcons({ playOutline, notificationsCircleOutline, checkmarkCircle }); } diff --git a/demo/angular/src/app/terminal/terminal.page.ts b/demo/angular/src/app/terminal/terminal.page.ts index f42bba95..d28d6ba5 100644 --- a/demo/angular/src/app/terminal/terminal.page.ts +++ b/demo/angular/src/app/terminal/terminal.page.ts @@ -60,6 +60,9 @@ import { updateDeviceUpdateItems } from './updateDeviceUpdateItems'; ], }) export class TerminalPage { + private http = inject(HttpClient); + private helper = inject(HelperService); + public eventItems: ITestItems[] = []; public terminalConnectTypes = TerminalConnectTypes; public simulateReaderUpdate = SimulateReaderUpdate; @@ -68,10 +71,10 @@ export class TerminalPage { public readonly platform = inject(Platform); private readonly alertCtrl = inject(AlertController); - constructor( - private http: HttpClient, - private helper: HelperService, - ) { + /** Inserted by Angular inject() migration for backwards compatibility */ + constructor(...args: unknown[]); + + constructor() { addIcons({ playOutline, notificationsCircleOutline, checkmarkCircle }); } From ce7795f3e71832787e19bcb535db8437d03dac58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Mon, 8 Sep 2025 17:04:15 +0900 Subject: [PATCH 30/45] chore --- demo/angular/package.json | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/demo/angular/package.json b/demo/angular/package.json index e17f4674..29aaf4fd 100644 --- a/demo/angular/package.json +++ b/demo/angular/package.json @@ -45,17 +45,16 @@ "@ionic/angular-toolkit": "^10.0.0", "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", - "@types/node": "^12.11.1", "angular-eslint": "20.2.0", "eslint": "^9.28.0", - "jasmine-core": "~3.8.0", + "jasmine-core": "~4.6.0", "jasmine-spec-reporter": "~5.0.0", - "karma": "~6.3.16", - "karma-chrome-launcher": "~3.1.0", - "karma-coverage": "~2.0.3", + "karma": "^6.4.0", + "karma-chrome-launcher": "~3.2.0", + "karma-coverage": "~2.2.0", "karma-coverage-istanbul-reporter": "~3.0.2", - "karma-jasmine": "~4.0.0", - "karma-jasmine-html-reporter": "^1.5.0", + "karma-jasmine": "~5.1.0", + "karma-jasmine-html-reporter": "~2.1.0", "prettier": "^3.5.3", "protractor": "~7.0.0", "typescript": "^5.8.3", From e5ff354480667cbb53dcf46fd7d148efb2ba6e0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Mon, 8 Sep 2025 18:58:04 +0900 Subject: [PATCH 31/45] =?UTF-8?q?chore():=20bluetooth=E3=82=92new=20zealan?= =?UTF-8?q?d=E3=81=AB=E5=A4=89=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/angular/src/app/terminal/terminal.page.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/demo/angular/src/app/terminal/terminal.page.ts b/demo/angular/src/app/terminal/terminal.page.ts index d28d6ba5..0db2928a 100644 --- a/demo/angular/src/app/terminal/terminal.page.ts +++ b/demo/angular/src/app/terminal/terminal.page.ts @@ -229,7 +229,7 @@ export class TerminalPage { await StripeTerminal.discoverReaders({ type: readerType, - locationId: [TerminalConnectTypes.Usb].includes(readerType) + locationId: [TerminalConnectTypes.Usb, TerminalConnectTypes.Bluetooth].includes(readerType) ? 'tml_Ff37mAmk1XdBYT' : 'tml_FOUOdQVIxvVdvN', }).catch((e) => { @@ -254,7 +254,7 @@ export class TerminalPage { await StripeTerminal.discoverReaders({ type: readerType, - locationId: [TerminalConnectTypes.Usb].includes(readerType) + locationId: [TerminalConnectTypes.Usb, TerminalConnectTypes.Bluetooth].includes(readerType) ? 'tml_Ff37mAmk1XdBYT' // Auckland, New Zealand : 'tml_FOUOdQVIxvVdvN', // San Francisco, CA 94110 bluetoothScanWaitTime: 2000, @@ -384,7 +384,7 @@ export class TerminalPage { await StripeTerminal.discoverReaders({ type: readerType, - locationId: [TerminalConnectTypes.Usb].includes(readerType) + locationId: [TerminalConnectTypes.Usb, TerminalConnectTypes.Bluetooth].includes(readerType) ? 'tml_Ff37mAmk1XdBYT' // Auckland, New Zealand : 'tml_FOUOdQVIxvVdvN', // San Francisco, CA 94110 }).catch((e) => { From 4829be8f218abb10bdd845376e0b157a2ceaff74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Mon, 8 Sep 2025 19:48:37 +0900 Subject: [PATCH 32/45] =?UTF-8?q?chore():=208.7.3=E3=81=AB=E3=82=A2?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=83=87=E3=83=BC=E3=83=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/angular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/angular/package.json b/demo/angular/package.json index 29aaf4fd..b8ee5cc9 100644 --- a/demo/angular/package.json +++ b/demo/angular/package.json @@ -27,7 +27,7 @@ "@capacitor/android": "^7.0.0", "@capacitor/core": "^7.0.0", "@capacitor/ios": "^7.0.0", - "@ionic/angular": "^8.5.6", + "@ionic/angular": "^8.7.3", "rxjs": "~7.5.0", "stripe-pwa-elements": "^3.0.0-0", "tslib": "^2.3.0", From de45d324e74225c4f219c8a37c9eb1045d3cfe37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 10 Sep 2025 18:38:34 +0900 Subject: [PATCH 33/45] chore --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d59271fb..9fcbe1a2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,7 +22,7 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-${{ steps.setup_node.outputs.node-version }}-npm-${{ hashFiles('**/package-lock.json') }}-v1 + key: ${{ runner.os }}-node-${{ steps.setup_node.outputs.node-version }}-npm-${{ hashFiles('**/package-lock.json') }}-v2 - name: Build Payment package run: npm install && npm run build From 7d156ce85d7c64729c52bbc05dd744e00d2938e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 10 Sep 2025 18:42:59 +0900 Subject: [PATCH 34/45] chore(): npm i typescript@5.8.3 --save-exact https://github.com/ionic-team/ionic-framework/issues/30650 --- demo/angular/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/angular/package.json b/demo/angular/package.json index b8ee5cc9..cce77c45 100644 --- a/demo/angular/package.json +++ b/demo/angular/package.json @@ -57,7 +57,7 @@ "karma-jasmine-html-reporter": "~2.1.0", "prettier": "^3.5.3", "protractor": "~7.0.0", - "typescript": "^5.8.3", + "typescript": "5.8.3", "typescript-eslint": "^8.33.1" }, "description": "An Ionic project" From bac68d32f299f8e40aadd13b1636722fc9441c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 10 Sep 2025 18:52:34 +0900 Subject: [PATCH 35/45] 7.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf2405d2..69b73a22 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0", + "version": "7.2.1", "engines": { "node": ">=20.0.0" }, From 61b0c2251303a7634174015dc3258fa688c6369a Mon Sep 17 00:00:00 2001 From: jcesarmobile Date: Fri, 12 Sep 2025 15:04:31 +0200 Subject: [PATCH 36/45] refactor(ios): remove unused code --- .../PaymentFlow/PaymentFlowExecutor.swift | 12 +++++------- .../PaymentSheet/PaymentSheetExecutor.swift | 12 +++++------- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift index b3e93ef3..5da29721 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift @@ -40,13 +40,11 @@ class PaymentFlowExecutor: NSObject { configuration.returnURL = returnURL } - if #available(iOS 13.0, *) { - let style = call.getString("style") ?? "" - if style == "alwaysLight" { - configuration.style = .alwaysLight - } else if style == "alwaysDark" { - configuration.style = .alwaysDark - } + let style = call.getString("style") ?? "" + if style == "alwaysLight" { + configuration.style = .alwaysLight + } else if style == "alwaysDark" { + configuration.style = .alwaysDark } let applePayMerchantId = call.getString("applePayMerchantId") ?? "" diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift index 6da6fb9f..9e007431 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift @@ -40,13 +40,11 @@ class PaymentSheetExecutor: NSObject { configuration.returnURL = returnURL } - if #available(iOS 13.0, *) { - let style = call.getString("style") ?? "" - if style == "alwaysLight" { - configuration.style = .alwaysLight - } else if style == "alwaysDark" { - configuration.style = .alwaysDark - } + let style = call.getString("style") ?? "" + if style == "alwaysLight" { + configuration.style = .alwaysLight + } else if style == "alwaysDark" { + configuration.style = .alwaysDark } let applePayMerchantId = call.getString("applePayMerchantId") ?? "" From da631991158ef771b8187cda4da12dcd648f9796 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 19 Nov 2025 17:13:43 +0900 Subject: [PATCH 37/45] released --- packages/identity/package-lock.json | 4 ++-- packages/identity/package.json | 2 +- packages/payment/package-lock.json | 4 ++-- packages/payment/package.json | 2 +- packages/terminal/package-lock.json | 4 ++-- packages/terminal/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/identity/package-lock.json b/packages/identity/package-lock.json index c0b4320b..202cf554 100644 --- a/packages/identity/package-lock.json +++ b/packages/identity/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0", + "version": "7.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0", + "version": "7.2.1", "license": "MIT", "dependencies": { "@stripe/stripe-js": "^2.1.11" diff --git a/packages/identity/package.json b/packages/identity/package.json index 7d7c4e69..3039e3a3 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.0", + "version": "7.2.1", "engines": { "node": ">=20.0.0" }, diff --git a/packages/payment/package-lock.json b/packages/payment/package-lock.json index bd52d66f..6d6a24fb 100644 --- a/packages/payment/package-lock.json +++ b/packages/payment/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0", + "version": "7.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe", - "version": "7.2.0", + "version": "7.2.1", "license": "MIT", "devDependencies": { "@capacitor/android": "^7.0.0", diff --git a/packages/payment/package.json b/packages/payment/package.json index 9f19422b..721d06a8 100644 --- a/packages/payment/package.json +++ b/packages/payment/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.0", + "version": "7.2.1", "engines": { "node": ">=20.0.0" }, diff --git a/packages/terminal/package-lock.json b/packages/terminal/package-lock.json index 36525cf0..91c66196 100644 --- a/packages/terminal/package-lock.json +++ b/packages/terminal/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0", + "version": "7.2.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0", + "version": "7.2.1", "license": "MIT", "dependencies": { "@stripe/terminal-js": "^0.24.0" diff --git a/packages/terminal/package.json b/packages/terminal/package.json index 51389d88..9367ea98 100644 --- a/packages/terminal/package.json +++ b/packages/terminal/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.0", + "version": "7.2.1", "engines": { "node": ">=20.0.0" }, From 1385d3a2c00039d77bf0f08afdf86c802d1a0fc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 19 Nov 2025 17:15:26 +0900 Subject: [PATCH 38/45] chore: update package version --- demo/angular/package.json | 24 ++++++++++++------------ package.json | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/demo/angular/package.json b/demo/angular/package.json index cce77c45..1367314d 100644 --- a/demo/angular/package.json +++ b/demo/angular/package.json @@ -15,12 +15,12 @@ }, "private": true, "dependencies": { - "@angular/common": "^20.2.4", - "@angular/core": "^20.2.4", - "@angular/forms": "^20.2.4", - "@angular/platform-browser": "^20.2.4", - "@angular/platform-browser-dynamic": "^20.2.4", - "@angular/router": "^20.2.4", + "@angular/common": "^20.3.12", + "@angular/core": "^20.3.12", + "@angular/forms": "^20.3.12", + "@angular/platform-browser": "^20.3.12", + "@angular/platform-browser-dynamic": "^20.3.12", + "@angular/router": "^20.3.12", "@capacitor-community/stripe": "file:../../packages/payment", "@capacitor-community/stripe-identity": "file:../../packages/identity", "@capacitor-community/stripe-terminal": "file:../../packages/terminal", @@ -34,18 +34,18 @@ "zone.js": "~0.15.0" }, "devDependencies": { - "@angular/build": "^20.2.2", - "@angular/cli": "^20.2.2", - "@angular/compiler": "^20.2.4", - "@angular/compiler-cli": "^20.2.4", - "@angular/language-service": "^20.2.4", + "@angular/build": "^20.3.10", + "@angular/cli": "^20.3.10", + "@angular/compiler": "^20.3.12", + "@angular/compiler-cli": "^20.3.12", + "@angular/language-service": "^20.3.12", "@capacitor/cli": "^7.0.0", "@eslint/eslintrc": "^3.3.1", "@eslint/js": "^9.25.1", "@ionic/angular-toolkit": "^10.0.0", "@types/jasmine": "~3.6.0", "@types/jasminewd2": "~2.0.3", - "angular-eslint": "20.2.0", + "angular-eslint": "20.6.0", "eslint": "^9.28.0", "jasmine-core": "~4.6.0", "jasmine-spec-reporter": "~5.0.0", diff --git a/package.json b/package.json index 69b73a22..e116b06b 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "url": "git+https://github.com/capacitor-community/stripe.git" }, "devDependencies": { - "np": "^7.7.0", + "np": "^10.2.0", "write-pkg": "^6.0.0" } } From a281263b8171adcfa18aa6cda6c426b9e1489037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 19 Nov 2025 18:32:00 +0900 Subject: [PATCH 39/45] feat(payment): update to 25.x https://github.com/stripe/stripe-ios/blob/master/MIGRATING.md --- packages/payment/CapacitorCommunityStripe.podspec | 4 ++-- packages/payment/Package.swift | 2 +- packages/payment/android/build.gradle | 2 +- .../StripePlugin/ApplePay/ApplePayExecutor.swift | 12 ++++++------ 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/payment/CapacitorCommunityStripe.podspec b/packages/payment/CapacitorCommunityStripe.podspec index c3bf1821..ee9efc66 100644 --- a/packages/payment/CapacitorCommunityStripe.podspec +++ b/packages/payment/CapacitorCommunityStripe.podspec @@ -13,7 +13,7 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripePaymentSheet', '~> 24.16.1' - s.dependency 'StripeApplePay', '~> 24.16.1' + s.dependency 'StripePaymentSheet', '~> 25.1.0' + s.dependency 'StripeApplePay', '~> 25.1.0' s.swift_version = '5.1' end diff --git a/packages/payment/Package.swift b/packages/payment/Package.swift index 268e19cc..65db86a2 100644 --- a/packages/payment/Package.swift +++ b/packages/payment/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.16.1") + .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "25.1.0") ], targets: [ .target( diff --git a/packages/payment/android/build.gradle b/packages/payment/android/build.gradle index 7e73392e..47d28341 100644 --- a/packages/payment/android/build.gradle +++ b/packages/payment/android/build.gradle @@ -5,7 +5,7 @@ ext { androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1' playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+' - stripeAndroidVersion = project.hasProperty('stripeAndroidVersion') ? rootProject.ext.stripeAndroidVersion : '21.18.+' + stripeAndroidVersion = project.hasProperty('stripeAndroidVersion') ? rootProject.ext.stripeAndroidVersion : '22.2.+' gsonVersion = project.hasProperty('gsonVersion') ? rootProject.ext.gsonVersion : '2.10.+' } diff --git a/packages/payment/ios/Sources/StripePlugin/ApplePay/ApplePayExecutor.swift b/packages/payment/ios/Sources/StripePlugin/ApplePay/ApplePayExecutor.swift index 1db77a34..312e0e56 100644 --- a/packages/payment/ios/Sources/StripePlugin/ApplePay/ApplePayExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/ApplePay/ApplePayExecutor.swift @@ -153,12 +153,12 @@ extension ApplePayExecutor { } } - func applePayContext(_ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: StripeAPI.PaymentMethod, paymentInformation: PKPayment, completion: @escaping STPIntentClientSecretCompletionBlock) { - let clientSecret = self.appleClientSecret - let error: String? = nil // Call the completion block with the client secret or an error - completion(clientSecret, error as? Error) - let jsonArray = self.transformPKContactToJSON(contact: paymentInformation.shippingContact) - self.plugin?.notifyListeners(ApplePayEvents.DidCreatePaymentMethod.rawValue, data: ["contact": jsonArray]) + func applePayContext(_ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: StripeAPI.PaymentMethod, paymentInformation: PKPayment) async throws -> String { + return try await withCheckedThrowingContinuation { continuation in + continuation.resume(with: .success(self.appleClientSecret)) + let jsonArray = self.transformPKContactToJSON(contact: paymentInformation.shippingContact) + self.plugin?.notifyListeners(ApplePayEvents.DidCreatePaymentMethod.rawValue, data: ["contact": jsonArray]) + } } func applePayContext(_ context: STPApplePayContext, didCompleteWith status: STPApplePayContext.PaymentStatus, error: Error?) { From 9cf632472a66353d46386acb1599f3dd7d9f8933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 19 Nov 2025 18:34:04 +0900 Subject: [PATCH 40/45] feat(packages): update library currently --- demo/angular/ios/App/Podfile.lock | 90 +++++++++---------- .../CapacitorCommunityStripeIdentity.podspec | 2 +- packages/identity/Package.swift | 2 +- packages/identity/android/build.gradle | 2 +- .../CapacitorCommunityStripeTerminal.podspec | 2 +- packages/terminal/Package.swift | 2 +- packages/terminal/android/build.gradle | 6 +- 7 files changed, 53 insertions(+), 53 deletions(-) diff --git a/demo/angular/ios/App/Podfile.lock b/demo/angular/ios/App/Podfile.lock index 4e9757e0..80cdfc94 100644 --- a/demo/angular/ios/App/Podfile.lock +++ b/demo/angular/ios/App/Podfile.lock @@ -1,43 +1,43 @@ PODS: - Capacitor (7.0.1): - CapacitorCordova - - CapacitorCommunityStripe (7.2.0): + - CapacitorCommunityStripe (7.2.1): - Capacitor - - StripeApplePay (~> 24.16.1) - - StripePaymentSheet (~> 24.16.1) - - CapacitorCommunityStripeIdentity (7.2.0): + - StripeApplePay (~> 25.1.0) + - StripePaymentSheet (~> 25.1.0) + - CapacitorCommunityStripeIdentity (7.2.1): - Capacitor - - StripeIdentity (~> 24.16.1) - - CapacitorCommunityStripeTerminal (7.2.0): + - StripeIdentity (~> 25.1.0) + - CapacitorCommunityStripeTerminal (7.2.1): - Capacitor - - StripeTerminal (~> 4.7.0) + - StripeTerminal (= 4.7.3) - CapacitorCordova (7.0.1) - - StripeApplePay (24.16.2): - - StripeCore (= 24.16.2) - - StripeCameraCore (24.16.2): - - StripeCore (= 24.16.2) - - StripeCore (24.16.2) - - StripeIdentity (24.16.2): - - StripeCameraCore (= 24.16.2) - - StripeCore (= 24.16.2) - - StripeUICore (= 24.16.2) - - StripePayments (24.16.2): - - StripeCore (= 24.16.2) - - StripePayments/Stripe3DS2 (= 24.16.2) - - StripePayments/Stripe3DS2 (24.16.2): - - StripeCore (= 24.16.2) - - StripePaymentSheet (24.16.2): - - StripeApplePay (= 24.16.2) - - StripeCore (= 24.16.2) - - StripePayments (= 24.16.2) - - StripePaymentsUI (= 24.16.2) - - StripePaymentsUI (24.16.2): - - StripeCore (= 24.16.2) - - StripePayments (= 24.16.2) - - StripeUICore (= 24.16.2) - - StripeTerminal (4.7.0) - - StripeUICore (24.16.2): - - StripeCore (= 24.16.2) + - StripeApplePay (25.1.0): + - StripeCore (= 25.1.0) + - StripeCameraCore (25.1.0): + - StripeCore (= 25.1.0) + - StripeCore (25.1.0) + - StripeIdentity (25.1.0): + - StripeCameraCore (= 25.1.0) + - StripeCore (= 25.1.0) + - StripeUICore (= 25.1.0) + - StripePayments (25.1.0): + - StripeCore (= 25.1.0) + - StripePayments/Stripe3DS2 (= 25.1.0) + - StripePayments/Stripe3DS2 (25.1.0): + - StripeCore (= 25.1.0) + - StripePaymentSheet (25.1.0): + - StripeApplePay (= 25.1.0) + - StripeCore (= 25.1.0) + - StripePayments (= 25.1.0) + - StripePaymentsUI (= 25.1.0) + - StripePaymentsUI (25.1.0): + - StripeCore (= 25.1.0) + - StripePayments (= 25.1.0) + - StripeUICore (= 25.1.0) + - StripeTerminal (4.7.3) + - StripeUICore (25.1.0): + - StripeCore (= 25.1.0) DEPENDENCIES: - "Capacitor (from `../../node_modules/@capacitor/ios`)" @@ -72,19 +72,19 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Capacitor: de199cba6c8b20995428ad0b7cb0bc6ca625ffd4 - CapacitorCommunityStripe: 82fdfc30b65aee21b0a40ce2529068edf4ffe423 - CapacitorCommunityStripeIdentity: 5f32c804b673fe6679fdfdb176a934f51696ac39 - CapacitorCommunityStripeTerminal: 59cfad2cecc0781d7f4a84529f65e3e161a4fcaa + CapacitorCommunityStripe: 684052203ba8abd2cf74b464df0603ab3e6e464d + CapacitorCommunityStripeIdentity: f8dbf6be3961097ba7b3075258776bccc3ec2f81 + CapacitorCommunityStripeTerminal: 23da4329032aa23d3bc40b630a36dc978f664496 CapacitorCordova: 63d476958d5022d76f197031e8b7ea3519988c64 - StripeApplePay: 66dc43ec1284904a2cf4c5a0906f86296d23afbd - StripeCameraCore: 4bfdf6b43536346102c61ae46c634f275deb5b78 - StripeCore: f3a62397cecaf4da1827bcf07de7312ec1f3b96e - StripeIdentity: 1ed535d6873f17781f53552a7e9397b90ccdfab3 - StripePayments: b3e7817d821ceedd469008d17d94a1494ff1b624 - StripePaymentSheet: f4f5b71cef665f05a185c29b2d4b59e7dd8c117d - StripePaymentsUI: d489e73bf790da1c74e642021475b1a09a4a4500 - StripeTerminal: 960112008f29d0ec0ecf69e26856b91a0dc2b722 - StripeUICore: 723e5024c83acb5ba5e71335e110a471b182a74d + StripeApplePay: baa0634219c168df6a50c7d76ae0d9bff39dbaf9 + StripeCameraCore: e12d90fd62abcf5a1cb9bb8a85d72e5cbb7e7666 + StripeCore: 6078969b9c9b205081bc8d66991e2a6d4bd3e994 + StripeIdentity: 7d40804f948a38e6c99fa53d0400a3d955758a00 + StripePayments: b80892b98f25f4ee890773755f2940727aefcb57 + StripePaymentSheet: 77673b324a5cc5c9327f5c8cfcdf13d2f6495dde + StripePaymentsUI: 057811da34b69e89a06ec1962fffe4247b98ee92 + StripeTerminal: b9e92913da8a08ff5c62af75056ad39bf8b02ac6 + StripeUICore: 4f47fdd3895f23c6e02879ef27126f62af7058ff PODFILE CHECKSUM: c75ca255b97ee461832b20e6cdf6d1da533d4019 diff --git a/packages/identity/CapacitorCommunityStripeIdentity.podspec b/packages/identity/CapacitorCommunityStripeIdentity.podspec index 3e40e5ad..bdad91b9 100644 --- a/packages/identity/CapacitorCommunityStripeIdentity.podspec +++ b/packages/identity/CapacitorCommunityStripeIdentity.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripeIdentity', '~> 24.16.1' + s.dependency 'StripeIdentity', '~> 25.1.0' s.swift_version = '5.1' end diff --git a/packages/identity/Package.swift b/packages/identity/Package.swift index 3c0c2f85..834fc156 100644 --- a/packages/identity/Package.swift +++ b/packages/identity/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "24.16.1") + .package(url: "https://github.com/stripe/stripe-ios-spm.git", exact: "25.1.0") ], targets: [ .target( diff --git a/packages/identity/android/build.gradle b/packages/identity/android/build.gradle index 73d9ebcd..d048bd10 100644 --- a/packages/identity/android/build.gradle +++ b/packages/identity/android/build.gradle @@ -5,7 +5,7 @@ ext { androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.6.1' playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+' - identityVersion = project.hasProperty('identityVersion') ? rootProject.ext.identityVersion : '21.18.+' + identityVersion = project.hasProperty('identityVersion') ? rootProject.ext.identityVersion : '22.2.+' } buildscript { diff --git a/packages/terminal/CapacitorCommunityStripeTerminal.podspec b/packages/terminal/CapacitorCommunityStripeTerminal.podspec index 6992411e..0c1a714b 100644 --- a/packages/terminal/CapacitorCommunityStripeTerminal.podspec +++ b/packages/terminal/CapacitorCommunityStripeTerminal.podspec @@ -13,6 +13,6 @@ Pod::Spec.new do |s| s.source_files = 'ios/Sources/**/*.{swift,h,m,c,cc,mm,cpp}' s.ios.deployment_target = '14.0' s.dependency 'Capacitor' - s.dependency 'StripeTerminal', '~> 4.7.0' + s.dependency 'StripeTerminal', '4.7.3' s.swift_version = '5.1' end diff --git a/packages/terminal/Package.swift b/packages/terminal/Package.swift index 9f75f129..2c088442 100644 --- a/packages/terminal/Package.swift +++ b/packages/terminal/Package.swift @@ -11,7 +11,7 @@ let package = Package( ], dependencies: [ .package(url: "https://github.com/ionic-team/capacitor-swift-pm.git", from: "7.0.0"), - .package(url: "https://github.com/stripe/stripe-terminal-ios.git", exact: "4.7.0") + .package(url: "https://github.com/stripe/stripe-terminal-ios.git", exact: "4.7.3") ], targets: [ .target( diff --git a/packages/terminal/android/build.gradle b/packages/terminal/android/build.gradle index 7ec626f5..438ea3a6 100644 --- a/packages/terminal/android/build.gradle +++ b/packages/terminal/android/build.gradle @@ -6,9 +6,9 @@ ext { playServicesWalletVersion = project.hasProperty('playServicesWalletVersion') ? rootProject.ext.playServicesWalletVersion : '19.2.+' volleyVersion = project.hasProperty('volleyVersion') ? rootProject.ext.volleyVersion : '1.2.1' - stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '4.5.0' - stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '4.5.0' - stripeterminalHandoffClientVersion = project.hasProperty('stripeterminalHandoffClientVersion') ? rootProject.ext.stripeterminalHandoffClientVersion : '4.5.0' + stripeterminalTapToPayVersion = project.hasProperty('stripeterminalTapToPayVersion') ? rootProject.ext.stripeterminalTapToPayVersion : '4.7.+' + stripeterminalCoreVersion = project.hasProperty('stripeterminalCoreVersion') ? rootProject.ext.stripeterminalCoreVersion : '4.7.+' + stripeterminalHandoffClientVersion = project.hasProperty('stripeterminalHandoffClientVersion') ? rootProject.ext.stripeterminalHandoffClientVersion : '4.7.+' } buildscript { From ed8cfb4386dd1109b5f8a8416a0681f22bc14dd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Wed, 19 Nov 2025 18:57:41 +0900 Subject: [PATCH 41/45] chore(demo): remove constructor args --- demo/angular/src/app/terminal/terminal.page.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/angular/src/app/terminal/terminal.page.ts b/demo/angular/src/app/terminal/terminal.page.ts index 0db2928a..5cd70c05 100644 --- a/demo/angular/src/app/terminal/terminal.page.ts +++ b/demo/angular/src/app/terminal/terminal.page.ts @@ -72,7 +72,7 @@ export class TerminalPage { private readonly alertCtrl = inject(AlertController); /** Inserted by Angular inject() migration for backwards compatibility */ - constructor(...args: unknown[]); + constructor(); constructor() { addIcons({ playOutline, notificationsCircleOutline, checkmarkCircle }); From 77174db4b68e5d09430d0b9f9d6087d7f9c044d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Thu, 20 Nov 2025 16:27:16 +0900 Subject: [PATCH 42/45] fix(ci): update run macos to 15 --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9fcbe1a2..c7b22198 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -138,7 +138,7 @@ jobs: working-directory: ./packages/terminal verify-payment-ios: - runs-on: macos-14 + runs-on: macos-15 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -157,7 +157,7 @@ jobs: working-directory: ./packages/payment verify-identity-ios: - runs-on: macos-14 + runs-on: macos-15 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 @@ -176,7 +176,7 @@ jobs: working-directory: ./packages/identity verify-terminal-ios: - runs-on: macos-14 + runs-on: macos-15 steps: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 From fccec5a779be633294a47d71f5b6cec9a4ccbb71 Mon Sep 17 00:00:00 2001 From: Masahiko Sakakibara Date: Fri, 21 Nov 2025 10:29:16 +0900 Subject: [PATCH 43/45] feat(): support paymentMethodLayout (#452) * feat(payment): support payment method layout * refactor(payment): use PaymentSheet.Configuration.Builder * Update packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * chore(payment): change to generate a Builder each time * Update packages/payment/src/shared/index.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- packages/payment/README.md | 78 ++++++++++--------- .../stripe/paymentflow/PaymentFlowExecutor.kt | 52 ++++++------- .../paymentsheet/PaymentSheetExecutor.kt | 48 ++++++------ .../PaymentFlow/PaymentFlowExecutor.swift | 13 +++- .../PaymentSheet/PaymentSheetExecutor.swift | 11 ++- packages/payment/src/shared/index.ts | 6 ++ 6 files changed, 115 insertions(+), 93 deletions(-) diff --git a/packages/payment/README.md b/packages/payment/README.md index eefe339e..7fe79936 100644 --- a/packages/payment/README.md +++ b/packages/payment/README.md @@ -683,25 +683,26 @@ addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: stri #### CreatePaymentFlowOption -| Prop | Type | Description | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | -| **`shippingDetails`** | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | -| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | -| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | -| **`customerId`** | string | Any documentation call 'customer' | | -| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | -| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | -| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | -| **`GooglePayIsTesting`** | boolean | | false, | -| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | -| **`merchantDisplayName`** | string | | "App Name" | -| **`returnURL`** | string | | "" | -| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | -| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | -| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | +| Prop | Type | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | +| **`shippingDetails`** | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | +| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | +| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | +| **`customerId`** | string | Any documentation call 'customer' | | +| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | +| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | +| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | +| **`GooglePayIsTesting`** | boolean | | false, | +| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | +| **`merchantDisplayName`** | string | | "App Name" | +| **`returnURL`** | string | | "" | +| **`paymentMethodLayout`** | 'automatic' \| 'horizontal' \| 'vertical' | | "automatic" | +| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | +| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | +| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | #### DefaultBillingDetails @@ -748,25 +749,26 @@ addListener(eventName: PaymentSheetEventsEnum.Failed, listenerFunc: (error: stri #### CreatePaymentSheetOption -| Prop | Type | Description | Default | -| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------- | -| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | -| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | -| **`shippingDetails`** | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | -| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | -| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | -| **`customerId`** | string | Any documentation call 'customer' | | -| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | -| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | -| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | -| **`GooglePayIsTesting`** | boolean | | false, | -| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | -| **`merchantDisplayName`** | string | | "App Name" | -| **`returnURL`** | string | | "" | -| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | -| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | -| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | +| Prop | Type | Description | Default | +| ------------------------------------------- | ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------ | +| **`paymentIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`setupIntentClientSecret`** | string | Any documentation call 'paymentIntent' Set paymentIntentClientSecret or setupIntentClientSecret | | +| **`defaultBillingDetails`** | DefaultBillingDetails | Optional defaultBillingDetails This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#set-default-billing-details | | +| **`shippingDetails`** | AddressDetails | Optional shippingDetails This is android only. ios requires an address element. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=android#prefill-addresses | | +| **`billingDetailsCollectionConfiguration`** | BillingDetailsCollectionConfiguration | Optional billingDetailsCollectionConfiguration This is ios/android only. not support web. https://docs.stripe.com/payments/mobile/collect-addresses?payment-ui=mobile&platform=ios#customize-billing-details-collection | | +| **`customerEphemeralKeySecret`** | string | Any documentation call 'ephemeralKey' | | +| **`customerId`** | string | Any documentation call 'customer' | | +| **`enableApplePay`** | boolean | If you set payment method ApplePay, this set true | false | +| **`applePayMerchantId`** | string | If set enableApplePay false, Plugin ignore here. | | +| **`enableGooglePay`** | boolean | If you set payment method GooglePay, this set true | false | +| **`GooglePayIsTesting`** | boolean | | false, | +| **`countryCode`** | string | use ApplePay and GooglePay. If set enableApplePay and enableGooglePay false, Plugin ignore here. | "US" | +| **`merchantDisplayName`** | string | | "App Name" | +| **`returnURL`** | string | | "" | +| **`paymentMethodLayout`** | 'automatic' \| 'horizontal' \| 'vertical' | | "automatic" | +| **`style`** | 'alwaysLight' \| 'alwaysDark' | iOS Only | undefined | +| **`withZipCode`** | boolean | Platform: Web only Show ZIP code field. | true | +| **`currencyCode`** | string | use GooglePay. Required if enableGooglePay is true for setupIntents. | "USD" | ### Type Aliases diff --git a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt index 4f849f4f..f5f222ba 100644 --- a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt +++ b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentflow/PaymentFlowExecutor.kt @@ -10,6 +10,7 @@ import com.getcapacitor.community.stripe.helper.PaymentSheetHelper import com.getcapacitor.community.stripe.models.Executor import com.google.android.gms.common.util.BiConsumer import com.stripe.android.paymentsheet.PaymentSheet +import com.stripe.android.paymentsheet.PaymentSheet.PaymentMethodLayout import com.stripe.android.paymentsheet.PaymentSheetResult import com.stripe.android.paymentsheet.model.PaymentOption @@ -26,8 +27,8 @@ class PaymentFlowExecutor( "PaymentFlowExecutor" ) { var flowController: PaymentSheet.FlowController? = null + private var configurationBuilder: PaymentSheet.Configuration.Builder? = null private val emptyObject = JSObject() - private var paymentConfiguration: PaymentSheet.Configuration? = null init { this.contextSupplier = contextSupplier @@ -39,6 +40,13 @@ class PaymentFlowExecutor( val customerEphemeralKeySecret = call.getString("customerEphemeralKeySecret", null) val customerId = call.getString("customerId", null) + val paymentMethodLayout: PaymentMethodLayout = when (call.getString("paymentMethodLayout", "automatic")) { + "horizontal" -> PaymentMethodLayout.Horizontal + "vertical" -> PaymentMethodLayout.Vertical + "automatic" -> PaymentMethodLayout.Automatic + else -> PaymentMethodLayout.Automatic + } + if (paymentIntentClientSecret == null && setupIntentClientSecret == null) { val errorText = "Invalid Params. This method require paymentIntentClientSecret or setupIntentClientSecret." @@ -79,42 +87,34 @@ class PaymentFlowExecutor( call.getObject("billingDetailsCollectionConfiguration", null) ) - if (!enableGooglePay!!) { - paymentConfiguration = PaymentSheet.Configuration( - merchantDisplayName, - customer, - shippingDetails = shippingDetailsConfiguration, - defaultBillingDetails = defaultBillingDetailsConfiguration, - billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration, - ) - } else { - val GooglePayEnvironment = call.getBoolean("GooglePayIsTesting", false) + configurationBuilder = PaymentSheet.Configuration.Builder(merchantDisplayName) + .customer(customer) + .defaultBillingDetails(defaultBillingDetailsConfiguration) + .shippingDetails(shippingDetailsConfiguration) + .billingDetailsCollectionConfiguration(billingDetailsCollectionConfiguration) + .paymentMethodLayout(paymentMethodLayout) + + if (enableGooglePay!!) { + val googlePayEnvironment = call.getBoolean("GooglePayIsTesting", false)!! var environment: PaymentSheet.GooglePayConfiguration.Environment = PaymentSheet.GooglePayConfiguration.Environment.Production - if (GooglePayEnvironment!!) { + if (googlePayEnvironment) { environment = PaymentSheet.GooglePayConfiguration.Environment.Test } - paymentConfiguration = PaymentSheet.Configuration( - merchantDisplayName, - customer, - shippingDetails = shippingDetailsConfiguration, - defaultBillingDetails = defaultBillingDetailsConfiguration, - billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration, - googlePay = PaymentSheet.GooglePayConfiguration( - environment, - call.getString("countryCode", "US")!!, - call.getString("currencyCode", null) - ) - ) + configurationBuilder!!.googlePay(PaymentSheet.GooglePayConfiguration( + environment, + call.getString("countryCode", "US")!!, + call.getString("currencyCode", null) + )) } if (setupIntentClientSecret != null) { flowController!!.configureWithSetupIntent( setupIntentClientSecret, - paymentConfiguration + configurationBuilder!!.build() ) { success: Boolean, error: Throwable? -> if (success) { notifyListenersFunction.accept( @@ -133,7 +133,7 @@ class PaymentFlowExecutor( } else if (paymentIntentClientSecret != null) { flowController!!.configureWithPaymentIntent( paymentIntentClientSecret, - paymentConfiguration + configurationBuilder!!.build() ) { success: Boolean, error: Throwable? -> if (success) { notifyListenersFunction.accept( diff --git a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt index 1a2bbe2a..521776ce 100644 --- a/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt +++ b/packages/payment/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.kt @@ -10,10 +10,7 @@ import com.getcapacitor.community.stripe.helper.PaymentSheetHelper import com.getcapacitor.community.stripe.models.Executor import com.google.android.gms.common.util.BiConsumer import com.stripe.android.paymentsheet.PaymentSheet -import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration.AddressCollectionMode -import com.stripe.android.paymentsheet.PaymentSheet.BillingDetailsCollectionConfiguration.CollectionMode import com.stripe.android.paymentsheet.PaymentSheetResult -import com.stripe.android.paymentsheet.addresselement.AddressDetails class PaymentSheetExecutor( contextSupplier: Supplier, @@ -28,8 +25,8 @@ class PaymentSheetExecutor( "PaymentSheetExecutor" ) { var paymentSheet: PaymentSheet? = null + private var configurationBuilder: PaymentSheet.Configuration.Builder? = null private val emptyObject = JSObject() - private var paymentConfiguration: PaymentSheet.Configuration? = null private var paymentIntentClientSecret: String? = null private var setupIntentClientSecret: String? = null @@ -45,6 +42,13 @@ class PaymentSheetExecutor( val customerEphemeralKeySecret = call.getString("customerEphemeralKeySecret", null) val customerId = call.getString("customerId", null) + val paymentMethodLayout: PaymentSheet.PaymentMethodLayout = when (call.getString("paymentMethodLayout", "automatic")) { + "horizontal" -> PaymentSheet.PaymentMethodLayout.Horizontal + "vertical" -> PaymentSheet.PaymentMethodLayout.Vertical + "automatic" -> PaymentSheet.PaymentMethodLayout.Automatic + else -> PaymentSheet.PaymentMethodLayout.Automatic + } + if (paymentIntentClientSecret == null && setupIntentClientSecret == null) { val errorText = "Invalid Params. This method require paymentIntentClientSecret or setupIntentClientSecret." @@ -86,36 +90,28 @@ class PaymentSheetExecutor( call.getObject("billingDetailsCollectionConfiguration", null) ) - if (!enableGooglePay!!) { - paymentConfiguration = PaymentSheet.Configuration( - merchantDisplayName, - customer, - shippingDetails = shippingDetailsConfiguration, - defaultBillingDetails = defaultBillingDetailsConfiguration, - billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration - ) - } else { - val googlePayEnvironment = call.getBoolean("GooglePayIsTesting", false) + configurationBuilder = PaymentSheet.Configuration.Builder(merchantDisplayName) + .customer(customer) + .defaultBillingDetails(defaultBillingDetailsConfiguration) + .shippingDetails(shippingDetailsConfiguration) + .billingDetailsCollectionConfiguration(billingDetailsCollectionConfiguration) + .paymentMethodLayout(paymentMethodLayout) + + if (enableGooglePay!!) { + val googlePayEnvironment = call.getBoolean("GooglePayIsTesting", false)!! var environment: PaymentSheet.GooglePayConfiguration.Environment = PaymentSheet.GooglePayConfiguration.Environment.Production - if (googlePayEnvironment!!) { + if (googlePayEnvironment) { environment = PaymentSheet.GooglePayConfiguration.Environment.Test } - paymentConfiguration = PaymentSheet.Configuration( - merchantDisplayName, - customer, - shippingDetails = shippingDetailsConfiguration, - defaultBillingDetails = defaultBillingDetailsConfiguration, - billingDetailsCollectionConfiguration = billingDetailsCollectionConfiguration, - googlePay = PaymentSheet.GooglePayConfiguration( + configurationBuilder!!.googlePay(PaymentSheet.GooglePayConfiguration( environment, call.getString("countryCode", "US")!!, call.getString("currencyCode", null) - ), - ) + )) } notifyListenersFunction.accept(PaymentSheetEvents.Loaded.webEventName, emptyObject) @@ -127,12 +123,12 @@ class PaymentSheetExecutor( if (paymentIntentClientSecret != null) { paymentSheet!!.presentWithPaymentIntent( paymentIntentClientSecret!!, - paymentConfiguration + configurationBuilder!!.build() ) } else { paymentSheet!!.presentWithSetupIntent( setupIntentClientSecret!!, - paymentConfiguration + configurationBuilder!!.build() ) } } catch (ex: Exception) { diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift index 5da29721..d316218b 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentFlow/PaymentFlowExecutor.swift @@ -30,6 +30,15 @@ class PaymentFlowExecutor: NSObject { // MARK: Create a PaymentSheet instance var configuration = PaymentSheet.Configuration() + let paymentMethodLayout = call.getString("paymentMethodLayout") ?? "automatic" + if paymentMethodLayout == "horizontal" { + configuration.paymentMethodLayout = .horizontal + } else if paymentMethodLayout == "vertical" { + configuration.paymentMethodLayout = .vertical + } else { + configuration.paymentMethodLayout = .automatic + } + let merchantDisplayName = call.getString("merchantDisplayName") ?? "" if merchantDisplayName != "" { configuration.merchantDisplayName = merchantDisplayName @@ -59,7 +68,7 @@ class PaymentFlowExecutor: NSObject { if customerId != nil && customerEphemeralKeySecret != nil { configuration.customer = .init(id: customerId!, ephemeralKeySecret: customerEphemeralKeySecret!) } - + let billingDetailsCollectionConfiguration = call.getObject("billingDetailsCollectionConfiguration") ?? nil if billingDetailsCollectionConfiguration != nil { billingDetailsCollectionConfiguration?.forEach({ (key: String, value: JSValue) in @@ -78,7 +87,7 @@ class PaymentFlowExecutor: NSObject { } }) } - + let defaultBillingDetails = call.getObject("defaultBillingDetails") ?? nil if defaultBillingDetails != nil { defaultBillingDetails?.forEach({ (key: String, value: JSValue) in diff --git a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift index 9e007431..8841db5b 100644 --- a/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift +++ b/packages/payment/ios/Sources/StripePlugin/PaymentSheet/PaymentSheetExecutor.swift @@ -30,6 +30,15 @@ class PaymentSheetExecutor: NSObject { // MARK: Create a PaymentSheet instance var configuration = PaymentSheet.Configuration() + let paymentMethodLayout = call.getString("paymentMethodLayout") ?? "automatic" + if paymentMethodLayout == "horizontal" { + configuration.paymentMethodLayout = .horizontal + } else if paymentMethodLayout == "vertical" { + configuration.paymentMethodLayout = .vertical + } else { + configuration.paymentMethodLayout = .automatic + } + let merchantDisplayName = call.getString("merchantDisplayName") ?? "" if merchantDisplayName != "" { configuration.merchantDisplayName = merchantDisplayName @@ -78,7 +87,7 @@ class PaymentSheetExecutor: NSObject { } }) } - + let defaultBillingDetails = call.getObject("defaultBillingDetails") ?? nil if defaultBillingDetails != nil { defaultBillingDetails?.forEach({ (key: String, value: JSValue) in diff --git a/packages/payment/src/shared/index.ts b/packages/payment/src/shared/index.ts index d99c2d9e..d309aa0f 100644 --- a/packages/payment/src/shared/index.ts +++ b/packages/payment/src/shared/index.ts @@ -153,6 +153,12 @@ export interface BasePaymentOption { */ returnURL?: string | undefined; + /** + * @url https://docs.stripe.com/payments/accept-a-payment?platform=android#android-customization + * @default "automatic" + */ + paymentMethodLayout?: 'horizontal' | 'vertical' | 'automatic' | undefined; + /** * iOS Only * @url https://stripe.com/docs/payments/accept-a-payment?platform=ios&ui=payment-sheet#userinterfacestyle From 354aa5f6f4d514c8a8e9fcc16da9aa3ab98044e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 21 Nov 2025 10:34:04 +0900 Subject: [PATCH 44/45] 7.2.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e116b06b..6b60c81b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.1", + "version": "7.2.2", "engines": { "node": ">=20.0.0" }, From ae93e28710ed3c4f8f54910042c16de95cfca378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=A6=8A=E5=8E=9F=E6=98=8C=E5=BD=A6?= Date: Fri, 21 Nov 2025 15:52:21 +0900 Subject: [PATCH 45/45] released --- packages/identity/package-lock.json | 4 ++-- packages/identity/package.json | 2 +- packages/payment/package-lock.json | 4 ++-- packages/payment/package.json | 2 +- packages/terminal/package-lock.json | 4 ++-- packages/terminal/package.json | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/packages/identity/package-lock.json b/packages/identity/package-lock.json index 202cf554..38d93de7 100644 --- a/packages/identity/package-lock.json +++ b/packages/identity/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.1", + "version": "7.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-identity", - "version": "7.2.1", + "version": "7.2.2", "license": "MIT", "dependencies": { "@stripe/stripe-js": "^2.1.11" diff --git a/packages/identity/package.json b/packages/identity/package.json index 3039e3a3..66f2a0aa 100644 --- a/packages/identity/package.json +++ b/packages/identity/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-identity", - "version": "7.2.1", + "version": "7.2.2", "engines": { "node": ">=20.0.0" }, diff --git a/packages/payment/package-lock.json b/packages/payment/package-lock.json index 6d6a24fb..cfe5ccec 100644 --- a/packages/payment/package-lock.json +++ b/packages/payment/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.1", + "version": "7.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe", - "version": "7.2.1", + "version": "7.2.2", "license": "MIT", "devDependencies": { "@capacitor/android": "^7.0.0", diff --git a/packages/payment/package.json b/packages/payment/package.json index 721d06a8..9731928e 100644 --- a/packages/payment/package.json +++ b/packages/payment/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe", - "version": "7.2.1", + "version": "7.2.2", "engines": { "node": ">=20.0.0" }, diff --git a/packages/terminal/package-lock.json b/packages/terminal/package-lock.json index 91c66196..14fcb7f5 100644 --- a/packages/terminal/package-lock.json +++ b/packages/terminal/package-lock.json @@ -1,12 +1,12 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.1", + "version": "7.2.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.1", + "version": "7.2.2", "license": "MIT", "dependencies": { "@stripe/terminal-js": "^0.24.0" diff --git a/packages/terminal/package.json b/packages/terminal/package.json index 9367ea98..6e1ea2c8 100644 --- a/packages/terminal/package.json +++ b/packages/terminal/package.json @@ -1,6 +1,6 @@ { "name": "@capacitor-community/stripe-terminal", - "version": "7.2.1", + "version": "7.2.2", "engines": { "node": ">=20.0.0" },