🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

shift4

Package Overview
Dependencies
Maintainers
0
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

shift4

Shift4 Node.js Library

2.2.0
latest
Source
npm
Version published
Weekly downloads
101
-41.28%
Maintainers
0
Weekly downloads
 
Created
Source

Shift4 Node.js Library

Build

Installation

npm install shift4

Quick start

const api = require('shift4')('sk_test_my_secret_key');
(async () => {
  try {
    const customer = await api.customers.create({
      email: 'user@example.com',
      description: 'User description'
    })
    console.log('ID of created customer object: ', customer.id);

    const card = await api.cards.create(customer.id, {
      number: '4242424242424242',
      expMonth: '12',
      expYear: '2025',
      cvc: '123',
      cardholderName: 'John Smith'
    })
    console.log('ID of created card object: ', card.id);

    const charge = await api.charges.create({
      amount: 1000,
      currency: "EUR",
      card: card.id,
      customerId: customer.id
    });
    console.log('ID of created charge object: ', charge.id);
  } catch (e) {
    console.error(e)
    // handle errors
  }
})();

API reference

Please refer to detailed API docs (linked) for all available fields

For further information, please refer to our official documentation at https://dev.shift4.com/docs

Developing

To connect to different backend:

var api = require('shift4')({
  secretKey: 'sk_test_my_secret_key',
  apiUrl: 'https://api.myshift4env.com',
  uploadsUrl: 'https://uploads.myshift4env.com'
});

To run tests:

SECRET_KEY=sk_test_my_secret_key npm run test

To run style check:

npm run stylecheck

Keywords

payments

FAQs

Package last updated on 06 Mar 2025

Did you know?

Socket

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.

Install

Related posts