This page is simply to demonstrate the basics of connecting to the API service, managing your token, and making your first call.
You should translate the code used in this example into whichever code runs on your server (.Net, Java, PHP, Ruby).
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.