@spbrewery/adyen

2.0.3 • Public • Published

Brewery Adyen Client

Promise based wrapper client for Adyen Web SDK for Javascript.

Install

npm i @spbrewery/adyen

Usage

The methods return promises which are compatible to be used on async/await functions. The default configuration settings can be overridden on the constructor of BreweryAdyen.

const { BreweryAdyen } = require('@spbrewery/adyen');
const breweryAdyenClient = new BreweryAdyen({
  apiKey: 'YOUR-API-KEY',
  apiUrl: 'https://your.redirect.url',
  checkoutUrl: 'https://checkout-test.adyen.com/checkout/v40/', // default value
  merchantAccount: 'YOUR MERCHANT ACCOUNT',
  sdkVersion: '1.6.5', // default value
});

adyenClient.paymentSession({
  countryCode: 'PH',
  ...restOfParameters,
})
  .then((data) => {
    console.log(data);
  })
  .catch(error) => {
    console.log(error);
  });

API

adyenClient
  /**
   * Initiate a payment session with Adyen.
   *
   * @param {string} amountCurrency - The currency code of the amount to be paid
   * @param {number} amountValue - The amount to be paid
   * @param {string} countryCode - The country code of the payer
   * @param {string} reference - Unique identifier for the transaction
   * @param {string} returnUrl - The URL to be used as landing page after the transaction
   * @param {string} shopperReference - Unique identifier of the payer
   *
   * @returns {Object}
   */
  .paymentSession({
    amountCurrency: '',
    amountValue: '',
    countryCode: '',
    reference: '',
    returnUrl: '',
    shopperLocale: '',
  })

  /**
   * Verify the payment result.
   *
   * @param {string} payload - The encrypted payment result data to be verified
   *
   * @returns {Object}
   */
  .paymentResult({
    payload: '',
  });

Helper Methods

These are auxillary methods that are exported with the package.

/**
 * Decode the given JWT string.
 */
const { decodeJwt } = require('@spbrewery/adyen');

decodeJwt('eyJjaGVja291dHNob3BwZXJCYXNlVXJsIjoiaHR0...');

Readme

Keywords

Package Sidebar

Install

npm i @spbrewery/adyen

Weekly Downloads

29

Version

2.0.3

License

MIT

Unpacked Size

13.8 kB

Total Files

12

Last publish

Collaborators

  • mbundukin
  • adevera
  • kurt.arellano
  • francis.ong
  • sp-techadmin