samkelleher / cordova-plugin-applepay Goto Github PK
View Code? Open in Web Editor NEWA complete Cordova plugin that adds Apple Pay support.
License: Apache License 2.0
A complete Cordova plugin that adds Apple Pay support.
License: Apache License 2.0
Does this plugin support Paypal?
Would it be possible for you to modify this plugin to use an MIT or Apache license as with other ionic / cordova core code and plugins? I want to use and modify this plugin, but seemingly I would have to open source the app I'm working on to do that because of the license.
Of course it's up to you if you have a good reason to use GPL, but just thought I would ask.
While i am trying to build application am getting below errors
Error: Error code 65 for command: xcodebuild with args: -xcconfig,/Users/---/---/platforms/ios/cordova/build-debug.xcconfig,-project,applpay.xcodeproj,ARCHS=i386,-target,applpay,-configuration,Debug,-sdk,iphonesimulator,build,VALID_ARCHS=i386,CONFIGURATION_BUILD_DIR=/Users/smgadmin/nissarapplepay/platforms/ios/build/emulator,SHARED_PRECOMPS_DIR=/Users/smgadmin/nissarapplepay/platforms/ios/build/sharedpch
Hi,
I am having a requirement where i need to check whether the devices support Apple Pay and then we need to register the card in the mobile application (In-App Provisioning) . I see that the plugin supports only making Payments and transactions. Is there a way to create a Cordova plugin for registering of cards which will be useful for all the users.
Is this working on iOS 10?
I keep receiving the following error:
"This device can make payments but has no supported cards."
I am using phonegap build and this is my config.xml:
<plugin name="cordova-plugin-applepay-stripe" source="npm"> <param name="STRIPE_TEST_PUBLISHABLE_KEY" value="pk_live_sCgKeifQ0CJQHEmu2ogFXRDR" /> <param name="STRIPE_LIVE_PUBLISHABLE_KEY" value="pk_test_sCgKeifQ0CJQHEmu2ogFXRDR" /> <param name="APPLE_MERCHANT_IDENTIFIER" value="this is correct id here." /> </plugin>
This happens on both yours and the forked one above.
Any help?
James
var paymentRequestOptions:any = {
items:[
{
label: data.artistname,
amount: data.price
}
],
shippingMethods: [
{
identifier: 'NextDay',
label: 'NextDay',
detail: 'Arrives tomorrow by 5pm.',
amount: 0
}
],
merchantIdentifier: 'merchant.com.appid',
currencyCode: 'USD',
countryCode: 'US',
billingAddressRequirement: 'none',
shippingAddressRequirement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0NSRDhxZ0duZlYzTUEwR0NXQ0dTQUZsQXdRQ0FRVUFvSUdWTUJnR0NTcUdTSWIzRFFFSkF6RUxCZ2txaGtpRzl3MEJCd0V3SEFZSktvWklodmNOQVFrRk1ROFhEVEU0TVRBek1ERXlNakV3TTFvd0tnWUpLb1pJaHZjTkFRazBNUjB3R3pBTkJnbGdoa2dCWlFNRUFnRUZBS0VLQmdncWhrak9QUVFEQWpBdkJna3Foa2lHOXcwQkNRUXhJZ1FnL0pxNkRWazM0RGM3ZUplOEcwWXZ2NzAxZ2ZJc1l2aU5FeHI2OWljdzB5Z3dDZ1lJS29aSXpqMEVBd0lFUnpCRkFpQUVhaEJMQ0I3K1gvZVBZS1pWOVpZZkNOWHhkZVk1ckMyRExNc2trQ25zc3dJaEFNSUduZHBrdlkwYmcrRmRJa2ZZOTZjeDN2d2ZOYklNV2FLc3BjSmZudllVQUFBQUFBQUEiLCJoZWFkZXIiOnsiZXBoZW1lcmFsUHVibGljS2V5IjoiTUZrd0V3WUhLb1pJemowQ0FRWUlLb1pJemowREFRY0RRZ0FFd2NpRVY2RWFHaXlxQW1PTFprUWljR1lMcDh3bzQyR3JabW9PMVlQc3djVnFCS2RhWUNKK1pmamtuRlRlRWdvcDdnekd2MXBpMUY0SmVDWGgvVTBUY0E9PSIsInB1YmxpY0tleUhhc2giOiJGN2lDdEpnbGJIWENQZW5UeHR4UUZjemwvMVZjWURpQVBDQTFud1pNbTZBPSIsInRyYW5zYWN0aW9uSWQiOiI4MDdlOGZhODZmZGQyNjY4MmQ5YzdlZmYwNDJmNDU5MDAyNzQ2ZTc5OGRkZWFjOTdjNzMwYmJlMWJiOWI1ZjEzIn19"}
THERE IS NOT STRIPE TOKEN .PLEASE HELP!.
Thanks in advance.
using cordova 6.0.0 and Xcode 7.3.1
My flow is as follows;
ApplePay.canMakePayments() - Apple Pay is enabled and a supported card is setup
var worder = "{items: [{label: '3 x Basket Items',amount: .25}],merchantIdentifier: '" +apple_merchantid +"',currencyCode: 'USD',countryCode: 'US',billingAddressRequirement: 'none',shippingAddressRequirement: 'none',shippingType: 'service'}";
ApplePay.makePaymentRequest( worder)
.then(wsuccess(token))
.catch(wfail(e));
result is:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString objectForKey:]: unrecognized selector sent to instance 0x15eb84ef0'
Any ideas are welcomed!!!
thanks!
Howard
I'm trying to implement the Apple Pay with ionic, Everything works fine. Apple Pay drop in sheet comes with payment info. On makePaymentRequest method I do get the Base64 token, But I have no idea, how to process this token, Because at server level like stripe they except token starting from something like this tok_19GCAQI5NuVQgnjeKNE32K0p . But One I am getting is completely different. On decoding this base64 token, This JSON object I get.
{
"type" : "applepay",
"token_data" : {
"version":"EC_v1",
"data":"PxiLne-........",
"signature":"........",
"header":{
"ephemeralPublicKey":"MFkwE..............",
"publicKeyHash":"MZ78V........",
"transactionId":"ee44abfeaeeccd7663........"
}
}
}
Please help how I can process this payment. Need token to charge to client. I'm using stripe at backend processing.
The plugin is failing and I am getting "[General] Connection to remote alert view service failed" error and because of this, I am getting "Payment not completed" error.
2019-09-19 03:25:52.537225-0400 x[1464:413571] This device can make payments.
2019-09-19 03:25:53.874710-0400 x[1464:413571] merchant.xxxx.test
2019-09-19 03:25:53.877201-0400 x[1464:412236] ApplePay canMakePayments == true
2019-09-19 03:25:53.883585-0400 x[1464:412236] ApplePay request == <PKPaymentRequest: 0x10590a990>
2019-09-19 03:25:53.899840-0400 x[1464:412236] THREAD WARNING: ['ApplePay'] took '24.731934' ms. Plugin should use a background thread.
2019-09-19 03:25:53.903529-0400 x[1464:412236] [General] Connection to remote alert view service failed
2019-09-19 03:25:53.912714-0400 x[1464:413503] Failed to open the Apple Pay sheet, or the user cancelled the payment. Payment not completed.
As per your description : If in your catch you get the message This device can make payments but has no supported cards - you can decide if you want to handle this by showing the 'Setup Apple Pay' buttons instead of the normal 'Pay with Apple Bay' buttons as per the Apple Guidelines.
So what method can be invoked for let user set the apple pay? Please help.
Thanks
If I do a local push from Xcode all function calls work as expected, but as soon as I push the same build of the app through TestFlight or through the App Store it always says that there are no supported cards. I have these same results with my production app, as well as a Ionic blank starter.
cordova-ios: 4.5.4
cordova-plugin-applepay: 3.0.0
Not the same issue as #14
as the Apple Pay capability is ON and the merchant id is selected. (And all three associated checkmarks are checked)
Not the same issue as #10
since the merchant ID has been added.
Not the same issue as #22
since I am not dealing with test sandbox accounts or Xcode capability issues.
This issue is also brought up here on the ionic forms, https://forum.ionicframework.com/t/has-anyone-successfully-integrated-apple-pay-with-ionic-2/84002
Does anyone know where I could look to find the cause of this?
So, I updated the code as follows: (https://github.com/d34thkn3ll/cordova-plugin-applepay/blob/4ebf5ea0547e660a4f298e15fb546631a6905ef8/src/ios/CDVApplePay.m#L149)
NSString *itemType = [item objectForKey:@"type"];
PKPaymentSummaryItemType type;
if ([itemType isEqualToString:@"pending"]) {
type = PKPaymentSummaryItemTypePending;
} else {
type = PKPaymentSummaryItemTypeFinal;
}
PKPaymentSummaryItem *newItem = [PKPaymentSummaryItem summaryItemWithLabel:label amount:amount type:type];
and tried to make payment request:
let label, amount;
/* ... */
ApplePay.makePaymentRequest({
items: [{
label,
amount,
type: "pending"
}],
/* ... */
}).then(/* ... */).catch(e => console.log(e))
but in response I got only "PKPaymentAuthorizationViewController was nil".
Tried adding one more item as a summary with the same amount and type, no result either.
The plugin compiles without any warnings, so I assume it's not a type error or something. Looking for help with pending payment requests.
const success = await MyPaymentProvider.authorize(response.paymentData);
Please give more information about above line as i can't see this function in the code
This plugin in ionic2 always tips "This device can make payments but has no supported cards", please check it. thanks!
cordova-plugin-applepay : 2.1.4
ionic: 2.2.3
cordova: 7.1.0
ios: 11.1
Apple store requires โPAY END_MERCHANT_NAME (VIA YOUR_APP_NAME).โ
How can i specify this?
i follow the README in here https://ionicframework.com/docs/native/apple-pay/#installation
and the plugin i can see it in node_module and config.xml,
but when i run the app on my phone,
[16:59:31] console.log: Angular is running in the development mode. Call enableProdMode() to enable the production
mode.
[16:59:31] console.log: Ionic Native: deviceready event fired after 611 ms
[16:59:32] console.warn: Native: tried calling ApplePay.canMakePayments, but the ApplePay plugin is not installed.
[16:59:32] console.warn: Install the ApplePay plugin: 'ionic cordova plugin add cordova-plugin-applepay'
[16:59:32] console.log: plugin_not_installed
Hey @samkelleher,
What is the preferred way to contribute to this project? At doxo.com we use this plugin (thanks for it!) but we need the supportedNetworks
and the merchantCapabilities
to be configurable. I made all the necessary changes on a new branch but I lack the permission to push it to github. I thought I could do this, then ask you for a review and merge to master and make a new release.
I cannot get the Apple Pay window to open when using "ionic cordova run ios".
Surprisingly it works in the simulator (dummy card) and TestFlight (real card!).
My device is configured with an iTunes sandbox account. Does the plugin not work with that?
We're calling makePaymentRequest() followed by completeLastTransaction() when all is done and finished.
If we hold the call to completeLastTransaction() for 30s then a popup is shown "Apple Pay not Completed" for 1s and then everything is gone.
We're trying to understand why this popup shows so briefly and why it disappears by itself.
Also, is there a handler on the plugin that allows us to handle this timeout?
Hi Sam,
This is similar to comments I placed under a closed issue.
According to Stripe. You left the final step out of your plugin. That is the step that converts the Apple Pay token into a Stripe token. All the tools that interface to Stripe provide this step. Below is the code that will do this:
// ViewController.m
(void)handlePaymentAuthorizationWithPayment:(PKPayment )payment completion:(void (^)(PKPaymentAuthorizationStatus))completion { [[STPAPIClient sharedClient] createTokenWithPayment:payment completion:^(STPToken *token, NSError *error) { if (error) { completion(PKPaymentAuthorizationStatusFailure); return; } / We'll implement this below in "Sending the token to your server". Notice that we're passing the completion block through. See the above comment in didAuthorizePayment to learn why. */ [self createBackendChargeWithToken:token completion:completion]; }]; }
I don't know how to add this to your plugin. Can you help? We have spend days trying to solve this ourselves.
Your help is appreciated.
Thanks!!!
Hello
when calling the makePaymentRequest function, a confirmation of payment view is displayed, but after pressing the button "Pay with passcode" in the response, the property of paymentData comes with an empty string. Can i get BASE64 ENCODED TOKEN using a simulator?
Thank you in advance for your cooperation
In your Payment Flow example a comma is missing from the example code(snip it below). This was causing compile errors until I noticed it was missing.
countryCode: 'GB'
Hi there,
Using the applepay sandbox in a simple Cordova 6.5 demo app (IOS 11, plugin v3.0.0),
the app successfully verifies that the device can make payments and has a supported card (applepay test card),
MerchantID is valid and correctly set in xcode's capabilities tab,
the applepay popup appears but when I try to complete the transaction with touch or passcode the 'payment not completed' message appears in the popup, nothing returns back to javascript control and I'm not seeing any errors when debugging CDVApplePay.
here's the calling code:
app.donateWithApplePay = function() {
let order = {
countryCode: 'GB',
currencyCode: 'GBP',
merchantCapabilities: ['capabilityCredit', 'capabilityDebit'],
merchantIdentifier: merchantId,
items: [{ label: 'Donation', amount: donationAmount }],
paymentSummaryItems: [donationAmount],
supportedNetworks: ['Visa', 'MasterCard', 'AmEx'],
billingAddressRequirement: 'none',
shippingAddressRequirement: 'none',
shippingType: 'service'
};
ApplePay.makePaymentRequest(order).then(paymentResponse => {
// user approved payment, token generated
console.log(paymentResponse);
//ApplePay.completeLastTransaction('success');
}).catch(err => {
// error or user cancelled
console.log(err);
});
};
the PKPaymentRequest documentation is pretty limited so could never figure out if any of the fields are mandatory, I,e, shipping/billing contacts etc.
console below:
2018-01-09 12:54:42.230772+0000 Payments PoC[332:39258] ApplePay canMakePayments == true
2018-01-09 12:55:07.625598+0000 Payments PoC[332:39258] ApplePay request == <PKPaymentRequest: 0x111d220f0>
2018-01-09 12:55:10.628389+0000 Payments PoC[332:39258] THREAD WARNING: ['ApplePay'] took '28397.825195' ms. Plugin should use a background thread.
2018-01-09 12:55:10.668150+0000 Payments PoC[332:39368] void SendDelegateMessage(NSInvocation *): delegate (webView:decidePolicyForNavigationAction:request:frame:decisionListener:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode
Any way to see some output from the native applepay function in xcode or to verify the paymentRequest is valid?
ApplePay.makePaymentRequest(order)
.then((paymentResponse) => {
// User approved payment, token generated.
})
.catch((message) => {
// Error or user cancelled.
});
// MyPaymentProvider.authorizeApplePayToken(token.paymentData)
// .then((captureStatus) => {
// // Displays the 'done' green tick and closes the sheet.
// ApplePay.completeLastTransaction('success');
// })
// .catch((err) => {
// // Displays the 'failed' red cross.
// ApplePay.completeLastTransaction('failure');
// });
After payment response, what is the following provider?
// Here is an example implementation:
// MyPaymentProvider.authorizeApplePayToken(token.paymentData)
// .then((captureStatus) => {
// // Displays the 'done' green tick and closes the sheet.
// ApplePay.completeLastTransaction('success');
// })
// .catch((err) => {
// // Displays the 'failed' red cross.
// ApplePay.completeLastTransaction('failure');
// });
And what I need to define here?
Payment response for makepaymentrequest() is :
{"paymentMethodNetwork":"MasterCard","paymentMethodDisplayName":"Simulated Instrument","paymentData":"","paymentMethodTypeCard":"unknown","transactionIdentifier":"Simulated Identifier"}
It didn't respond any token. Then what I need to pass next?
As I understand, the apple pay has to work with a payment gateway, I choose stripe, but I don't see anywhere in this cordova plugin that I could specify the gateway keys and tokens, the document of the payment gateway requires to have those info integrated with the app:
https://stripe.com/docs/mobile/ios
Could you please help me to point out where in the code that I could set the token or keys?
2021-01-27 14:09:14.772749+1300 [47437:1094357] ApplePay canMakePayments == true
2021-01-27 14:09:14.776377+1300 [47437:1094357] ApplePay request == <PKPaymentRequest: 0x7fe72df2b630; APIType: PKPaymentRequestAPITypeInApp, requestType: PKPaymentRequestTypeApplePay, requestor: PKPaymentRequestorDefault, countryCode: NZ, merchantCapabilities: d, currencyCode: NZD, shippingType: SHIPPING, shouldUseMerchantSession: 0, suppressTotal: 0, paymentSummaryPinned: 0, supportedNetworks: (
Visa,
MasterCard,
Discover
), paymentSummaryItems: 1, requiredBillingContactFields: {(
name,
email,
phone
)}, shippingMethods: 0, >
2021-01-27 14:09:14.784550+1300 [47437:1094357] THREAD WARNING: ['ApplePay'] took '19.363037' ms. Plugin should use a background thread.
2021-01-27 14:09:18.375341+1300 [47437:1094357] CDVApplePay: didAuthorizePayment
2021-01-27 14:09:18.381786+1300 [47437:1094357] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: paymentMethodNetwork)'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff20420af6 __exceptionPreprocess + 242
1 libobjc.A.dylib 0x00007fff20177e78 objc_exception_throw + 48
2 CoreFoundation 0x00007fff2049d77f _CFThrowFormattedException + 194
3 CoreFoundation 0x00007fff204a9035 -[__NSDictionaryM setObject:forKey:].cold.3 + 0
4 CoreFoundation 0x00007fff2048d134 -[__NSDictionaryM setObject:forKey:] + 922
5 0x000000010e218e4e -[CDVApplePay formatPaymentForApplication:] + 702
6 0x000000010e21a941 -[CDVApplePay paymentAuthorizationViewController:didAuthorizePayment:completion:] + 177
7 PassKit 0x00007fff39e91f62 __100-[PKPaymentAuthorizationViewController paymentAuthorizationCoordinator:didAuthorizePayment:handler:]_block_invoke + 247
8 libdispatch.dylib 0x0000000110f227ec _dispatch_call_block_and_release + 12
9 libdispatch.dylib 0x0000000110f239c8 _dispatch_client_callout + 8
10 libdispatch.dylib 0x0000000110f31e75 _dispatch_main_queue_callback_4CF + 1152
11 CoreFoundation 0x00007fff2038edbb CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 9
12 CoreFoundation 0x00007fff2038963e __CFRunLoopRun + 2685
13 CoreFoundation 0x00007fff203886d6 CFRunLoopRunSpecific + 567
14 GraphicsServices 0x00007fff2bededb3 GSEventRunModal + 139
15 UIKitCore 0x00007fff24690e0b -[UIApplication _run] + 912
16 UIKitCore 0x00007fff24695cbc UIApplicationMain + 101
17 0x000000010e20d6a1 main + 65
18 libdyld.dylib 0x00007fff202593e9 start + 1
19 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSDictionaryM setObject:forKey:]: object cannot be nil (key: paymentMethodNetwork)'
terminating with uncaught exception of type NSException
CoreSimulator 732.18.6 - Device: iPhone 12 Pro Max (F986B485-8EFC-42DF-9210-38C8565629A3) - Runtime: iOS 14.3 (18C61) - DeviceType: iPhone 12 Pro Max
(lldb)
this.applePay.makePaymentRequest({
items: [
{ label: '3 x Basket Items', amount: 1.00 },
],
supportedNetworks: ['visa', 'masterCard', 'discover'],
merchantCapabilities: ['3ds', 'debit', 'credit'],
merchantIdentifier: 'merchant.xx.xx.xxx',
currencyCode: 'NZD',
countryCode: 'NZ',
billingAddressRequirement: ['name', 'email', 'phone'],
shippingAddressRequirement: 'none',
shippingType: 'shipping'
}).then(paymentResponse => {
// user approved payment, token generated
alert(JSON.stringify(paymentResponse));
this.applePay.completeLastTransaction('success');
}).catch(err => {
// error or user cancelled
console.log(err);
});
I tested on simulator and real device, both same issue.
Hope someone can help me.
Thanks in advance.
When I install with cordova plugin add cordova-plugin-applepay, I get a plugin from nam with the following methods: getAllowsApplePay, setMerchantId.
I do not get the methods in this plugin.
Any ideas to sole this problem?
Hi,
Once this plugin is integrated as below,
`
//Check if the device can make payment.
ApplePay.canMakePayments()
.then((message) => {
alert(message);
this.applePayRequestForPayment();
})
.catch((message) => {
alert(message);
});
}`
"This device can make payments but has no supported cards" message when checking availability yet a few test cards have been added and are visible in the wallet. Sample cards have been selected from this page https://developer.apple.com/support/apple-pay-sandbox/
Device is iPhone 6+ running iOS 11
How do I create a charge with Stripe with PaymentData?
It throws an error that the string is invalid and too long.
I decoded paymentdata but don't know how to use for stripe.charge()
Hi, after I Install the plugin and try to build on my iPhone I got error message "Symbol not found" in my xCode, here is the complete error log. Thanks
Error :
dyld: Symbol not found: _kABPersonAddressCityKey
Referenced from: /var/containers/Bundle/Application/384FF26E-B485-4792-9CDD-4552E6E184A6/star.app/star
Expected in: /System/Library/Frameworks/PassKit.framework/PassKit
in /var/containers/Bundle/Application/384FF26E-B485-4792-9CDD-4552E6E184A6/star.app/star
(lldb)
As the document said, this plugin is compatibility with iOS 9.2-12.
Apple released iOS 13 from 19/09/2019, Do you have any plan to support this new iOS?
By testing, iOS 12 in our testing iPhone is not working also. Maybe they have some change in API ?
I am using this library to make payment in my ionic project. I want to add monthly subscription but could not find any related method to achieve it. It is provided by core apple library apple pay and I want to achieve the same objective of monthly subscription in my ionic project. Can someone help me in finding out a solution?
relevant link for apple pay:- https://developer.apple.com/design/human-interface-guidelines/apple-pay/overview/payment-types/
After importing ApplePay, I am not able to access the methods. I am also not able to create an instance so as to access the methods that way. Any help would be appreciated.
I have not used promises before. I am getting snytactic errors in my cordova app. Research indicates that Cordova supported platforms lack suport for ES6 Promise. There is a plugin, PromisesPlugin, that says they rectifies this problem. Do you recommend this plugin for Cordova apps are should I do something else??
The particular syntax problem is of the form .then((message) => { . Your example will not build.
Thanks!
Howard
I need to add my credit cards through my app to Apple Wallet. How to do this using this plugin? HELP
IN this function, it is always throwing an error "PAYMENT NOT COMPLETED" and going to catch (){} when I upload build on Testflight
ApplePay.makePaymentRequest(order)
.then((paymentResponse) => {
// User approved payment, token generated.
})
.catch((message) => {
// Error or user cancelled.
});
Hi i think in:
MyPaymentProvider.authorizeApplePayToken(token.paymentData)
I have to connect to stripe but i don't see any request in the doc
Could you guide me a bit? Thanks
I have implement this plugin. All are working properly but the problem is, in stripe customer is created successfully but he doesn't have any card details under his account so that why stripe charges api is giving error:-
{
"error": {
"code": "missing",
"doc_url": "https://stripe.com/docs/error-codes/missing",
"message": "Cannot charge a customer that has no active card",
"param": "card",
"type": "card_error"
}
}
I got an error for some functions like getFromSelection() and completeTransactionWithMerchant() and when i'm trying to make build there is an error "Name is undefined".
Do you have any solutions for that??
Not sure if its the ionic devapp but when i trigger makePaymentRequest nothing actually happens. Doesn't error or even console log a result. Does it work in ionic devapp?
Hi,
Trying to test this with a stripe payment gateway but getting "This device can make payments but has no supported cards" message when checking availability yet a few test cards have been added and are visible in the wallet. Sample cards have been selected from this page https://developer.apple.com/support/apple-pay-sandbox/ in accordance with the setup instructions from here: https://stripe.com/docs/apple-pay/web.
Device is iPhone 6 running iOS 10.2
In my cordova project I added this plugins through terminal, that added the two apple pay files after that hould I do for next step. Can any one help me step by step procedure.I am new to the cordova
The Apple Pay window doesn't appear, and nothing appears in my console either.
I tried both simulator and a device but nothing happens.
Installation seemed to go fine. I added ApplePay in Providers of app.module.ts and I see no messages about the plugin missing.
Please let me know how can i use Authorize.net for Apple Pay using this plugin - cordova-plugin-applepay
Hi Sam,
When I authorize the payment in Apple Pay, I get an object that does not include the token. I don't get anytime of error. I tried to using both transactionIdentifier and paymentData as tokens. Stripe rejected both. When I install as you the plugin I get version 2.1.2. I noticed you have released 2.1.4, I tried to install the latest version without luck. I wanted to try your latest version. Could that be the problem? The object is as follows:
{"transactionIdentifier":"74B674B2394728E699B07D27E168C77502A69ED4D6342988985C5515F852E3B9","paymentData":"eyJ2ZXJzaW9uIjoiRUNfdjEiLCJkYXRhIjoiV2FRbE10RktsbGcybEhQaG5qVkpzRnU5bFp1b1JVc3Zub0t4ajdKQ0lxVjYyM3ZXMys0V3MxNlZUZW12YVRNYjV5UCtpdjhhTmwzaFMvdjNtUGhqOSt4d1FmRnVUM2RWeEQzRUpOcmdnM2RubXFiRUw1U0tybFVYTitEVmo0VFBBSkZGdlRtdUUwTDNGRGg4SzFtSytZdE9iOFJ0c0dCWWlyVW9US0t5empMbWg0clNnR1NwQVp1UWJPL0dZVVVTOXdsZGYwWi92ZVpOY05KMzNIMWNoYkVIU0c4VGt5U3pTQjBXdlhjZHlFVko2M0p0YUxDbS9yQjFEdnN2TGxRTDV2RDBFYyt5Qkh0MXd6cVlsUkhmUjZrSWxXbUNRbDVjOVlFUTJYTytzV0dkOHdlSzlUZU9YYW1idjBTM1dMZWg0N3VYMklIQWRGK0doYmhqZnIzMjl4M2VPSmthaUx0S3EwdWhXY1doUUFOMnZBUW1IZFZhLzYvT1lWL0dNM1RCRXhpREVmS3NDdmFHTWttQVI4MlF3eXFFdmtOSFUxNVNFbkY1OFVwTlZ3PT0iLCJzaWduYXR1cmUiOiJNSUFHQ1NxR1NJYjNEUUVIQXFDQU1JQUNBUUV4RHpBTkJnbGdoa2dCWlFNRUFnRUZBRENBQmdrcWhraUc5dzBCQndFQUFLQ0FNSUlENG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SJ9fQ=="}.
Any help is appreciated!!!
Thanks!!!
Hi, I have added a credit card to my applepay wallet, however when I use the plugin to verify a purchase can be made it returns the following, "This device can make payments but has no supported cards". I am on iOS 10.3.2 and Cordova 7.0.1. Any help tracking down the issue would be very helpful! Thanks.
Hey there,
I'm getting an issue when calling makePaymentRequest since the latest iOS update to 13.3. canMakePayments works fine, but when I call the makePaymentRequest function, the app crashes. Was working fine prior to 13.3 so could be something related to the update. Any ideas?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.