0.0.10 • Published 6 years ago

azpay v0.0.10

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

AZPAY SDK for Node (WARNING: IN DEVELOPMENT)

This SDK is currently in development. Coming soon :)

Installing

$ npm install --save azpay
OR
$ yarn add azpay

Creating AZPay object

import Azpay from 'azpay';

const azpay = Azpay({
  id: 'YOUR_MERCHANT_ID',
  key: 'YOUR_MERCHANT_KEY',
});

Creating a Sale transaction

Your need to have the AZPAY object (created before)

Using Javascript ES8 ASYNC/AWAIT:

try {
  const response = await azpay.transaction.sale({
    order: {
      ...
    },
    payment: {
      ...
    },
    billing: {
      ...
    },
    urlReturn: ...,
    fraud: ...,
  });
} catch (error) {
  // DEAL WITH ERROR HERE
}

Using Promises:

azpay.transaction.sale({
  order: {
    ...
  },
  payment: {
    ...
  },
  billing: {
    ...
  },
  urlReturn: ...,
  fraud: ...,
}).then((response) => {
    // DEAL WITH RESPONSE
  }).catch((error) => {
    // DEAL WITH ERROR HERE
  });

Creating a Paypal transaction

Your need to have the AZPAY object (created before)

Using Javascript ES8 ASYNC/AWAIT:

try {
  const response = await azpay.transaction.paypal({
    order: {
      ...
    },
    payment: {
      ...
    },
    billing: {
      ...
    },
    urlReturn: ...,
  });
} catch (error) {
  // DEAL WITH ERROR HERE
}

Using Promises:

azpay.transaction.paypal({
  order: {
    ...
  },
  payment: {
    ...
  },
  billing: {
    ...
  },
  urlReturn: ...,
}).then((response) => {
    // DEAL WITH RESPONSE
  }).catch((error) => {
    // DEAL WITH ERROR HERE
  });

How to run the tests (For SDK developers only)

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

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago