SDK
Call the Checkslip API from your code with the official SDKs for JavaScript/TypeScript, Go, PHP and Rust. Install the one for your language; the SDK's methods send the HTTP requests for you.
Every example reads the API key from the CHECKSLIP_API_KEY environment variable. Keep keys on your server only. More in Authentication with an API key.
The install commands name no version, so you get the latest release at install time. Each package page lists its versions and what changed.
Only a FOUND lookup uses a credit, in every SDK. Every outcome is explained in Transfer lookup outcomes.
JavaScript / TypeScript
Package on npm · Source on GitHub
Install
npm install @checkslip/sdkQuick start
import { Checkslip } from "@checkslip/sdk";
const checkslip = new Checkslip({ apiKey: process.env.CHECKSLIP_API_KEY });
const check = await checkslip.slips.lookup({
qr: "00330006000001010306902126302105340875102TH9104F86F",
});
if (check.outcome === "FOUND" && "sender" in check.slip) {
console.log(check.slip.amount.satang / 100, "THB");
}Go
Package on pkg.go.dev · Source on GitHub
Install
go get github.com/Checkslip/sdk-goQuick start
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/Checkslip/sdk-go"
)
func main() {
client := checkslip.NewClient(os.Getenv("CHECKSLIP_API_KEY"))
res, err := client.Slips.Lookup(context.Background(), &checkslip.LookupParams{
QR: "00330006000001010306902126302105340875102TH9104F86F",
})
if err != nil {
log.Fatal(err)
}
switch res.Outcome {
case checkslip.OutcomeFound:
fmt.Println("amount:", res.Slip.Amount)
case checkslip.OutcomeNotFound:
fmt.Println("the bank has no transfer for this reference")
default:
fmt.Println("outcome:", res.Outcome)
}
}PHP
Package on Packagist · Source on GitHub
Install
composer require checkslip/sdkIf your project has no PSR-18 client yet, add one. Guzzle is the common choice. The client finds an installed one by itself, so there is nothing to wire up.
composer require checkslip/sdk guzzlehttp/guzzleQuick start
<?php
use Checkslip\Client;
use Checkslip\Model\Slip;
$checkslip = new Client(apiKey: getenv('CHECKSLIP_API_KEY'));
$check = $checkslip->slips->lookup(
slip: '00330006000001010306902126302105340875102TH9104F86F',
);
if ($check->isFound() && $check->slip instanceof Slip) {
echo $check->slip->amount->toBaht(), " THB\n";
}Rust
Package on crates.io · Source on GitHub
Install
cargo add checkslipThe example runs on the tokio async runtime.
cargo add tokio --features "macros rt-multi-thread"Quick start
use checkslip::{Client, LookupRequest, Outcome};
#[tokio::main]
async fn main() -> checkslip::Result<()> {
let client = Client::from_env()?; // reads CHECKSLIP_API_KEY
let check = client
.slips()
.lookup(LookupRequest::qr("00330006000001010306902126302105340875102TH9104F86F"))
.await?;
match check.outcome {
Outcome::Found => {
let slip = check.slip.as_full().expect("FOUND carries the full record");
println!("{} satang from {}", slip.amount.satang, slip.sender.bank.code);
}
other => println!("outcome {other}"),
}
Ok(())
}You can send a slip image instead of the QR text. Each SDK README shows how.
Every request and response field is on Look up a transfer with the bank.