This SDK is currently in development. Coming soon :)
$ npm install --save azpay
OR
$ yarn add azpay
import Azpay from 'azpay';
const azpay = Azpay({
id: 'YOUR_MERCHANT_ID',
key: 'YOUR_MERCHANT_KEY',
});
Your need to have the AZPAY object (created before)
try {
const response = await azpay.transaction.sale({
order: {
...
},
payment: {
...
},
billing: {
...
},
urlReturn: ...,
fraud: ...,
});
} catch (error) {
// DEAL WITH ERROR HERE
}
azpay.transaction.sale({
order: {
...
},
payment: {
...
},
billing: {
...
},
urlReturn: ...,
fraud: ...,
}).then((response) => {
// DEAL WITH RESPONSE
}).catch((error) => {
// DEAL WITH ERROR HERE
});
Your need to have the AZPAY object (created before)
try {
const response = await azpay.transaction.paypal({
order: {
...
},
payment: {
...
},
billing: {
...
},
urlReturn: ...,
});
} catch (error) {
// DEAL WITH ERROR HERE
}
azpay.transaction.paypal({
order: {
...
},
payment: {
...
},
billing: {
...
},
urlReturn: ...,
}).then((response) => {
// DEAL WITH RESPONSE
}).catch((error) => {
// DEAL WITH ERROR HERE
});
You must have a config file on the root called test.config.js:
export default {
merchant_id: 'YOUR_MERCHANT_ID',
merchant_key: 'YOUR_MERCHANT_KEY',
};
Run on your terminal:
yarn test
PS: The test.config.js file is ignored on .gitignore