This article will discuss how to use Stripe API with step-by-step integration guide and full documentation list. Let’s get started!
Overview of Stripe API
Stripe is a payment processing platform on the internet. Million businesses from startups to large corporation use Stripe to accept and make payments and manage their online operations. Developers use Stripe API is a RESTful API to create, retrieve, update, and delete Stripe resources. They can use Stripe API integration to handle complicated processes. In this blog, we show developers how to use Stripe API.
Also read: How to use Spotify API; a step-by-step integration guide and full documentation list
List of Stripe developer API and functionalities
The Stripe Open API is a robust tool that allows developers to create apps to retrieve, update, and delete Stripe resources. The API is user-friendly and efficient and offers several services like payment, invoicing, and subscriptions. The Stripe API has a range of functionalities given below
- Accepting payments from different instruments.
- Creating and managing customer accounts
- Generate invoices (on-off or periodically) as required
- Refund payments when required
- Integrating with other programs
Some of the most popular API functionalities are:
- Balances – Allows you to see balances in your Stripe Account
- Balance Transactions – This represents the funds move through your Stripe account and are created for all types of transactions – inflow and outflows.
- Charges – These are charges to credit or debit account,
- Customers – This object represents a customer for your business. You can create, retrieve, update, and delete customer profiles. You can set up recurrent payments, or track payments.
- Subscriptions – The Stripe Subscription API allows you to create and manage customers’ subscription plans.
- Disputes – Disputes occur when a customer raises concerns about charges or transactions with their card issuer. When this occurs, you have a chance to refute the allegations by providing evidentiary documentation.
- Products – Products describe the specific goods or services you offer to your customer.
The Stripe API is available in several programming languages that makes it easy to integrate into your application. The Stripe API provides tools to help you begin
- Tutorials
- Documentation
- Support
Also read: How To Use YouTube API; A Step-By-Step Guide Integration and Full Documentation List
How to use Stripe API – step-by-step integration guide
Step1: Create a Stripe account
Create an account by going to the Stripe website (https://stripe.com). To create your Stripe account, fill out the required fields, including your email address, company information, and banking information and click on the Create button. Stripe app is based on Stripe rest API.
Now Click the sign-in button to login to the Stripe docs site and start using test mode API for authenticated requests.
Step2: Obtain API keys
Go to the Dashboard after creating a Stripe account. The dashboard contains information like developers’ API keys, view transactions, and customer reports. Click on Activate Payment and enter business type and business details. Once you fill details you will be able to accept payments.
There are two Stripe API keys – the secret key and the Stripe publishable API key. The secret key is used for server-side operations and the publishable is are used for client side operations. Never reveal the server-side key to anyone. You need to verify your account before Stripe restricts your account.
Step3: Install the Stripe library
Stripe library is language specific. Depending on the programming language you are using, you need to install the Stripe API Library. The library is easy to integrate and you can use the developer tool to install the Stripe Library
Step4: Set up server-side integration
To use the Stripe API on your server, include the Stripe library in your code and initialize it with your Secret Key. This step varies depending on the programming language you’re using.
Step 5: Create a checkout form
After installing the library and setting up the server-side integration, you need to create a checkout form. This is where the customer will enter all the payment information such as credit card number, CVV, expiration date. You can create a form from the Stripe Library.
Step 6: Client-side tokenization
To ensure the card details are secure, you should tokenize payment data on the client-side. Tokenization entails encrypting the card information and creating a distinct token from it. As a result, your server will never come into contact with sensitive card information. The token is then processed by your server after being transmitted there.
Step 7: Create a charge
You can create a charge, now that you have customer information. A charge is a payment you collect from a customer.
Also read: How to use Slack API; a step-by-step integration guide and full documentation list
Stripe API docs references
The Stripe API is organized around REST. The Stripe API docs references is a great resource for developers. It contains the following
-
- API Reference: The Stripe API reference is the main source for developers wishing to integrate Stripe into their program. It has comprehensive information on methods, request parameters, response handling, and errors -handling. You can find the API reference here.
- API versioning : Stripe API versioning supports backward compatibility. You can indicate the specific Stripe version you want to use by providing it the Stripe-version header. Consult the “API Versioning” section of the API Reference for more details.
- Authentication: Stripe uses API keys to verify to authenticate queries. You can manage and view your on the Stripe dashboard. The API has two sets of keys: Publishable keys and Secret Keys. Never reveal your keys in public, especially on public forums like GitHub.
- Webhooks : Stripe uses webhooks to send real-time notifications for account-related events in your Stripe account or connected accounts. You can configure the webhooks from the dashboard.
- Payment methods: Stripe supports various payment method such as credit and debit cards, bank transfers, and digital wallets. The API reference gives instructions on how to build, get access to, administer, and integrate payment.
- Stripe API Changelog: The Stripe API Changelog documents all the updates and modifications made to the Stripe API. It documents about updated features, enhancements, and issue corrections. You can ensure compatibility with the most recent API versions by keeping up with the changelog.
- Stripe API Tutorial: Stripe provides an in-depth API tutorial that walks you step-by-step through the integration of Stripe into your application. Setting up your Stripe account, using the API, managing webhooks, and managing payments are all covered in this tutorial.
The Stripe API documentation tool is a user-friendly interface to explore the documentation and search for specific topic. The code examples are an excellent base to build your code.
Stripe API examples
In this section learn how to leverage the Stripe API to process payment seamlessly. You can use the Stripe API examples to create payment intent, collect customer details, handle card authentication, and confirm payment. We have used Stripe API in popular programming languages. The step 1 : set-up portion is common for most languages
Step1: Setup the Stripe CLI
Install
To install the CLI through the command line, download and extract a versioned ZIP file for your operating system. To install the Stripe CLI with homebrew run
brew install stripe/stripe-cli/stripe
Authenticate
Login and authenticate to your Stripe user Account to generate restricted keys.
Command line command-
stripe login
Press the Enter to complete the authentication process
Your pairing code is: enjoy-enough-outwit-win
This pairing code verifies your authentication with Stripe.
Press Enter to open the browser or visit https://dashboard.stripe.com/stripecli/confirm_auth?t=THQdJfL3x12udFkNorJL8OF1iFlN8Az1 (^C to quit)
Confirm setup
Now that you have installed the CLI, you can make a single API request to Create a product
stripe products create \
–name=”My First Product” \
–description=”Created with the Stripe CLI”
Look for the product identifier (in id) in the response object. Save it for the next step.
If everything worked, the command-line displays the following response.
{
“id”: “prod_LTenIrmp8Q67sa”,
“object”: “product”,
“active”: true,
“attributes”: [],
“created”: 1668198126,
“default_price”: null,
“description”: “Created with the Stripe CLI”,
“identifiers”: {},
“images”: [],
“livemode”: false,
“metadata”: {},
“name”: “My First Product”,
“package_dimensions”: null,
“price”: null,
“product_class”: null,
“shippable”: null,
“sku”: “my-first-product-10”,
“statement_descriptor”: null,
“tax_code”: null,
“type”: “service”,
“unit_label”: null,
“updated”: 1668198126,
“url”: null
}
Now call Create a price to attach a price of 30 USD. Swap the placeholder in product with your product identifier (for example, prod_LTenIrmp8Q67sa).
stripe prices create \
–unit-amount=3000 \
–currency=usd \
–product=”{{PRODUCT_ID}}”
If everything worked you get following response
{
“id”: “price_1KzlAMJJDeE9fu01WMJJr79o”,
“object”: “price”,
“active”: true,
“billing_scheme”: “per_unit”,
“created”: 1652636348,
“currency”: “usd”,
“livemode”: false,
“lookup_key”: null,
“metadata”: {},
“nickname”: null,
“product”: “prod_Lh9iTGZhb2mcBy”,
“recurring”: null,
“tax_behavior”: “unspecified”,
“tiers_mode”: null,
“transform_quantity”: null,
“type”: “one_time”,
“unit_amount”: 3000,
“unit_amount_decimal”: “3000”
}
How to use Stripe PHP API
Step1: Setup the Stripe CLI
Step2: Manage third-party dependencies
You can use Composer to manage third-party dependencies from Packagist
which allows you to add new libraries and include them in your PHP projects.
Installer Composer
From the command line download Composer using the instructions.
Ste3: Install the PHP Server0side SDK
The latest version of the Stripe PHP server-side SDK is v10.0.0. It supports PHP versions 5.6.0+..Check your PHP version.
php –version
Install the library
Install the library with Composer, a package manager for PHP:
composer require stripe/stripe-php
After you install the library with Composer, it’s automatically added as a dependency in your project’s composer.json file. For example:
{
“require”: {
“stripe/stripe-php”: “^10.0.0”
}
}
To use the bindings, use Composer’s autoload. For example:
{
“require”: {
“stripe/stripe-php”: “^10.0.0”
}
}
require_once(‘vendor/autoload.php’);
Step 4: Run your first SDK request
Now that you have the PHP SDK installed, you can create a subscription Product and attach a Price with a couple API requests. We’re using the product identifier returned in the response to create the price in this example.
<?php
require_once(‘vendor/autoload.php’);
$stripe = new \Stripe\StripeClient(“sk_test_tR3PYbcVNZZ796tH88S4VQ2u”);
$product = $stripe->products->create([
‘name’ => ‘Starter Subscription’,
‘description’ => ‘$12/Month subscription’,
]);
echo “Success! Here is your starter subscription product id: ” . $product->id . “\n”;
$price = $stripe->prices->create([
‘unit_amount’ => 1200,
‘currency’ => ‘usd’,
‘recurring’ => [‘interval’ => ‘month’],
‘product’ => $product[‘id’],
]);
echo “Success! Here is your premium subscription price id: ” . $price->id . “\n”;
?>
Save the file as created_price.php. from the command line . cd to the directory you saved the file. Run
php create_price.php
If everything works properly you will see the following response. Save these identifiers and use them while building your integration.
How to use Stripe API Typescript
Step1: Set Up a TypeScript Project If you don’t already have a TypeScript project set up, start by creating a new directory for your project and initializing it with TypeScript. Open your terminal and navigate to the project directory. Run the following commands:
mkdir stripe-api-project
cd stripe-api-project
npm init -y
npm install typescript –save-dev
Step2: Install the Stripe TypeScript Library To use the Stripe API with TypeScript, you’ll need to install the Stripe TypeScript library. Run the following command in your terminal:
npm install @stripe/stripe-js –save
This command installs the official Stripe TypeScript library, which provides type definitions and utility functions for working with the Stripe API.
Step3: Create TypeScript Files In your project directory, create a TypeScript file (e.g., index.ts) to write your TypeScript code. Open the file in a code editor.
Step4: Import the Stripe TypeScript Library At the top of your index.ts file, import the Stripe TypeScript library as follows:
import { Stripe } from ‘@stripe/stripe-js’;
Step5: Initialize the Stripe Object Create a function to initialize the Stripe object. Inside this function, use the loadStripe function from the Stripe library to load the Stripe.js script and initialize the Stripe object. Here’s an example:
async function initializeStripe(): Promise<Stripe | null> {
const stripe = await import(‘@stripe/stripe-js’);
const stripeApiKey = ‘YOUR_STRIPE_PUBLIC_KEY’; // Replace with your actual Stripe publishable key
return stripe.loadStripe(stripeApiKey);
}
Step6: Use Stripe Elements Next, create a function to handle the payment form submission. In this function, use the Stripe object to create a Stripe Elements instance and mount it to a container element. Here’s an example:
async function handlePaymentFormSubmission() {
const stripe = await initializeStripe();
if (stripe) {
const elements = stripe.elements();
const cardElement = elements.create(‘card’);
cardElement.mount(‘#card-element’); // Replace with the ID of your card element container
// Handle form submission and tokenization
const form = document.getElementById(‘payment-form’) as HTMLFormElement;
form.addEventListener(‘submit’, async (event) => {
event.preventDefault();
const { token, error } = await stripe.createToken(cardElement);
if (error) {
// Handle error
} else {
// Use the token for payment processing
const tokenId = token.id;
// Send the token to your server for processing
}
});
}
}
Step7: Compile and Run
How to use Stripe API React
To use the Stripe API with React, you’ll need to install the Stripe JavaScript library and integrate it into your React application. Here’s a step-by-step guide on how to use the Stripe API with React:
Step1: Set Up a React Project If you don’t already have a React project set up, start by creating a new directory for your project and initializing it with React. Open your terminal and navigate to the project directory. Run the following command:
npx create-react-app stripe-react-project
This command sets up a new React project with Create React App.
Step2: Install the Stripe JavaScript Library
To use the Stripe API with React, you’ll need to install the Stripe JavaScript library. Run the following command in your terminal:
npm install @stripe/stripe-js –save
This command installs the official Stripe JavaScript library, which provides the necessary functions and methods for working with the Stripe API.
Step3: Create a Stripe Component In your React project
Create a new component that will handle Stripe-related functionality. For example, you can create a component named StripeForm.js. Open the file in a code editor.
Step4: Import the Stripe JavaScript Library
In your StripeForm.js file, import the Stripe JavaScript library as follows:
import { loadStripe } from ‘@stripe/stripe-js’;
Step5: Initialize the Stripe Object
Inside your StripeForm component, create a function to initialize the Stripe object. Use the loadStripe function from the Stripe library to load the Stripe.js script and initialize the Stripe object. Here’s an example:
async function initializeStripe() {
const stripeApiKey = ‘YOUR_STRIPE_PUBLIC_KEY’; // Replace with your actual Stripe publishable key
const stripe = await loadStripe(stripeApiKey);
// Use the stripe object for payment processing
}
Step6: Use Stripe Elements
Next, within your StripeForm component, you can use Stripe Elements to collect payment information. You can use the Stripe Elements React components provided by the Stripe JavaScript library. Here’s an example of creating a card input element:
import { CardElement, useElements, useStripe } from ‘@stripe/react-stripe-js’;
function StripeForm() {
const stripe = useStripe();
const elements = useElements();
// Handle form submission and payment processing
const handleSubmit = async (event) => {
event.preventDefault();
// Perform payment processing using the stripe and elements objects
};
return (
<form onSubmit={handleSubmit}>
<CardElement />
<button type=”submit”>Pay</button>
</form>
);
}
Step7: Compile and Run
Compile and run your React project by running the following command in your terminal:
npm start
How to use Stripe API Nodejs
Step1: Setup the Stripe CLI
Step2: Install the Node.js server-side SDK
The latest version of the Stripe Node.js server-side SDK s v12.0.0. It supports Node.js versions 12+.
Check your Node version:
node –version
Initialize Node
npm init
Initialize the library
Install the library with npm, a package manager for Node:
npm install stripe –save
After you install the library with npm, the library is automatically added as a dependency in your project’s package.json file. For example:
{
“name”: “stripe-node-example”,
“version”: “1.0.0”,
“description”: “A Stripe demo”,
“main”: “index.js”,
“scripts”: {
“node “: “node create_price.js”,
“test”: “echo \”Error: no test specified\” && exit 1″
},
“author”: “”,
“license”: “ISC”,
“dependencies”: {
“stripe”: “^12.0.0”
}
}
Step3: Run your first SDK request
Now that you have the Node.js SDK installed, you can create a subscription Product and attach a Price with a couple API requests. The Node.js SDK returns promises which can be used as chainable callbacks. To demonstrate, we’re passing the product identifier returned in the Product response to create a Price
in this example.
const stripe = require(‘stripe’)(‘sk_test_tR3PYbcVNZZ796tH88S4VQ2u’);
stripe.products.create({
name: ‘Starter Subscription’,
description: ‘$12/Month subscription’,
}).then(product => {
stripe.prices.create({
unit_amount: 1200,
currency: ‘usd’,
recurring: {
interval: ‘month’,
},
product: product.id,
}).then(price => {
console.log(‘Success! Here is your starter subscription product id: ‘ + product.id);
console.log(‘Success! Here is your premium subscription price id: ‘ + price.id);
});
});
If you everything worked in the command line show the following response. Save the identifiers so you can use them while building your applications.
Success! Here is your starter subscription product id: price_0KxBDl589O8KAxCG1alJgiA6
Success! Here is your starter subscription price id: price_0KxBDm589O8KAxCGMgG7scjb
How to use Stripe Express Js API
Step1: Set Up an Express.js Project
If you haven’t already set up an Express.js project, start by creating a new directory for your project and initializing it with Express.js. Open your terminal and navigate to the project directory. Run the following commands:
mkdir stripe-express-project
cd stripe-express-project
npm init -y
npm install express –save
Step2: Install the Stripe Node.js Library
To use the Stripe API with Express.js, you’ll need to install the Stripe Node.js library. Run the following command in your terminal:
npm install stripe –save
This command installs the official Stripe Node.js library, which provides the necessary functions and methods for interacting with the Stripe API.
Step3: Set Up Stripe Secret Key Obtain your Stripe Secret Key from the Stripe Dashboard. You’ll need to set the Secret Key in your Express.js application’s environment variables. You can use a package like dotenv to manage your environment variables.
Step4: Set Up Express.js Server Create an Express.js server file (e.g., server.js) and open it in a code editor. Import the required modules and set up your Express.js server. Here’s a basic example to get started:
const express = require(‘express’);
const stripe = require(‘stripe’)(process.env.STRIPE_SECRET_KEY);
const app = express();
// Configure Express.js middleware, routes, and other settings
// Start the server
app.listen(3000, () => {
console.log(‘Server is running on port 3000’);
});
Step5: Handle API Requests
In your Express.js server file, you can define routes to handle different API requests. For example, to create a charge, you can define a route as follows:
app.post(‘/create-charge’, async (req, res) => {
try {
const { amount, currency, source } = req.body;
// Create a charge using the Stripe API
const charge = await stripe.charges.create({
amount: amount,
currency: currency,
source: source,
});
// Return the charge object as the response
res.json(charge);
} catch (error) {
// Handle any errors that occur during the charge creation
res.status(500).json({ error: error.message });
}
});
Step6: Test the API
You can now test your Stripe Express.js API by sending HTTP requests to the defined routes. You can use tools like Postman or cURL to send requests to your Express.js server.
How to use Stripe API Django
Set up the Django API
Create a Django project called StripeApp with Django Rest framework library installed.
Create a new app in our StripeApp project root
python manage.py startapp payments
Ensure the urls.py, views.py, settings/py, and urls.py are visible in the project structure.
Install the Stripe Library
pip install –upgrade stripe
Sign up and get publishable and secret Key and copy the keys in your Django project.
payments/views.pystripe.api_key = ‘sk_test_’ # your real key will be much longer
Make a test request to the Stripe API
Creae a simple view making a stripe payment to check if your key is valid.
# payments/views.py@api_view([‘POST’])
def test_payment(request):test_payment_intent = stripe.PaymentIntent.create(
amount=1000, currency=’pln’,
payment_method_types=[‘card’],
receipt_email=’test@example.com’)return Response(status=status.HTTP_200_OK, data=test_payment_intent)
Connect the view with the URL in payments/urls.py
# payments/urls.pyfrom django.conf.urls import url
from payments import viewsurlpatterns = [
url(r’^test-payment/$’, views.test_payment),
]
Now define the payments URL prefix in stripeapp/urls.py.
# stripeapp/urls.pyurlpatterns = [
path(‘admin/’, admin.site.urls),
# add this line
path(‘payments/’, include(‘payments.urls’))
]
Now send a request to (http://localhost:8000/payments/test-payment) using Postman. If successful you should get JSON object like
{
“id”: “pi_123”, #you will have a unique id every time
“object”: “payment_intent”,
“amount”: 1000,
“amount_capturable”: 0,
“amount_received”: 0,
“application”: null,
“application_fee_amount”: null,
…
}
How to use Stripe Ruby API
In this section we focus on how to use Stripe API. Stripe server side libraries (also known as SDK) help you interact with the Stripe REST APIs.
Initial Setup
Click the sign in to login to the Stripe doc site and start using your test mode API keys to authenticate requests.
Step1: Follow steps mention Stripe CLI
Step2: Manage third-party dependencies
It is best to use Rub to manage third-party dependencies if any. This allows you to add new libraries and use them in your projects. Check if RubuyGem is installed.
gem –version
If you get the response RubyGem is not found, you can download RubyGems from their downloads page.
Step3: Install the Ruby server-side SDK
The latest version of the Stripe Ruby server-side SDK is v8.0.0. It supports Ruby versions 2.3+.
Check your Ruby version:
ruby -v
Install the library
Create a gem file and install the generated gem using a bundler with RubyGems.
Add the latest version of the Stripe gem to a project:
bundle add stripe
Install the required gems from your specified sources:
bundle install
Step4: Run your first SK
All Ruby SDK are installed, you can create a subscription Product and attach a Price with some API requests.
For example
require ‘rubygems’
require ‘stripe’
Stripe.api_key = “sk_test_tR3PYbcVNZZ796tH88S4VQ2u”
starter_subscription = Stripe::Product.create(
name: ‘Starter Subscription’,
description: ‘$12/Month subscription’,
)
starter_subscription_price = Stripe::Price.create(
currency: ‘usd’,
unit_amount: 1200,
recurring: {interval: ‘month’},
product: starter_subscription[‘id’],
)
puts “Success! Here is your starter subscription product id: #{starter_subscription.id}”
puts “Success! Here is your starter subscription price id: #{starter_subscription_price.id}”
Save the file as create_price.rb. From the command line cd to go directory where you saved the file and run
ruby create_price.rb
If everything worked you should get the following response
Success! Here is your starter subscription product id: price_0KxBDl589O8KAxCG1alJgiA6
Success! Here is your starter subscription price id: price_0KxBDm589O8KAxCGMgG7scjb
How to use Stripe Python API
Step1: Manage third-party dependencies
We recommend use the venv module to manage third-party dependencies. The module permits you to add new libraries and include them in your Python 3 projects.
In the command line type
third-party dependencies
On GNU/MacOS bash
python3 -m venv env
source env/bin/activate
Step2: Install Python server-side SDK
The latest version of the Stripe Python server-side SDK is v5.0.0. It supports Python versions 2.7, 3.6+.
Check your Python version:
python3 –version
Install the library
Install the library from PyPi a package manager for Python:
pip3 install –upgrade stripe
Next, specify the following version in your requirements.txt file:
stripe>=5.0.0
Step3: Run your first SDK request
Now that you have installed Python SDK, you can create a subscription Product and attach a Price with a couple API requests. We’re using the product identifier returned in the response to create the price in this example.
import stripe
stripe.api_key = “sk_test_tR3PYbcVNZZ796tH88S4VQ2u”
starter_subscription = stripe.Product.create(
name=”Starter Subscription”,
description=”$12/Month subscription”,
)
starter_subscription_price = stripe.Price.create(
unit_amount=1200,
currency=”usd”,
recurring={“interval”: “month”},
product=starter_subscription[‘id’],
)
# Save these identifiers
print(f”Success! Here is your starter subscription product id: {starter_subscription.id}”)
print(f”Success! Here is your starter subscription price id: {starter_subscription_price.id}”)
Save the file as create_price.py. From the command line, cd to the directory containing the file you just save and run.
python3 create_price.py
If everything works, the command line shows the following response. Save these identifiers so you can use them while building your integration.
Success! Here is your starter subscription product id: price_0KxBDl589O8KAxCG1alJgiA6
Success! Here is your starter subscription price id: price_0KxBDm589O8KAxCGMgG7scjb
How to use Stripe API Jar
Step1: Download the Stripe API Jar First, you need to download the Stripe API Jar file. Visit the Stripe website and download the latest version of the Stripe API Jar.
Step2: Set Up Your Java Project Create a new Java project or open an existing one in your preferred integrated development environment (IDE). Make sure you have the necessary dependencies and build tools set up.
Step3: Add the Stripe API Jar to Your Project Copy the downloaded Stripe API Jar file to your project’s directory. In your IDE, right-click on your project’s name and select “Properties” or “Build Path” (depending on your IDE) to open the project settings. Look for the “Libraries” or “Dependencies” tab and click on it. Then, click on the “Add JARs” or “Add External JARs” button and select the Stripe API Jar file you downloaded.
import com.stripe.Stripe;
import com.stripe.model.Charge;
import com.stripe.exception.StripeException;
import com.stripe.model.Customer;
Step4: Set Your Stripe API Key Before making any API calls, you need to set your Stripe API key. Obtain your API key from the Stripe Dashboard. In your Java code, add the following line and replace “YOUR_STRIPE_API_KEY” with your actual API key:
Stripe.apiKey = “YOUR_STRIPE_API_KEY”;
Step5: Make API Calls Now, you can start making API calls using the Stripe API Jar. You can perform various actions, such as creating charges, managing customers, creating subscriptions, and more. Here’s an example of creating a charge:
Map<String, Object> params = new HashMap<>();
params.put(“amount”, 2000); // Amount in cents
params.put(“currency”, “usd”);
params.put(“source”, “tok_visa”); // Example card token
try {
Charge charge = Charge.create(params);
System.out.println(“Charge created: ” + charge);
} catch (StripeException e) {
// Handle exception
e.printStackTrace();
}
How to use Stripe API WordPress
A free WordPress fundraising plugin called Paymattic works with the Stripe payment gateway. Several website accept payment with Paymattic. It features subscription payments and on-off payments. Paymattic’s user-friendly interface makes it simple to manage payments forms.
- First go to Paymattic > Payment Gateway from your WordPress dashboard.
- Click on Stripe tab in the left navigation tab.
The Stripe setting page will open. Select test mode or live mode in the setting page. After choosing your preferred mode you will need publishable and secret key.
- You can get the keys once you log in to your Stripe dashboard and go to the Developers options.
- Now navigate to API keys and find the publishable and secret key.
- Copy paste keys into the respective fields in Paymattic > Payment Gateway > Stripe.
- Click Save Settting Button to finish the integration.
You need to create a form to see how Stripe works with Payymatic.
To create your form go to Paymattic > Create Form.
- Click on the Add New Form option.
- Click on Advance Editor to build a form from scratch.
- Add all your required form fields.
- At last, add Stripe payment gateway from the payment method fields.
- Configure your desired settings for Stripe checkout in the Card Elements (Stripe) field.
- Click on the Update Fields button.
Also read: How to use ChatGPT API; a step-by-step integration guide and full documentation list
Stripe API pricing
Stripe API pricing is transparent. There are two models
- Integrated model – The model gives you complete access to the payment platform with pay-as-you-go pricing. The payment is 2.9% + 30 Cents. There are no set up fees, monthly fees or hidden fees in this model.
- Customized packages- You can set up a customized package for your business. This model is ideal for businesses with a large payment volume or high value transactions. You can speak with an expert for more information.
Most used Stripe APIs
The most used Stripe API are
- Customer – the API is used to create, delete and update customer profiles
- Payment API – the payment api allows you to accept payment through credit and debit cards or any other payment instrument. You can use the payment API for charges or refunds.
- Invoice API – The invoice API create and send invoices to customer. The API can be used to track transaction history of a customer and customer information.
- Subscription API – This API helps you manage subscriptions for your product and services.
Stripe ACH API
The Stripe ACH API lets you accept payments from US bank accounts. The ACH debit card is a reusable, delayed payment method. It can take 4 business days for a transaction to receive acknowledgment of the success and failure of a transaction.
Stripe connect API
The Stripe connect API lets you route payments between multiple parties. It is ideal for business models like marketplaces and software platforms. The API lets you route payment between businesses, customers, and the recipient.
Stripe charge API
The Stripe Charges API is to charge credit or debit cards. You can retrieve or refund individual charges and list all charges made to an account.
Stripe orders API
The Stripe has decided to wind down the Order API. The API will be depreciated on May 26 2023.
Stripe API pagination
The Stripe API pagination allows you to retrieve bulk lists – list customers, list charges, or list invoices. You can opt for cursor-based pagination or auto pagination.
Stripe API balance transaction
The Stripe API balance transaction represents funds moving through the Stripe account. They are made for each kind of transaction that enters or exits your Stripe account’s balance.
Stripe issuing API
The Stripe issuing API is primarily for businesses to create, manage, and distribute payments instantly. Issuing is available the US, the UK, and countries in the European Economic Area.
cc checker Stripe API
The CC Checker Stripe API checks the validity of the credit card numbers. The API is based on the luhn algorithm and is used to verify if the credit card is real or fake.
Stripe subscription create API
The Stripe subscription create API is used to create new subscription on existing customers. Each customer can have up to 500 active or schedule subscriptions. Subscription model takes recurrent payment from a customer.
Stripe recurring payments API
The Stripe recurring payment API or the subscriptions allow you to charge the customer on recurrent basis and allows customers to pay for products or services regularly.
Stripe Treasury API
Stripe Treasury API is a banking-as-a-service API that lets you embed financial services in your software. Many users use Strip issuing in conjunction with Strip Treasury API to attach cards and spend funds in the account.
Stripe graphql API
The open-source Stripe Graphql API makes it possible to query data from your database and Stripe account in a single GraphQL query.
Stripe Invoice API
The Stripe Invoice API allows you to generate statement of how much is owed by the customer. It is generated on one-off basis or periodically from a subscription.
Shubha writes blogs, articles, off-page content, Google reviews, marketing email, press release, website content based on the keywords. She has written articles on tourism, horoscopes, medical conditions and procedures, SEO and digital marketing, graphic design, and technical articles. Shubha is a skilled researcher and can write plagiarism free articles with a high Grammarly score.
Leave a Reply