0.1.0 • Published 5 years ago

@leopard0505/payment-request v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

payment-request

This is a program for payment request on client side.

usage

First, install this module in your project.

$ npm install @leopard0505/payment-request

Import this module in your source code and call like below.

import paymentRequest from '@leopard0505/payment-request'

const payment = new paymentRequest(displayItems)
payment.pay().then(/* ... */).catch(/* ... */)

or

import paymentRequest from '@leopard0505/payment-request'

const params = { /* ... */ }
const payment = new paymentRequest(params, displayItems)
payment.pay().then(/* ... */).catch(/* ... */)

args

default

const params = {
  URL: 'pay',
  currency: 'JPY',
  PUBLISHABLE_STRIPE_API_KEY: 'YOUR_PUBLISHABLE_STRIPE_API_KEY'
}

const displayItems = [
  {
    label: 'Original donation amount',
    amount: { currency: 'JPY', value: '65.00' }
  },
  {
    label: 'Friends and family discount',
    amount: { currency: 'JPY', value: '-10.00' }
  }
]

License

This software is released under the MIT License, see LICENSE.txt.