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

Stripe snippets available in YepCode editor

note

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

Integration

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

Create a customer

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

Create a product

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

Retrieve a product

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

List products

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

Create payment method

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

Attach payment method to customer

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

Create payment intent

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

Confirm payment intent

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