sagepay
A Node.js package for Sage Pay's server integration protocol.
Install
npm i sagepay
Usage
The docs rely heavily on "Sage Pay Server Integration and Protocol Guidelines 3.00", specifically pages 44+ (Character Sets and Encoding, Transaction Registration, Notification of Transaction Results, URLs).
Refer to these guidelines to build better understanding on registering, verifying, and testing payments from Node.js.
Note: All option and return properties match the casing of the guidelines.
sagepay.registerTransaction(options)
Registers payment with Sage Pay. Uses NotificationURL
option to send a request
back to your server (where you use sagepay.finishTransaction
). See the
guidelines for more required options.
Additional options:
testing
switches to Sage Pay's test server. Defaults tofalse
Returns a promise containing the response data. Use NextURL
to
redirect your client to Sage Pay's transaction portal.
sagepay
sagepay.transactionResults(request)
Takes a http.Server
request that comes from Sage Pay's server (after
registering the transaction) and returns a promise of the results. Use
sagepay.finishTransaction
after.
sagepay
sagepay.finishTransaction(response, options)
Writes a http.Server
response to Sage Pay finishing the transaction.
Uses RedirectURL
option to send the user from the transaction portal back to
your website. See the guidelines for more options.
Returns a promise and resolves when successful.
sagepay
sagepay.testCards
A list of different test cards in the format:
See the guidelines for more details
sagepay.fields
List of all request and response fields with proper casing.
License
MIT © Jamen Marz