Stripe payment with Angular6 and NodeJs (Express)

We are on git also : 

So , today we are going to see how to make stripe payment with the help of Angular6. For this first of all we have to create a account in stripe ( .

Now after creating the account in stripe , Go to the dashboard. Here we can find the Developers->API keys. 

Now follow the below steps :

1)Create a new Angular6 project

2)Install ngx-stripe

npm install ngx-stripe@next –save

3)Now open app.module.ts .

Note : NgxStripeModule.forRoot(‘pk_test_6GD8IOeqFvFby4EuW982mVHS‘)

forRoot() method contains the your-stripe-publishable key. (We can find inside API Keys)

4)Now create a Card payment form inside the app.component.html

5)Now inside the app.component.ts , we need to create a buy() method. This buy() method gets called once customer clicks over the Buy button. Inside buy() method we are creating the stripe token. We will send this token to the server for making charges

Note : In above code we can see that after getting the token , we are sending it to the server. (http://localhost:3000/payme) through post method

Express Code for stripe payment :

Note : Once we click on buy button , a charge will be requested to the stripe payment gateway. Once done we will se a Payment Done message on console

By Pankaj Kumar Agarwal

Leave a reply:

Your email address will not be published.