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-restful-smart-payment-button

v1.0.0

Published

[![npm version](https://badge.fury.io/js/avatar-bot-cli.svg)](https://badge.fury.io/js/paypal-acc-vault) ![build succeeded](https://img.shields.io/badge/build-succeeded-brightgreen.svg) ![Test passing](https://img.shields.io/badge/Tests-passing-brightgree

Downloads

4

Readme

PayPal Smart Payment Button Solution

npm version build succeeded Test passing

:point_right: English :point_right: 简体中文

PayPal Smart Payment Button (SPB) provides the seamless checkout experience with a simplified solution. It supports several purchase methods including the local payments in European countries. You can also check this document which explains how the button works. From this example, it also introduce the usage of PayPal Webhook, which provides a channel to receive notification messages from the payment events.

Work Flow

SPB normally involves the frontend and backend in the payment process. In the Restful API, it mainly focus on three parts no matter you decide to implment in the client or server side:

  1. Create Order (API Documentation): We need to create the order intention, which can either get the customer payment instantly or after a certain of time. Besides of the intention, you could also define the payer and purchase information. Make sure that the country code is using our format when you need to define the address. Here is the example of body structure:
{
  "intent": "AUTHORIZE",
  "payer": {
    "name": {
        "given_name": "Tse",
        "surname": "Sunny"
    },
    "address": {
        "address_line_1": "123 ABC Street",
        "address_line_2": "Apt 2",
        "admin_area_2": "Ma On Shan",
        "admin_area_1": "New Territories",
        "postal_code": "00852",
        "country_code": "HK"
    },
    "email_address": "[email protected]",
    "phone": {
        "phone_type": "MOBILE",
        "phone_number": {
            "national_number": "11231242343"
        }
    }
	},
  "purchase_units": [
    {
      "amount": {
        "currency_code": "HKD",
        "value": "12000.32"
      },
      "shipping": {
	        "name": {
	            "full_name": "Sunny Tse"
	        },
	        "address": {
	            "address_line_1": "123 ABC Street",
		        "address_line_2": "Apt 2",
		        "admin_area_2": "Ma On Shan",
		        "admin_area_1": "New Territories",
		        "postal_code": "00852",
		        "country_code": "HK"
	        }
	    }
    }
  ]
}
  1. Authorize Payment (API Documentation): If you chose to get the customer's payment after few days, you will need to call this API and authorize the payment. So that the issuer bank will hold the amount of money from the customer's credit card until the payment is going to be captured. You need to use the order ID retrieved from the Order API in order to call this API.
  2. Capture Payment (API Doucumentation): You will need to call this API when you decide to get the payment after the customer finished the purchase process. Please make sure that the payment status is completed under the payment and captures parameters:
...

"payments": {
    "captures": [
        {
        "id": "3C679366HH908993F",
        "status": "COMPLETED",
        "amount": {
            "currency_code": "USD",
            "value": "100.00"
        },

...

Postman

The following document demonstrates the work flow of how the payment captured from the API call.

Installation

> npm install

Run

> npm start

After the project is compiled, please access to http://localhost:3000 to try the example.

Contribution

We are welcome anyone to folk this repository and make PR to contribute this example project by creating test cases or code changes :smile:.