App crash when using apple pay
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 30/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- ios, typescript
Rechercherichtung
Start with the Apple Pay authorization handler at node_modules/@nativescript/apple-pay/payment-authorization-view-controller-delegate.ios.js:43 and trace the request and paymentData shown in the issue. Reproduce the crash using the provided onApplePayTap flow, then verify that authorization no longer terminates the application and the payment sheet completes normally.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Error:
***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught Error: The data couldn’t be read because it isn’t in the correct format.
at
PKPaymentAuthorizationViewControllerDelegateImpl.paymentAuthorizationViewControllerDidAuthorizePaymentHandler(file: src/webpack:/vois-mgov/node_modules/@nativescript/apple-pay/payment-authorization-view-controller-delegate.ios.js:43:0)
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Uncaught Error: The data couldn’t be read because it isn’t in the correct format.
at
PKPaymentAuthorizationViewControllerDelegateImpl.paymentAuthorizationViewControllerDidAuthorizePaymentHandler(file: src/webpack:/vois-mgov/node_modules/@nativescript/apple-pay/payment-authorization-view-controller-delegate.ios.js:43:0)
', reason: '(null)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20406d44 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff201a4a65 objc_exception_throw + 48
2 NativeScript 0x000000010610de7e __copy_helper_block_e8_32o + 0
3 libdispatch.dylib 0x00007fff201148e4 _dispatch_call_block_and_release + 12
4 libdispatch.dylib 0x00007fff20115b25 _dispatch_client_callout + 8
5 libdispatch.dylib 0x00007fff20123043 _dispatch_main_queue_drain + 1050
6 libdispatch.dylib 0x00007fff20122c1b _dispatch_main_queue_callback_4
code:
const MERCHANTID = '388333172821828292929';
const SomeIdentifierFromPaymentProvider = '89290109290129912088';
export const onApplePayTap = async (args?: any) => {
//try {
// just ensuring this runs only on iOS
if (isIOS) {
const applePayBtn = args.object as ApplePayBtn
// setup the event listeners for the delegate for apple pay for our button
applePayBtn.once(ApplePayEvents.DidAuthorizePaymentHandler, async (args: any) => {
console.log('in authorize handler')
console.log(ApplePayEvents.DidAuthorizePaymentHandler)
// this is where you do backend processing with your payment provider (Stripe, PayPal, etc.)
// this payload is just a sample, your payload to a provider will likely be different
// you can see here how to access the encrypted values from Apple Pay inside the `args.data.paymentData`
const payloadToBackend = {
transaction_type: 'purchase',
merchant_ref: args.data.paymentData.header.transactionId,
method: '3DS',
'3DS': {
merchantIdentifier: SomeIdentifierFromPaymentProvider,
data: args.data.paymentData.data,
signature: args.data.paymentData.signature,
version: args.data.paymentData.version,
header: args.data.paymentData.header
}
}
const result = true //await this.someHttpMethodToYourProviderBackend(payloadToBackend)
if (result) {
// need this to call when the payment is successful to close the payment sheet correctly on iOS
args.completion(ApplePayTransactionStatus.Success)
// now you can follow through with your user flow since the transaction has been successful with your provider
} else {
// payment failed on the backend, so show the FAILURE to close the Apple Pay sheet
args.completion(ApplePayTransactionStatus.Failure)
}
})
// these are the items your customer is paying for
const paymentItems = ([
{
amount: 20.5,
label: 'Balance',
type: ApplePayPaymentItemType.Final
}
] as unknown) as ApplePayItems[]
const request = {
paymentItems,
merchantId: MERCHANTID // the merchant ID for this app
merchantCapabilities: ApplePayMerchantCapability.ThreeDS,
countryCode: 'US',
currencyCode: 'USD',
shippingContactFields: [ApplePayContactFields.Name, ApplePayContactFields.PostalAddress],
billingContactFields: [ApplePayContactFields.Name, ApplePayContactFields.PostalAddress],
supportedNetworks: [
ApplePayNetworks.Amex,
ApplePayNetworks.Visa,
ApplePayNetworks.Discover,
ApplePayNetworks.MasterCard
]
} as ApplePayRequest
// `createPaymentRequest` will call into the Apple Pay SDK and present the user with the payment sheet for the configuration provided
await applePayBtn.createPaymentRequest(request).catch((err) => {
console.log('Apple Pay Error', err)
})
}
- Vorherrschende Sprache
- TypeScript
- Sterne
- 35
- Forks
- 13
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus NativeScript/payments
-
com.android.billingclient:billing@@8.0.0 - com.google.android.gms.internal.play_billing.zzbg.zzeOffen
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 28/100
NativeScript/payments#45 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
NativeScript/payments#43 · 2 Reaktionen ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
NativeScript/payments#39 ·
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
NativeScript/payments#36 · 2 Kommentare ·
-
[Restore Orders] MistakeOffen
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
NativeScript/payments#35 ·
Alle Issues in NativeScript/payments
Ähnliche Issues
-
Phone app shows Unknown for a remote machine whose key changedEvtl. vergeben @janicduplessis hat das heute übernommen. Offenarea: mobile priority: P3 type: bug
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
appandflow/stim#5006 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Area - Local to Cloud Bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 66/100
microsoft/vscode-mssql#23209 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
code-yeongyu/senpi#5713 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
A-linter
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
oxc-project/oxc#28783 ·
Maintainer antworten meist innerhalb von 1 Tag
-
community first-timers-only good first issue hacktoberfest help wanted low hanging fruit up-for-grabs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 84/100
lingdojo/kana-dojo#33553 · 1 Kommentar · 5 Reaktionen ·
Maintainer antworten meist innerhalb von 1 Tag