Authentication

Test Mode vs Live Mode

RexPay account supports two modes of operation.

  • 1
    Live Mode: The transactions are real, and the effects are real. This should only be used once you have thoroughly tested your integration with this method and are confident that it is working properly.
  • 2
    Test Mode: The transactions are not real, but the effects are the same. The only cards that can be used are our test cards and bank accounts.

To switch between Live and Test modes, click Developer Tools at the bottom of the menu sidebar as seen below.

Authentication live mode

Retrieving your API Keys

Your API keys are very vital to making requests successfully to our servers. When you create an account on RexPay, a secret ket is generated for you. To get your keys on test mode:

  • 1
    Log into your RexPay account
  • 2
    Navigate to Developer Tools
  • 3
    View and copy your secret keys.
Authentication live mode

Authorizing API calls

All API calls on RexPay are authenticated. API requests made without authorization will fail with the status code 401: Unauthorized.

Your secret key can perform unrestricted actions on your RexPay account. It should remain confidential and be stored only on your servers, preferably as an environment variable. Ensure it is not included in your Git repository or front-end JavaScript code.

RexPay Uses Basic Auth. To authorize API calls from your server, pass your email as username and your secret key as password. This means passing an Authorization header with a value of ""Basic", base64_string_of_username_and_password({Username:Password})".

For example, an API call could look like this in Node.js:

const response = await got.post("https://pgs-sandbox.globalaccelerex.com/api/pgs/payment/v2/createPayment", {
  headers: {
    Authorization: Basic Base64Encode(CLIENT_ID:SECRET_KEY}
  },
  json: {
    // Your payload
  }
});

If you are using one of our backend SDKs, you do not need to pass the header manually; instead you will provide your keys when initialising the library.

// Install with: npm i RexPay-node-v3
        
const RexPay = require('RexPay-node-v3');
const rxp = new RexPay (process.env.RXP_PUBLIC_KEY, process.env.RXP_SECRET_KEY);
// Subsequqent calls will automatically have the header added
rxp.Misc.bvn({bvn: "123456789010"})
  .then(response => console.log(response)

Did you find this page helpful?