All Projects → richnologies → Ngx Stripe

richnologies / Ngx Stripe

Licence: other
Angular 6+ wrapper for StripeJS

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to Ngx Stripe

Laravel Stripe Webhooks
Handle Stripe webhooks in a Laravel application
Stars: ✭ 300 (+134.38%)
Mutual labels:  stripe, payments
Django Payments
Universal payment handling for Django.
Stars: ✭ 575 (+349.22%)
Mutual labels:  stripe, payments
Digota
ecommerce microservice
Stars: ✭ 382 (+198.44%)
Mutual labels:  stripe, payments
pinax-stripe-light
a payments Django app for Stripe
Stars: ✭ 670 (+423.44%)
Mutual labels:  stripe, payments
Dj Stripe
Django + Stripe Made Easy
Stars: ✭ 1,022 (+698.44%)
Mutual labels:  stripe, payments
wp-simple-pay-lite
Add high conversion Stripe payment forms to your WordPress site in minutes.
Stars: ✭ 31 (-75.78%)
Mutual labels:  stripe, payments
Stripe Connect Rocketrides
Sample on-demand platform built on Stripe: Connect onboarding for pilots, iOS app for passengers to request rides.
Stars: ✭ 426 (+232.81%)
Mutual labels:  stripe, payments
Gringotts
A complete payment library for Elixir and Phoenix Framework
Stars: ✭ 396 (+209.38%)
Mutual labels:  stripe, payments
Elements Examples
Stripe Elements examples.
Stars: ✭ 874 (+582.81%)
Mutual labels:  stripe, payments
Servicebot
Open-source subscription management & billing automation system
Stars: ✭ 857 (+569.53%)
Mutual labels:  stripe, payments
subscribie
Collect recurring payments online - subscription payments collection automation
Stars: ✭ 36 (-71.87%)
Mutual labels:  stripe, payments
React Native Stripe Payments
Lightweight, easy to integrate and use React native library for Stripe payments (using Payment Intents) compliant with SCA (strong customer authentication)
Stars: ✭ 78 (-39.06%)
Mutual labels:  stripe, payments
Stripe Billing Typographic
⚡️Typographic is a webfont service (and demo) built with Stripe Billing.
Stars: ✭ 186 (+45.31%)
Mutual labels:  stripe, payments
drf-stripe-subscription
An out-of-box Django REST framework solution for payment and subscription management using Stripe.
Stars: ✭ 42 (-67.19%)
Mutual labels:  stripe, payments
Pinax Stripe
a payments Django app for Stripe
Stars: ✭ 650 (+407.81%)
Mutual labels:  stripe, payments
Stripy
Micro wrapper for Stripe's REST API.
Stars: ✭ 49 (-61.72%)
Mutual labels:  stripe, payments
Stripe Payments Demo
Sample store accepting universal payments on the web with Stripe Elements, Payment Request, Apple Pay, Google Pay, Microsoft Pay, and the PaymentIntents API. 💳🌍✨
Stars: ✭ 1,287 (+905.47%)
Mutual labels:  stripe, payments
Checkout.js
💳 Quickly capture payments with the best checkout flow for crowdfunding and product launches.
Stars: ✭ 92 (-28.12%)
Mutual labels:  payments
Braintree dotnet
Braintree .NET library
Stars: ✭ 109 (-14.84%)
Mutual labels:  payments
Gatsby Starter Stripe
🛒 A starter storefront & admin UI with Gatsby, Stripe, & Netlify Functions.
Stars: ✭ 92 (-28.12%)
Mutual labels:  stripe

An Angular 6+ wrapper for StripeJS elements

version license

ngx-stripe

Ngx Stripe is a thin wrapper around Stripe Elements. It allows adding Elements to any Angular app. The StripeJS Reference covers complete Elements customization details. You can use Elements with any Stripe product to collect online payments. To find the right integration path for your business, explore Stripe Docs.

  • Learn how to use ngx-stripe on the new docs site 🤓

Notice

After reviewing the state of the art for React and Vue counterparts, some major changes are going to be introduced to align this project with Stripe Elements.

  1. ngx-stripe will no longer maintain its own interfaces. Instead, @stripe/stripe-js has been added as peer dependency. This will make the library easier to maintain and avoid mistakes.
  2. Stripe Service has been updated with all the missing APIs from StripeJS
  3. All the missing Element Components like IBAN, Ideal, FPX, ... have been added
  4. Request Payment Button now has full support
  5. Added Container Style functionality support
  6. A Migration guide has been added with details of what have changed
  7. The new version of library is compatible from Angular 6+ major versions. Check the Installation section to see how to install an older version.
  8. All documentation has been moved to a new docs site

