Notes
![]() ![]() Notes - notes.io |
import {loadStripe} from '@stripe/stripe-js';
import { Stripe } from '@stripe/stripe-js';
@Component({
selector: 'app-stripe',
templateUrl: './stripe.component.html',
styleUrls: ['./stripe.component.scss']
})
export class StripeComponent {
constructor() { }
handler:any = null;
ngOnInit() {
this.loadStripe();
}
pay(amount: any) {
var handler = (<any>window).StripeCheckout.configure({
key: 'pk_test_51Mn18bSF5Bhh2uVr1gsTXJdTW45wWRy4BumyTiVde8cF436gQbKIUBzf1iGECnBDARZXdWqNMGCwRslSlKhYaKEk00mRdyK20b',
locale: 'auto',
token: function (token: any) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
console.log(token)
alert('Token Created!!');
}
});
handler.open({
name: 'ShipKart',
description: 'Your one stop Shopping solution',
amount: amount * 100
});
}
loadStripe() {
if(!window.document.getElementById('stripe-script')) {
var s = window.document.createElement("script");
s.id = "stripe-script";
s.type = "text/javascript";
s.src = "https://checkout.stripe.com/checkout.js";
s.onload = () => {
this.handler = (<any>window).StripeCheckout.configure({
key: 'pk_test_51Mn18bSF5Bhh2uVr1gsTXJdTW45wWRy4BumyTiVde8cF436gQbKIUBzf1iGECnBDARZXdWqNMGCwRslSlKhYaKEk00mRdyK20b',
locale: 'auto',
token: function (token: any) {
// You can access the token ID with `token.id`.
// Get the token ID to your server-side code for use.
console.log(token)
alert('Payment Success!!');
}
});
}
window.document.body.appendChild(s);
}
}
}
################################
<div class="container mt-5">
<h2>Stripe Checkout</h2>
<div class="row mt-5">
<div class="col-md-4">
<button (click)="pay(20)" class="btn btn-primary btn-block">Pay $20</button>
</div>
<!-- <div class="col-md-4">
<button (click)="pay(30)" class="btn btn-success btn-block">Pay $30</button>
</div>
<div class="col-md-4">
<button (click)="pay(50)" class="btn btn-info btn-block">Pay $50</button>
</div> -->
</div>
<p class="mt-5">
Try it out using the test card number <b>4242 4242 4242 4242</b>, a random three-digit CVC number, any expiration date in the future, and a random five-digit U.S. ZIP code.
</p>
</div>
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team