Skip to main content

Stripe

Stripe allows you to accept payments online, manage subscriptions, send money and much more. This integration provides a client for Stripe API

Official Websitehttps://stripe.com
Tagspaymentsapi

Credential configuration

To configure this credential, you need the secret api key of your Stripe account.

Optionally, you can set most of the extra config parameters you can see here.

Here is an example of a filled credential configuration form in YepCode:

Stripe Snippets available in Editor

note

The title is the triggering text for YepCode to autocomplete the script.

Integration

New integration from credential
const stripe = yepcode.integration.stripe('credential-slug')
New integration from plain authentication data
const stripe = require('stripe')('my-apy-key', {
apiVersion: '2020-08-27',
maxNetworkRetries: 1,
timeout: 1000
});

Create a Customer

Create a customer
stripe.customers.create({
name: 'customer-name',
email: 'customer-email'
}).then((data) => {
console.log(data);
}).catch(console.error);

Create a Product

Create a product
stripe.products.create({
name: 'product-name'
}).then((data) => {
console.log(data);
}).catch(console.error);

Retrieve a Product

Retrieve a product
stripe.products.retrieve(
'product-id'
).then((data) => {
console.log(data);
}).catch(console.error);

List Products

List products
stripe.products.list().then((data) => {
console.log(data);
}).catch(console.error);

Create Payment Method

Create payment method
stripe.paymentMethods.create({
type: 'card',
card: {
number: 'card-number',
exp_month: exp-month,
exp_year: exp-year,
cvc: 'cvc',
},
}).then((data) => {
console.log(data);
}).catch(console.error);

Attach Payment Method to Customer

Attach payment method to customer
stripe.paymentMethods.attach(
'paymentMethod-id',
{customer: 'customer-id'}
).then((data) => {
console.log(data);
}).catch(console.error);

Create Payment Intent

Create payment intent
stripe.paymentIntents.create({
amount: amount,
currency: 'currency',
customer: 'customer-id'
}).then((data) => {
console.log(data);
}).catch(console.error);

Confirm Payment Intent

Confirm payment intent
stripe.paymentIntents.confirm(
'paymentIntent-id',
{ payment_method: 'paymentMethod-id' }
).then((data) => {
console.log(data);
}).catch(console.error);