@ApetitoDevops wrote:
We've integrated Stripe into our app without using any of the available plugins. However we have encountered an issue:
Firstly our solution: in the index.html we import https://js.stripe.com/v2/ and set the publishable key using Stripe.setPublishableKey('xxx');
In out payment class we set Stripe: any; and have the following code to create a token:
Stripe.setPublishableKey('xxx');
this.card = new Card();
this.card.number = this.cardNumber;
this.card.cvc = this.cardCVC;
this.card.exp_month = this.cardExpMonth;
this.card.exp_year = this.cardExpYear;
this.card.address_zip = this.cardAddressZip;try { Stripe.card.createToken(this.card, (status, response) => this.stripeResponseHandler(status, response)); } catch (e) { this.handleError("submitPayment - inner", e); }
The token is then handled by our API.
This implementation has a syntax error on both of the Stripe.xxx calls: Cannot find name 'Stripe'. Did you mean the instance member 'this.Stripe'? (Ionic serve ignores the syntax error and allows for a successful payment to be made, however ionic build fails to build due to the syntax error)
However if I change it to this.Stripe.xxx then I get an error on the actual app when trying to process the payment: cannot read property setPublishableKey of undefined
Any suggestions to solve this issue are welcome
although please note that we would rather not use the angular plugin at this stage.
Posts: 1
Participants: 1