npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@sergdudko/stripe-js

v1.1.39

Published

Additional methods for working with stripe-js

Downloads

175

Readme

@sergdudko/stripe-js

Supercharge Your Stripe Integration with Enhanced Methods for stripe-js: Take Full Control of Customer Card Management Right from Your Frontend! Elevate Your Payment Processing Capabilities with Ease and Efficiency.

npm npm NpmLicense GitHub last commit GitHub release

Usage

loadStripe

import { loadStripe } from "@sergdudko/stripe-js";

const stripe = await loadStripe("pk_test_TYooMQauvdEDq54NiTphI7jx");

Stripe.js Documentation

Additional Methods

| Method | Arguments | Description | | ----------------------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------- | | getCustomer | [customer_id], [ephemeral_key] | Get customer. | | confirmPaymentIntentByCard | [client_secret], [card_id], [returnUrl] | Confirm payment intent with the user's payment card (sources api). | | addSourceToCustomer | [source or token], [customer_id], [ephemeral_key] | Add payment card to customer (from source or token, sources api). | | deleteSourceFromCustomer | [source_id], [customer_id], [ephemeral_key] | Delete payment card from customer (sources api). | | getAllCards | [customer_id], [ephemeral_key] | Get all cards from customer (sources api). | | setDefaultCard | [defaultCardId], [customer_id], [ephemeral_key] | Set default card (sources api). | | getDefaultCard | [customer_id], [ephemeral_key] | Get customer default payment card (sources api). | | confirmPaymentIntentByPaymentMethod | [client_secret], [payment_method_id], [returnUrl] | Confirm payment intent with the user's payment method (payment methods api). | | addPaymentMethodToCustomer | [payment_method_id], [customer_id], [ephemeral_key] | Attach payment method to customer (payment methods api). | | deletePaymentMethodFromCustomer | [payment_method_id], [ephemeral_key] | Detach payment method from customer (payment methods api). | | getAllPaymentMethods | [customer_id], [ephemeral_key] | Get all payment methods from customer (payment methods api). | | setDefaultPaymentMethod | [payment_method_id], [customer_id], [ephemeral_key] | Set customer default payment method (payment methods api). |

Examples

stripe.getCustomer(
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.confirmPaymentIntentByCard(
  'pi_3Jrk80HdlMaZle3e1tGtSxiH_secret_mWdWNlqJfkYEoYOml1GqRPyPm',
  'card_1JrMi8HdlMaZle3eSPPOvapJ',
  'https://stripe.com/'
);

stripe.addSourceToCustomer(
  'tok_visa',
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.deleteSourceFromCustomer(
  'card_1JroRSHdlMaZle3e4EIGOZuv',
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.getAllCards(
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.setDefaultCard(
  'card_1JrMi8HdlMaZle3eSPPOvapJ',
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.getDefaultCard(
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.confirmPaymentIntentByPaymentMethod(
  'pi_3Jrk80HdlMaZle3e1tGtSxiH_secret_mWdWNlqJfkYEoYOml1GqRPyPm',
  'pm_1JrMi8HdlMaZle3eSPPOvapJ',
  'https://stripe.com/'
);

stripe.addPaymentMethodToCustomer(
  'pm_1JrMi8HdlMaZle3eSPPOvapJ',
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.deletePaymentMethodFromCustomer(
  'pm_1JrMi8HdlMaZle3eSPPOvapJ',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.getAllPaymentMethods(
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

stripe.setDefaultPaymentMethod(
  'pm_1JrMi8HdlMaZle3eSPPOvapJ',
  'cus_KO9SkBdMeHoMXR',
  'ek_test_YWNjdF8xSFhSd0xIZGxNYVpsZTNlLENrVUxKWWNjZExxSDJDb1VKa1YwaXU5VDZVcmVmQXQ_00drAg7pBQ'
);

Scripts

  • To run linting npm run lint.
  • To run build npm run build.
  • To run testing npm run test.
  • To create docs npm run doc.