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

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 params you can see here.

Here you have 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: {2:amount},
currency: '{3: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: '{3:paymentMethod-id}' }
).then((data) => {
console.log(data);
}).catch(console.error);