
Product
Introducing Rust Support in Socket
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
stripe-for-node
Advanced tools
A simple and extensible wrapper for the Stripe API supporting customer creation, account creation (custom/express), vendor onboarding, and more Stripe account-related operations.
Supply Chain Security
Vulnerability
Quality
Maintenance
License
Unpopular package
QualityThis package is not very popular.
Found 1 instance in 1 package
Critical CVE and Socket optimized override available
A simple and extensible wrapper for the Stripe API supporting customer creation, account management, and various Stripe operations.
npm install stripe-for-node
Set up your .env
file with the following variables:
Variable | Description |
---|---|
NODE_ENV | Should be production or development |
STRIPE_KEY_PROD | Your Live Stripe Secret Key |
STRIPE_KEY_TEST | Your Test Stripe Secret Key |
HOME_PAGE | redirect URL after Stripe account onboarding/KYC processes |
PRODUCT_NAME | Your product name for statement descriptor |
PRODUCT_WEBSITE_URL | Your business website URL used in Stripe business profile |
DO_SPLIT_PAYMENT | Set to true to enable split payments |
First, import and configure the package:
require('dotenv').config()
const stripe = require('stripe-for-node')
Create a new Stripe customer with an email address.
// Create customer
const customer = await stripe.createAccount('customer@example.com')
// Response example:
{
id: 'cus_xxx',
email: 'customer@example.com',
object: 'customer'
// ... other Stripe customer properties
}
Update an existing customer's name and address.
const stripeId = 'cus_xxx' // Stripe customer ID
const name = 'John Doe'
const address = {
line1: '123 Main St',
city: 'San Francisco',
state: 'CA',
postal_code: '94111',
country: 'US'
}
const updatedCustomer = await stripe.updateAccount(stripeId, name, address)
Creates a new Stripe customer account.
Parameters:
email
(string, required): Customer's email addressReturns: Promise resolving to Stripe Customer object
Updates an existing customer's details.
Parameters:
stripeId
(string, required): Stripe customer IDname
(string, required): Customer's full nameaddress
(object, required): Customer's address containing:
line1
(string): Street addresscity
(string): Citystate
(string): State/Provincepostal_code
(string): ZIP/Postal codecountry
(string): Two-letter country codeReturns: Promise resolving to updated Stripe Customer object
The package uses Promise-based error handling. Wrap your calls in try-catch blocks:
try {
const customer = await stripe.createAccount('customer@example.com')
console.log('Customer created:', customer)
} catch (error) {
console.error('Error:', error.message)
}
All methods return promises and should be used with try-catch blocks:
try {
const result = await stripe.methodName(params)
} catch (error) {
console.error('Error:', error.message)
}
Creates a new Stripe Custom Connect account for vendors.
email
(string): Vendor's email addresscountry
(string): Two-letter country code (e.g., 'US', 'GB')Delete a Stripe account (customer).
stripeId
(string): Stripe account ID to deleteCreates a token for card information.
const cardToken = await stripe.createAccountToken({
card: {
number: '4242424242424242',
exp_month: 12,
exp_year: 2024,
cvc: '123'
}
})
Adds a card to an existing customer using the card token.
const customerId = 'cus_xxx'
const cardToken = 'tok_xxx'
const card = await stripe.addCard(customerId, cardToken)
Sets a card as the default payment method.
stripeCustomerId
(string): Customer ID (e.g., 'cus_xxx')stripeCardId
(string): Card ID to set as default (e.g., 'card_xxx')Retrieves card with default card flag.
id
(string): Customer ID (e.g., 'cus_xxx')Removes a card from customer's payment methods.
id
(string): Customer ID (e.g., 'cus_xxx')cardId
(string): Card ID to delete (e.g., 'card_xxx')Adds a bank account to a Stripe account.
stripeId
(string): Customer ID (e.g., 'cus_xxx')routingNo
(string): Bank routing numberaccountNo
(string): Bank account numberaccountHolderName
(string, optional): Account holder namecountry
(string): Two-letter country code (e.g., 'US')currency
(string, optional): Currency code (default: "usd")Note: Routing number not required for EUR/NOK currencies
Adds a card for payout method.
stripeId
(string): Customer ID (e.g., 'cus_xxx')cardid
(string): Card ID (e.g., 'card_xxx')Lists all external accounts (bank accounts and cards).
stripeId
(string): Customer ID (e.g., 'cus_xxx')Removes an external account (bank account or card).
stripeId
(string): Customer ID (e.g., 'cus_xxx')accountId
(string): External account ID (e.g., 'ba_xxx' or 'card_xxx')Sets an external account as default for its currency.
stripeId
(string): Customer ID (e.g., 'cus_xxx')accountId
(string): External account ID (e.g., 'ba_xxx' or 'card_xxx')Note: - PRODUCT_WEBSITE_URL
: Your business website URL used in Stripe business profile
Updates account with KYC (Know Your Customer) information.
stripeId
(string): Stripe account IDemail
(string): Vendor's email addressphone
(string): Phone numberaddress
(object): Address object containing country and other address detailsdob
(object): Date of birth objectname
(object): Object containing first
and last
nameremoteAddress
(string): IP address for TOS acceptancedocs
(object, optional): Verification documentsssnLastFour
(string, optional): Last 4 digits of SSN (for US)personalIdNumber
(string, optional): ID number (SSN for US, PAN for IN)category
(string, optional): Either "Business" or "Individual"Note: Different fields are required based on country (US/IN)
Accepts Terms of Service for a Stripe account.
PRODUCT_WEBSITE_URL
: Your business website URL used in Stripe business profilestripeId
(string): Stripe account IDremoteAddress
(string): IP address for TOS acceptanceCreates a direct charge to a connected Stripe account.
vendorId
: Stripe account ID of the vendoramount
: Charge amount in dollars (automatically converted to cents)Creates a payment charge with optional split payment functionality.
customer
: Stripe customer IDvendor
: Vendor's Stripe account ID for split paymentsamount
: Total charge amount in dollarsvendorAmount
: Amount to transfer to vendor (if split payment enabled)description
: Optional payment descriptioncurrency
: Payment currency (default: "usd")receiptEmail
: Optional email for receiptstatementDescriptor
: Custom statement descriptorcapture
: Whether to capture payment immediately (default: true)Note: Split payments are controlled by DO_SPLIT_PAYMENT
environment variable.
Creates a basic payment charge for Indian transactions without split payment functionality.
customer
: Stripe customer IDvendor
: Vendor's Stripe account ID (not used in this function)amount
: Charge amount in dollars (converted to cents)vendorAmount
: Amount parameter (not used in this function)description
: Optional payment descriptioncurrency
: Payment currency (default: "usd")receiptEmail
: Optional email for receiptstatementDescriptor
: Custom statement descriptorcapture
: Whether to capture payment immediately (default: true)Creates a payment intent with 3D Secure support and optional split payment.
customer
: Stripe customer IDvendor
: Vendor's Stripe account ID for split paymentsamount
: Total charge amount in dollarsvendorAmount
: Amount to transfer to vendor (if split payment enabled)description
: Payment descriptionFeatures:
DO_SPLIT_PAYMENT
environment variablePRODUCT_NAME
for statement descriptorPRODUCT_NAME
: Used in statement descriptorDO_SPLIT_PAYMENT
: Controls payment splitting ("true"/"false")Creates a simple payment intent for Indian transactions.
customer
: Stripe customer IDamount
: Charge amount in dollars (converted to cents)description
: Payment descriptionFeatures:
PRODUCT_NAME
for statement descriptorCreates a payment with multiple transfers to different accounts.
customer
: Stripe customer IDamount
: Total charge amount in dollarstransfers
: Array of transfer objects [{amount: number, stripeId: string}]
transferGroup
: Group identifier for the transferscurrency
: Payment currency (default: "usd")receiptEmail
: Optional email for receiptdescription
: Optional payment descriptionstatementDescriptor
: Custom statement descriptorcapture
: Whether to capture payment immediately (default: true)Features:
Creates a payout to a connected Stripe account.
vendorId
: Stripe account ID of the vendorvendorAmount
: Amount to payout in dollars (converted to cents)currency
: Payout currency (default: "usd")isInstant
: Whether to use instant payout method (default: false)destination
: Specific destination for the payoutFeatures:
Retrieves the current balance for a connected Stripe account.
vendorId
: Stripe account ID to check balance forReturns:
Updates a connected account's payout schedule to manual.
vendorId
: Stripe account ID of the vendorFeatures:
Creates a refund for a specific charge.
chargeId
: ID of the charge to refundFeatures:
Creates a reversal for a previously created transfer.
transferId
: ID of the transfer to reverseamount
: Amount to reverse in dollars (converted to cents)Features:
Creates a new transfer to a connected account.
amount
: Amount to transfer in dollars (converted to cents)destination
: Stripe account ID of the recipienttransferGroup
: Group identifier for the transfercurrency
: Transfer currency (default: "usd")Features:
Uploads a file to Stripe from a given URL.
url
: URL of the file to uploadpurpose
: Stripe file purpose (e.g., 'identity_document', 'dispute_evidence')type
: Custom file type identifierFeatures:
Retrieves details of a connected Stripe account.
id
: Stripe account ID to retrieveRetrieves a customer's details including their default payment method.
id
: Stripe customer IDFeatures:
Creates an account onboarding link for KYC verification.
stripeId
: Stripe account IDHOME_PAGE
: URL to redirect after completion (falls back to env variable)process.env.HOME_PAGE
: Default redirect URL for KYC completionFeatures:
Creates a fresh account onboarding link with additional options.
stripeId
: Stripe account IDHOME_PAGE
: URL to redirect after completion (falls back to env variable)Features:
Updates specific KYC settings for a vendor account.
stripeId
: Stripe account IDremoteAddress
: IP address of the vendor
Features:Retrieves up to 100 payouts for an influencer's connected account.
stripeId
: Stripe account ID of the influencerFeatures:
Retrieves details of a specific payout for an influencer.
stripeId
: Stripe account ID of the influencerpayoutId
: ID of the specific payout to retrieveFeatures:
Updates a vendor's account settings to use manual payout scheduling.
stripeId
: Stripe account ID of the vendorFeatures:
Retrieves paginated list of payouts for a vendor.
vendorId
: Stripe account ID of the vendorstartingAfter
: Pagination cursor (optional)status
: Filter by payout status (optional, defaults to null)Features:
starting_after
Creates a charge for a vendor's connected account.
Features:
Updates a Stripe account's business type.
stripeAccountId
: Stripe account ID to updatebusinessType
: New business type value (e.g., 'individual', 'company')Features:
ISC
Ritik Kumar Sahoo
FAQs
A simple and extensible wrapper for the Stripe API supporting customer creation, account creation (custom/express), vendor onboarding, and more Stripe account-related operations.
We found that stripe-for-node demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.
Product
Socket’s precomputed reachability slashes false positives by flagging up to 80% of vulnerabilities as irrelevant, with no setup and instant results.
Product
Socket is launching experimental protection for Chrome extensions, scanning for malware and risky permissions to prevent silent supply chain attacks.