Pay Advantage API Demonstration Page

This page is simply to demonstrate the basics of connecting to the API service, managing your token, and making your first call.

Please make sure you view the source code (JavaScript) for this page and read all comments.

You should translate the code used in this example into whichever code runs on your server (.Net, Java, PHP, Ruby).

JavaScript would not be a good choice as it runs client side and you would need to setup many IPs and expose your API accounts; however, It is easy to test with, translate from, and provide one page demo's.

Click on any of these grey boxes to remove them once read.

1. To get started, choose either "Sandbox" or "Live" API services

2. The next step is to enter a username and password shown under 'More -> API' in your Pay Advantage account (note that credentials are different on sandbox and live).

3. Click the 'Authenticate' button below and it will send of an ajax request for an access token to access the API service. If successful you will see the token below.

Please note that your access token should be cached (as is done in this example). The access token has a limited lifetime. On token expiry, further requests will fail and the example buttons will be disabled. You can then click 'Authenticate' again to retrieve a new token. This is how we expect the service to be used, you do not request a new token for every call.

Now you must set the "Authorization" header for each request using the "Bearer" auth token above. On expiry get a new token and then use this token. For example:

setRequestHeader('Authorization', 'Bearer XXXXXXX_THE_AUTH_TOKEN_ABOVE_GOES_HERE_XXXXXXX');

Make sure you use a Capital 'B' for 'Bearer' and a single space after.

4. On successful receipt of token, these following demonstration buttons will be enabled. They send ajax requests to get lists of either Customers, Payments or Debit Batches.