brewery-adyen
v1.3.2
Published
Promise based wrapper client for Adyen Web SDK for Javascript
Downloads
3
Readme
Brewery Adyen Client
Promise based wrapper client for Adyen Web SDK for Javascript.
Install
npm i brewery-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
.
// import { BreweryAdyen } from 'brewery-adyen';
const { BreweryAdyen } = require('brewery-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('brewery-adyen');
decodeJwt('eyJjaGVja291dHNob3BwZXJCYXNlVXJsIjoiaHR0...');