![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
ngx-stripe
Advanced tools
An Angular 6+ wrapper for StripeJS elements
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
.
ngx-stripe
on the new docs site 🤓This project has not been updated for a while. 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
.
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 mantain and avoid mistakes.Stripe Service
has been updated with all the missing APIs from StripeJSElement Components
like IBAN, Ideal, FPX, ... have been addedRequest Payment Button
now has full supportContainer Style
functionality supportMigration
guide has been added with details of what have changedInstallation
section see how to install an older version.Finally, 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.
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 v7:
$ npm install ngx-stripe@v7-lts @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 ngx-stripe@v7-legacy
Choose the version corresponding to your Angular version:
Angular | ngx-stripe (legacy) | ngx-stripe |
---|---|---|
10 | Not Available | v10-lts / 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 |
Most of the documentation has been moved to a new site. Only a very basic example has been leave 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
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 {}
Once the module has been imported, you can collect credit cards details using the ngx-stripe-card component.
Then you can use the Stripe Service, which is basically an Obseravble wrapper arount 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 to see the complete set of Stripe Element Components avaiable 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, { static: false }) 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);
}
});
}
}
MIT © Ricardo Sánchez Gregorio
FAQs
Collect Payments with Stripe: The Angular Way
The npm package ngx-stripe receives a total of 10,545 weekly downloads. As such, ngx-stripe popularity was classified as popular.
We found that ngx-stripe demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.