In order to ease the transition, we are naming the old version of the library legacy and we have created some npm tags to make it easy to install older versions.

Features

  • Lazy script loading
  • Element Components
  • Stripe Observable wrapper

Installation

Active Versions

To install the last active version:

$ npm install ngx-stripe @stripe/stripe-js

To install an specific version for an older Angular major, use the lts npm tags or check the table below to pick the right version, for example, for v8:

$ npm install [email protected] @stripe/stripe-js

Legacy Versions

To install some of the older versions of the library use the legacy npm tags or check the table below to pick the right version, for example, for v7:

$ npm install [email protected]

Choose the version corresponding to your Angular version:

Angular ngx-stripe (legacy) ngx-stripe
10 Not Available 10.x+
9 v9-legacy / 9.0.x+ v9-lts / 9.1.x+
8 v8-legacy / 7.4.4+ v8-lts / 8.1.x+
7 v7-legacy / 7.x+ v7-lts / 7.5.x+
6 v6-legacy / 0.6.x v6-lts / 6.1.x+
5 0.5.x or less Not Available
4 0.4.x or less Not Available

Using the library

Most of the documentation has been moved to a new docs site. Only a very basic example has been left here:

Import the NgxStripeModule into your application

The module takes the same parameters as the global Stripe object. The APIKey and the optional options to use Stripe connect

  • apiKey: string
  • options?: { stripeAccount?: string; }
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';

import { AppComponent } from './app.component';

// Import the library
import { NgxStripeModule } from 'ngx-stripe';

@NgModule({
  declarations: [AppComponent],
  imports: [
    BrowserModule,
    ReactiveFormsModule,
    NgxStripeModule.forRoot('***your-stripe-publishable-key***'),
    LibraryModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule {}

Card Element Component

Once the module has been imported, you can collect credit card details using the ngx-stripe-card component.

Then you can use the Stripe Service, which is basically an Obseravble wrapper around the stripejs object, to use that information. In this example we use it to create a token, but it can be use to confirm a Payment Intent, Setup Intent, etc...

Please check the docs site to see a complete set of Stripe Element Components available and the full API of the Stripe Service.

// stripe.html

<form novalidate (ngSubmit)="createToken()" [formGroup]="stripeTest">
  <input type="text" formControlName="name" placeholder="Jane Doe">
  <ngx-stripe-card
    [options]="cardOptions"
    [elementsOptions]="elementsOptions"
  ></ngx-stripe-card>
  <button type="submit">
    CREATE TOKEN
  </button>
</form>
import { Component, OnInit, ViewChild } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';

import { StripeService, StripeCardComponent } from 'ngx-stripe';
import {
  StripeCardElementOptions,
  StripeElementsOptions
} from '@stripe/stripe-js';

@Component({
  selector: 'app-create-token',
  templateUrl: 'stripe.html'
})
export class StripeCreateTokenComponent implements OnInit {
  @ViewChild(StripeCardComponent) card: StripeCardComponent;

  cardOptions: StripeCardElementOptions = {
    style: {
      base: {
        iconColor: '#666EE8',
        color: '#31325F',
        fontWeight: '300',
        fontFamily: '"Helvetica Neue", Helvetica, sans-serif',
        fontSize: '18px',
        '::placeholder': {
          color: '#CFD7E0'
        }
      }
    }
  };

  elementsOptions: StripeElementsOptions = {
    locale: 'es'
  };

  stripeTest: FormGroup;

  constructor(private fb: FormBuilder, private stripeService: StripeService) {}

  ngOnInit(): void {
    this.stripeTest = this.fb.group({
      name: ['', [Validators.required]]
    });
  }

  createToken(): void {
    const name = this.stripeTest.get('name').value;
    this.stripeService
      .createToken(this.card.element, { name })
      .subscribe((result) => {
        if (result.token) {
          // Use the token
          console.log(result.token.id);
        } else if (result.error) {
          // Error creating the token
          console.log(result.error.message);
        }
      });
  }
}

License

MIT © Ricardo Sánchez Gregorio

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].