React + Stripe  -  Accept Payment Through Paymentintent Api and Save Card Details

React + Stripe  -  Accept Payment Through Paymentintent Api and Save Card Details

In this first part of the series, we will use Stripe PaymentIntent API to accept a payment, create a Stripe Customer and save card details…

React + Stripe — Accept payment through PaymentIntent API and save card details

Image for post

In this first part of the series, we’ll use Stripe PaymentIntent API to accept a payment, create a Stripe Customer and save card details for future payments.

We will be using React for the frontend and Node for the server.

Accept a payment

1. Set up the server

  • Install the Stripe Node library
npm install --save stripe
  • Create a PaymentIntent
// Specify Stripe secret api key here
const stripe = require("stripe")("stripe_secret_api_key");

// Create a PaymentIntent with the order amount and currency
const paymentIntent = await stripe.paymentIntents.create({
  amount: 1200, // Specify amount here
  currency: "usd" // Specify currency here
});
// Return client secret
res.send({
  clientSecret: paymentIntent.client_secret
});

nodejs javascript web-development

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Hire Dedicated JavaScript Developers -Hire JavaScript Developers

Hire dedicated JavaScript Developers who are proficient in AngularJS, ReactJS, NodeJS, & VueJS frameworks. Get flexible hiring models as per your business requirements.

Top NodeJS Web Development Company India & USA – ByteCipher P. Ltd

Seeking for the top NodeJS development company in USA & India? Our expert and skilled NodeJs developers are dedicated to offer you a full-spectrum of nodejs app development services.

Hire NodeJs Developer

Looking to build dynamic, extensively featured, and full-fledged web applications? **[Hire NodeJs Developer](https://hourlydeveloper.io/hire-dedicated-node-js-developer/ "Hire NodeJs Developer")** to create a real-time, faster, and scalable...

JS Development Company India | JavaScript Development Services

Best JavaScript web app development company in India, PixelCrayons provides full stack JS development & maintenance. 16+ Yrs Exp., 60% less cost, Strict NDA

Top NodeJS Mobile App Development Company in USA

AppClues Infotech is a top Mobile App Development Company in USA building high-quality Android, iOS, and Native apps for Startups, SMBs, & Enterprises. Contact us now!