You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
***** 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:
constMERCHANTID='388333172821828292929';constSomeIdentifierFromPaymentProvider='89290109290129912088';exportconstonApplePayTap=async(args?: any)=>{//try {// just ensuring this runs only on iOSif(isIOS){constapplePayBtn=args.objectasApplePayBtn// setup the event listeners for the delegate for apple pay for our buttonapplePayBtn.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`constpayloadToBackend={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}}constresult=true//await this.someHttpMethodToYourProviderBackend(payloadToBackend)if(result){// need this to call when the payment is successful to close the payment sheet correctly on iOSargs.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 sheetargs.completion(ApplePayTransactionStatus.Failure)}})// these are the items your customer is paying forconstpaymentItems=([{amount: 20.5,label: 'Balance',type: ApplePayPaymentItemType.Final}]asunknown)asApplePayItems[]constrequest={
paymentItems,merchantId: MERCHANTID// the merchant ID for this appmerchantCapabilities: 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]}asApplePayRequest// `createPaymentRequest` will call into the Apple Pay SDK and present the user with the payment sheet for the configuration providedawaitapplePayBtn.createPaymentRequest(request).catch((err)=>{console.log('Apple Pay Error',err)})}
The text was updated successfully, but these errors were encountered:
The reason that payment in the following function is an empty object:
/** * Tells the delegate that the user has authorized the payment request and asks for a result. * @param controller * @param payment * @param completion */PKPaymentAuthorizationViewControllerDelegateImpl.prototype.paymentAuthorizationViewControllerDidAuthorizePaymentHandler=function(controller,payment,completion){
The function is defined the file payment-authorization-view-controller-delegate.ios.js
Error:
code:
The text was updated successfully, but these errors were encountered: