-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stripe with Google pay and Apple pay #54
Comments
The master branch currently uses an older version of Stripe SDK. You need to download the plugin from the v2 branch:
As for Ionic usage; Ionic Native currently doesn't have an updated wrapper for this v2 branch. We will take care of that as soon as it's finalised. For now you can do something like this: import { CordovaStripe } from 'cordova-plugin-stripe';
interface Cordova {
plugins: {
stripe: typeof CordovaStripe.Plugin;
}
}
function Promisify<T = any>(func, ...args: any[]): Promise<T> {
return new Promise<T>((resolve, reject) => {
func.apply(func, [...args, resolve, reject]);
});
}
declare const cordova: Cordova;
@Injectable()
export class StripeProvider {
constructor(plt: Platform) {
plt
.ready()
.then(() => Promisify(cordova.plugins.stripe.setPublishableKey, 'YOUR KEY HERE'))
.then(() => console.log('done setting publsihable key'))
.catch(err => 'Error setting publishable key');
}
async updateCreditCard(card: CordovaStripe.CardTokenRequest) {
const res = await Promisify<CordovaStripe.CardTokenResponse>(cordova.plugins.stripe.createCardToken, card);
// res should contain card object
}
} Please note that the v2 branch is still in beta, we may release breaking changes at any point. It seems to be stable so far and we are using it in production in one of our apps. |
How does the Apple Pay support actually work? I looked in the code but couldn't find a JS function that initializes it? |
@giladrom see this https://github.com/zyra/cordova-plugin-stripe/blob/v2/www/CordovaStripe.js#L107 The options are here: https://github.com/zyra/cordova-plugin-stripe/blob/v2/www/CordovaStripe.d.ts#L95 const opts = {
....
};
const success = (token, cb) => {
// token is the payment authorization token
// cb is a callback function that accepts a boolean. Pass `true` to capture payment or `false` to discard it.
};
const error = (err) => {
...
};
cordova.plugins.stripe.payWithApplePay(opts, success, error); |
Is there any update on this? What about Google Pay? Why does there not seem to be anything on Google Pay and Ionic? Thanks! |
@loomtronic I ended up using this: https://github.com/monoku/cordova-plugin-applepay-stripe And I can only assume there's no Google Pay because no one actually uses it. |
@loomtronic Google Pay is also functional in the beta branch |
It's hard for me to believe that Google Pay isn't being used by anyone. If you want to have payments and you're building a hybrid app, it just seems logical you'd want to use both. I could be wrong, it's happened before... once ;) |
You're absolutely right - I'm just speaking from a personal perspective, I've been using Apple Pay since the get go and have made a point of checking how people pay for their groceries whenever I go - I've never actually seen anyone use an Android phone for contactless payment. But that's obviously anecdotal. |
@ihadeed Google Pay doesn't actually work in the current beta branch because the "payWithGooglePay" method does not exist in CordovaStripe.java. As a workaround I changed the cordova.exec call to "createGooglePayToken" which exists in the java file. It was also needed to change data.getString(2) to data.getString(1) in the "createGooglePayToken" switch case of the execute function at CordovaStripe.java |
I have done as you said, but I'm getting
Getting the same error even without modifying those files. I'm using it with Ionic V3. The following is my
I have tried several combinations(but always using the same version as seen in build.gradle), but getting the same Could someone help me? It will be a great help for others too. |
@IsaacHub Did you change "payWithGooglePay" on this line cordova-plugin-stripe/www/CordovaStripe.ts Line 370 in 6bfc88c
|
Yes. I have changed that line and error remains though. I will checkout those links you provided.. |
@RedEars The plugin you referred is triggering the Gpay window and once Gpay opens up, it's asking for card number, expiry and CVC. My question is why Gpay is asking to add card information while bank account is already linked? Is this the supposed workflow? Is "stripe using Gpay" only work with card? and not by bank account? |
@IsaacHub Stripe only supports credit and debit cards as payment source from google pay as stated here: https://stripe.com/docs/google-pay |
Hey, we are also using the same plugin to integrate stripe apple pay in our app: In this plugin after payment we are only getting 'paymentData' and 'transactionIdentifier', but we need stripeToken to charge the user. Are you able to get the token? Please help. |
I added my code to my app and stripe works %100 , but after calling cordova.plugins.stripe.payWithApplePay(opts, success, error); method app is frozen and i can not get any response. Do you have any idea ? |
Hi, I am also facing the same problem. How can we get the stripe token
after the payment successful?
…On Tue, Oct 29, 2019 at 12:39 AM ofyzero ***@***.***> wrote:
I added my code to my app and stripe works %100 , but after calling
cordova.plugins.stripe.payWithApplePay(opts, success, error); method app is
frozen and i can not get any response. Do you have any idea ?
I am using ionic 5.4.2 , cordova 7.2.2.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#54?email_source=notifications&email_token=AGIHFYYZA2RSR3TKMAQX3LDQQ42HBA5CNFSM4GOTFB62YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOECOBVQI#issuecomment-547101377>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGIHFY6ERKSRUGWSCQTEYILQQ42HBANCNFSM4GOTFB6Q>
.
|
This is the example of payWithApplePay and i added an example of NodeJS server for charge request . Here it is : |
@ofyzero Thank you i will check that. |
@ihadeed Hello! :) Has this progressed any further? Is there an Ionic wrapper for the Google Pay implementation yet? Thanks very much. |
Has anyone got Apple Pay actually working? Whenever I call the function cordova.plugins.stripe.payWithApplePay(opts, success, error); nothing happens. I don't even get any error. Any ideas? @TravBradfield I modified the code to get Google Pay working. You can see this here: https://github.com/sanctus671/cordova-plugin-stripe/tree/v2. Just put
|
Hello @sanctus671! Yes I have got Apple Pay working... the global variables will be:
The method to call for Apple Pay: `async payWithApplePay() {
}` |
@sanctus671 Please let me know if that is helpful to you? Thanks! |
Thanks but this looks like it is not this plugin but rather the generic Apply Pay cordova plugin without Stripe. How are you able to process the request in Stripe on the backend without a Stripe token? |
@sanctus671 Oh yes, you're right. Apple Pay effectively generates a card, so you use your Stripe backend functions to create the stripe token. Apple Pay returns a 'card token' which you send to your backend when creating the string payment intent |
@TravBradfield The token generated with that plugin is not Stripe compatible though. How are you able to generate a Stripe token from that? What Stripe API end point are you using on the backend? |
@sanctus671 Have a look at
This request goes to your backend. the paymentData field is Stripe compatible. I'm using this in production at the moment taking payments happily. Perhaps if you share your code we can have a look and help debug? |
@sanctus671 Is your repo working for Apple pay? Can you give us an example? |
@josebyte yes it is. Here is an example:
items are an array of items. In my case this is someones shopping cart. Ensure each item is set to 2 decimal places or else it will fail (that's the .toFixed(2) part) One other thing to note is that Apple Pay only works on iPhone 6 or greater. This plugin doesn't provide errors so I pulled my hair for a while until I realized that fact. Probably obvious to everyday Apple users but I'm an Android user so didn't realize! |
Thanks!! But I didn't make it work, I have the following crash error with this code after the setpublishablekey:
Callback ID is CordovaStripe1176650167 |
Is working on Google Pay but when I try to move from test environment to production I have this error: |
Anyone else having issues with Apple Pay since iOS 13.3? It's suddenly stopped working since that update. |
What package I have to install to use stripe google pay ? Thanks |
@TravBradfield What are you calling on the stripe API side to complete this? |
@ihadeed Is there any way to get Google Pay working with Ionic? I tried using the v2 branch and I'm getting |
It's WIP on Cordova, currently available on Capacitor. |
Hello @TravBradfield |
@ihadeed, any progress with Apple Pay & Google Pay for cordova ? And does this plugin support Microsoft Pay? |
Same error coming if any update please let me know my error Callback ID is CordovaStripe851949724 |
I checked plugin code and notice that only you provide card payment and also check in stripe it's provide google pay and apple pay
my Question is that :- How can I integrate Google pay and Apple pay using this plugin in ionic4?
please guide me
The text was updated successfully, but these errors were encountered: