Comments (3)
@hsmith825 I just found this fork which should work for you too https://github.com/monoku/cordova-plugin-applepay-stripe
from cordova-plugin-applepay.
Hi @hsmith825 -
Making progress I see, the paymentData
is the token. It comes out of the device base64 encoded, so if I decode your value I get the full JSON token:
{
"version": "EC_v1",
"data": "WaQlMtFKllg2lHPhnjVJsFu9lZuoRUsvnoKxj7JCIqV623vW3+4Ws16VTemvaTMb5yP+iv8aNl3hS/v3mPhj9+xwQfFuT3dVxD3EJNrgg3dnmqbEL5SKrlUXN+DVj4TPAJFFvTmuE0L3FDh8K1mK+YtOb8RtsGBYirUoTKKyzjLmh4rSgGSpAZuQbO/GYUUS9wldf0Z/veZNcNJ33H1chbEHSG8TkySzSB0WvXcdyEVJ63JtaLCm/rB1DvsvLlQL5vD0Ec+yBHt1wzqYlRHfR6kIlWmCQl5c9YEQ2XO+sWGd8weK9TeOXambv0S3WLeh47uX2IHAdF+Ghbhjfr329x3eOJkaiLtKq0uhWcWhQAN2vAQmHdVa/6/OYV/GM3TBExiDEfKsCvaGMkmAR82QwyqEvkNHU15SEnF58UpNVw==",
"signature": "MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwEAAKCAMIID4jCCA4igAwIBAgIIJEPyqAad9XcwCgYIKoZIzj0EAwIwejEuMCwGA1UEAwwlQXBwbGUgQXBwbGljYXRpb24gSW50ZWdyYXRpb24gQ0EgLSBHMzEmMCQGA1UECwwdQXBwbGUgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMB4XDTE0MDkyNTIyMDYxMVoXDTE5MDkyNDIyMDYxMVowXzElMCMGA1UEAwwcZWNjLXNtcC1icm9rZXItc2lnbl9VQzQtUFJPRDEUMBIGA1UECwwLaU9TIFN5c3RlbXMxEzARBgNVBAoMCkFwcGxlIEluYy4xCzAJBgNVBAYTAlVTMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQ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wQCAQUAoGkwGAYJKoZIhvcNAQkDMQsGCSqGSIb3DQEHATAcBgkqhkiG9w0BCQUxDxcNMTYwNjAyMTEwMzMyWjAvBgkqhkiG9w0BCQQxIgQgRVkcPT1BoKeKsYfclkFNRcwNHzxVx98MP+7kVsZ9R8UwCgYIKoZIzj0EAwIESDBGAiEAvWew1gQ1FhltdGLa3Paz5qhsbqmcScmcNXovgUb9k8QCIQCWqBIreVFF1SgUYsep2JqbSmTAmMePoKl3evYIip0d9wAAAAAAAA==",
"header": {
"ephemeralPublicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8zPbOMOnQGLCaJb4/o72gOxRvl1am7EbWFVFzFhzFNdckxd5JIqn1cfPl6Cz6F+1iZY1wVUZG6ieLMzm3HiSYg==",
"publicKeyHash": "+KRnYqDhOqtL9OW2mXHcQjtC0XDKhTneOZfcUijflik=",
"transactionId": "74b674b2394728e699b07d27e168c77502a69ed4d6342988985c5515f852e3b9"
}
}
You basically construct a Stripe token yourself and submit to them, depending on how you're going to handle the process. All this plugin does is expose the data from the payment sheet (such as name, address etc) and the payment token.
It's up to you to handle the token with whatever payment platform you use. If you use their native SDK, you can use something like createTokenWithPayment
In my projects, I actually pass the token to an HTTP API and relay to the payment provider that way. The token is encrypted and signed using the merchant certificate, so its safe to move online.
Hope this helps!
from cordova-plugin-applepay.
Hi Sam,
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!!!
from cordova-plugin-applepay.
Related Issues (20)
- Does not work with iOS 12 HOT 4
- Payment Response not returning stripetoken HOT 1
- What will be the method for setup Apple pay?
- Can't access methods
- Apple pay with stripe in ionic 3 HOT 6
- How to contribute to this repo? HOT 1
- How to process Base64 token on ApplePay.makePaymentRequest(order) ? HOT 4
- Getting error [General] Connection to remote alert view service failed
- Subscription payment HOT 1
- Trying to add PKPaymentSummaryItemTypePending support, got "PKPaymentAuthorizationViewController was nil" HOT 1
- How to charge stripe with paymentData HOT 7
- Compatibility with iOS 13 ?
- Trying to handle a timeout error before calling completeLastTransaction
- Apple store declined app: PAY END_MERCHANT_NAME
- Not working since ios 13.3 HOT 12
- Is it possible to use this plugin for subscription payments?
- Hi how I connect with stripe for applepay? HOT 2
- Payment Not Completed HOT 1
- How is this application used with payment processors like Stripe? HOT 3
- Ionic Capacitor2 Vue.js Apple Pay Question
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-applepay.