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

@paypal/smart-payment-buttons

v5.0.165

Published

Serverside rendered ButtonJS

Downloads

999

Readme

PayPal Smart Payment Buttons

build status code coverage npm version apache license

Smart Payment Buttons application, including:

  • Server-side buttons renderer
  • Client side logic

Please note: this repo is not intended as a public entry point into the smart buttons. Please see:

  • Smart Payment Buttons developer docs: https://developer.paypal.com/docs/checkout/
  • PayPal JavaScript SDK repo (PayPal JavaScript SDK): https://github.com/paypal/paypal-checkout-components
  • Smart Payment Buttons Framework examples: https://github.com/paypal/paypal-checkout-components/tree/main/demo
  • Smart Payment Buttons Issues: https://github.com/paypal/paypal-checkout-components/issues

Development

Running the development server

npm install
npm start

Then load http://localhost:8003/smart/buttons?clientID=alc_client1 in your browser.

Running tests

npm test

Release

Release a new version

npm run release

Deploy the new version

npm run deploy

Activate traffic on the new version

npm run activate

Activate traffic on a specific version

npm run activate 2.0.123

Activate traffic on a specific version to a specific environment

npm run activate 2.0.123 sandbox

Activate traffic on a specific version to multiple specific environments

npm run activate 2.0.123 'local stage sandbox'

Using local paypal-checkout-components

This repo uses the button renderer from github.com/paypal/paypal-checkout-components. To pull in local changes from paypal-checkout-components to this module:

  • Clone and set up the github.com/paypal/paypal-checkout-components repo
  • Run this module with BUTTON_RENDER_DIR=/path/to/paypal-checkout-components npm start
  • Load http://localhost/smart/buttons?clientID=alc_client1 in your browser

Preflight call

This section is relevant to integrations passing data-user-id-token, for vaulted/one-click button renders.

Rendering the vaulted button can be time consuming. The Smart Buttons server allows a pre-flight call to be made. This pre-caches the button, ready to be rendered immediately when the buyer lands on your page. This should typically be done in one of the following places:

  • On a page immediately prior to displaying the Smart Buttons
  • On a single-page app prior to displaying the Smart Buttons, if the Smart Buttons are displayed after a user action
  • On the server-side prior to rendering the cart or checkout page containing the Smart Buttons

To invoke, simply make a call to the following URL:

https://www.paypal.com/smart/buttons/preload?client-id=CLIENT_ID&user-id-token=ID_TOKEN

The following URL params can be passed:

  • client-id: (required) Your PayPal client id
  • user-id-token: (required) Your customer's id token
  • merchant-id (optional) The merchant id or email of the transaction payee
  • amount: (optional) The estimated amount of the transaction
  • currency: (optional) The currency of the transaction

This request can be made as a fire-and-forget call: you do not need to wait for a response, or check the status code of the response.