react-native-adyen-api v1.0.2
⚡️ react-native-adyen-api
An easy way to call the make a payment api to the Adyen terminal when you use react-native.
Installation
npm install --save react-native-adyen-apiyarn add react-native-adyen-apiImportant: Replace crypto-browserify
Because this library uses react-native-quick-crypto you may need an extra step:
If you are using a library that depends on crypto, instead of polyfilling it with crypto-browserify (or react-native-crypto) you can use react-native-quick-crypto for a fully native implementation. This way you can get much faster crypto operations with just a single-line change!
In your babel.config.js, add a module resolver to replace crypto with react-native-quick-crypto:
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
+ [
+ 'module-resolver',
+ {
+ alias: {
+ 'crypto': 'react-native-quick-crypto',
+ 'stream': 'stream-browserify',
+ 'buffer': '@craftzdog/react-native-buffer',
+ },
+ },
+ ],
...
],
};Then restart your bundler using yarn start --reset-cache.
Now, all imports for crypto will be resolved as react-native-quick-crypto instead.
💡 Since react-native-quick-crypto depends on
streamandbuffer, we can resolve those tostream-browserifyand @craftzdog'sreact-native-buffer(which is faster thanbufferbecause it uses JSI for base64 encoding and decoding).
Usage
For example, you just need to create an object containing the config information of the adyen terminal:
const config =
{
amount: 100,
saleId: "618ca3fc-5272-4184-a1c2",
terminalIp: "192.168.1.19",
poiid: "S1F2-000158212621330",
securityId: '1',
passphrare: '1',
securityVersion: 1,
currency: "SGD",
}
const response = await makeLocalPayment(config)License
MIT