JavaScript

Here are some examples of code snippets in JavaScript.


An example of fetching all payments:

let url = 'https://pos.snapscan.io/merchant/api/v1/payments'
let apiKey = 'your-api-key'

let headers = new Headers()
headers.append('Content-Type', 'application/json')
headers.append('Authorization', `Basic ${btoa(apiKey + ':')}`)

fetch(url, { method: 'GET', headers: headers })
  .then((response) => response.json())
  .then((data) => console.log(data))