npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

nativescript-stripe

v6.6.2

Published

NativeScript Stripe sdk

Downloads

9

Readme

npm npm Build Status

Installation

Requires I0S 9.x +

NativeScript 4x

  • tns plugin add nativescript-stripe

NativeScript 3x

NativeScript 2x

Configure

Android

Stripe Android v10.2.1 SDK is being used

iOS

Stripe iOS 19.0.1 SDK (pod) is being used

Angular

To use the Custom Integration's CreditCardView in Angular, register the Angular wrapper in the main module (typically app.module.ts), as follows:

...
import { CreditCardViewModule } from "nativescript-stripe/angular";
...
@NgModule({
  imports: [
    ...
    CreditCardViewModule,
    ...
  ],
  ...
})
export class AppModule { }

Usage

IMPORTANT: Make sure you include xmlns:stripe="nativescript-stripe" on the Page tag

Using from view

<stripe:CreditCardView id="card"/>

Add extra details to card

JavaScript

const ccView = page.getViewById("card");
const cc = ccView.card;
cc.name = "Osei Fortune";

TypeScript

import { CreditCardView, Card } from 'nativescript-stripe';
const ccView:CreditCardView = page.getViewById("card");
const cc:Card = ccView.card;
cc.name = "Osei Fortune";

Using from code

import { Card } from 'nativescript-stripe';
const cc = new Card("1111111111111111",2,18,"123");
cc.name = "Osei Fortune";

Standard Integration

The demo and demo-angular folders contain demos that use the Standard Integration. They can be used as a starting point, and provide information on how to invoke the Standard Integration components. For more information, see the README in the demo folders.

Set Stripe configuration values:

StripeConfig.shared().backendAPI = <Your API Service>;
StripeConfig.shared().publishableKey = <Your Stripe Key>;
StripeConfig.shared().companyName = <Your Company Name>;
// To support Apple Pay, set appleMerchantID.
StripeConfig.shared().appleMerchantID = <Your Apple Merchant ID>;

Create a Customer Session

let customerSession = new StripeCustomerSession();

Create a Payment Session

let paymentSession = new StripePaymentSession(page, customerSession, price, "usd", listener);

See Stripe Docs for more information.

Strong Customer Authentication

PSD2 regulations in Europe will require Strong Customer Authentication for some credit card purchases. Stripe supports this, though most of the work to make it happen is required on the backend server and in the mobile app, outside the nativescript-stripe plugin.

To support SCA, follow the instructions for iOS and Android on using PaymentIntents instead of tokens when interacting with your backend server. The nativescript-stripe plugin has cross-platform data structures and method calls that might be helpful. In index.d.ts see:

  • PaymentMethod and related classes
  • StripePaymentIntent and related classes
  • Methods Stripe.createPaymentMethod, Stripe.retrievePaymentIntent, Stripe.confirmPaymentIntent and Stripe.confirmSetupIntent

Handling secondary customer input

SCA requires the customer to enter additional information with some charge cards. Stripe takes care of this if you properly handle the redirect from the StripePaymentIntent returned from the server.

If you're using the automatic confirmation flow, confirmPaymentIntent and confirmSetupIntent will automatically manage the SCA validation by showing and validating the payment authentification.

If you're using the manual confirmation flow, where back-end creates the PaymentIntent|SetupIntent and requires an Intent authentification from the customer, authenticatePaymentIntent and authenticateSetupIntent will allow to manage that extra step before sending back the Intent to your server.

Status

demo-angular now supports SetupIntent and PaymentIntent SCA integration. Any credit card verification will be automatically prompted to the user.

Known Issues

const enum not found

When building with NativeScript v6, it builds using the webpack-only flow in "transpileOnly" mode. A webpack issue means that const enum values cannot be found in the final output.

This problem is not present in Angular projects and likely won't be an issue if you do not use any of the exported enums.

Unfortunately, the only fix I've found for this is to follow the advice in that issue and modify webpack.config.js in your app to set transpileOnly to false.

Note: This may no longer be needed once this TypeScript bug is fixed.

TODO

  • Android Pay
  • Apple Pay (supported by Standard Integration, not by Custom Integration)