1.0.11 • Published 5 years ago

secureframe-react v1.0.11

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

SecurePay SecureFrame React component

A React component to register a credit card with SecurePay.

Installation

npm install secureframe-react

Usage

import SecureFrame from 'secureframe-react'

const Payment = props => (
  <SecureFrame
    merchantId={props.merchantId}
    reference={props.customerName}
    onSignPayment={subject => handleSignPayment(subject)}
    onPayment={payload => handlePayment(payload)}
  />
)

The onSignPayment property is a callback that must return a promise that resolves with the SHA-1 fingerprint. The SecurePay Merchant ID and Transaction Password must be prepended to the plaintext and the result run through a SHA-1 digest. This would typically be performed on a server where the Transaction Password is securely stored.

function handleSignPayment (subject) {
  return fetch('/sign-payment', {
    method: 'POST',
    body: subject
  })
  .then(response => response.json())
  .then(json => json.fingerprint)
}

The onPayment property is a callback that is triggered when the iframe posts a message to the React container (as described above). This is typically done when the customer completes the SecureFrame hosted payment form. The optional payload field contains data provided by the page handling the final POST of the payment form.

1.0.11

5 years ago

1.0.10

5 years ago

1.0.9

5 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago