Skip to content

cURL Examples

Command-line examples for testing and integrating EasySlip API.

API v2 Examples

Get Application Info

bash
curl -X GET https://api.easyslip.com/v2/info \
  -H "Authorization: Bearer YOUR_API_KEY"

Verify by Payload

bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": "00000000000000000000000000000000000000000000000",
    "checkDuplicate": true
  }'

Verify by Payload with Options

bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "payload": "00000000000000000000000000000000000000000000000",
    "remark": "Order #12345",
    "matchAccount": true,
    "matchAmount": 1500.00,
    "checkDuplicate": true
  }'

Verify by Image

bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "image=@/path/to/slip.jpg" \
  -F "checkDuplicate=true"

Verify by Base64

bash
# Read image and encode to Base64
BASE64_IMAGE=$(base64 -i /path/to/slip.jpg)

curl -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"base64\": \"${BASE64_IMAGE}\", \"checkDuplicate\": true}"

Verify by URL

bash
curl -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/slips/slip-12345.jpg",
    "checkDuplicate": true
  }'

API v1 Examples

Get Application Info

bash
curl -X GET https://developer.easyslip.com/api/v1/me \
  -H "Authorization: Bearer YOUR_API_KEY"

Verify by Payload (GET)

bash
curl -X GET "https://developer.easyslip.com/api/v1/verify?payload=YOUR_QR_PAYLOAD&checkDuplicate=true" \
  -H "Authorization: Bearer YOUR_API_KEY"

Verify by Image (POST)

bash
curl -X POST https://developer.easyslip.com/api/v1/verify \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@/path/to/slip.jpg" \
  -F "checkDuplicate=true"

Verify by Base64 (POST)

bash
curl -X POST https://developer.easyslip.com/api/v1/verify \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAA...",
    "checkDuplicate": true
  }'

Verify by URL (POST)

bash
curl -X POST https://developer.easyslip.com/api/v1/verify \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/slips/slip-12345.jpg",
    "checkDuplicate": true
  }'

Verify TrueMoney Wallet

bash
curl -X POST https://developer.easyslip.com/api/v1/verify/truewallet \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@/path/to/truemoney-slip.jpg" \
  -F "checkDuplicate=true"

Generate PromptPay QR

bash
curl -X POST https://developer.easyslip.com/api/v1/qr/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "PROMPTPAY",
    "msisdn": "0812345678",
    "amount": 100.00
  }'

Generate K-Shop QR

bash
curl -X POST https://developer.easyslip.com/api/v1/qr/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "KSHOP",
    "ref1": "ORDER12345",
    "amount": 250.00
  }'

Shell Scripts

Verify Slip Script

bash
#!/bin/bash
# verify-slip.sh

API_KEY="${EASYSLIP_API_KEY}"
SLIP_FILE="$1"
EXPECTED_AMOUNT="$2"

if [ -z "$SLIP_FILE" ]; then
    echo "Usage: ./verify-slip.sh <slip-image> [expected-amount]"
    exit 1
fi

if [ ! -f "$SLIP_FILE" ]; then
    echo "Error: File not found: $SLIP_FILE"
    exit 1
fi

# Build request
CURL_OPTS=(-X POST "https://api.easyslip.com/v2/verify/bank")
CURL_OPTS+=(-H "Authorization: Bearer $API_KEY")
CURL_OPTS+=(-F "image=@$SLIP_FILE")
CURL_OPTS+=(-F "checkDuplicate=true")

if [ -n "$EXPECTED_AMOUNT" ]; then
    CURL_OPTS+=(-F "matchAmount=$EXPECTED_AMOUNT")
fi

# Execute request
RESPONSE=$(curl -s "${CURL_OPTS[@]}")

# Parse response
SUCCESS=$(echo "$RESPONSE" | jq -r '.success')

if [ "$SUCCESS" = "true" ]; then
    TRANS_REF=$(echo "$RESPONSE" | jq -r '.data.rawSlip.transRef')
    AMOUNT=$(echo "$RESPONSE" | jq -r '.data.rawSlip.amount.amount')
    IS_DUP=$(echo "$RESPONSE" | jq -r '.data.isDuplicate')

    echo "Verified successfully!"
    echo "  Transaction: $TRANS_REF"
    echo "  Amount: $AMOUNT THB"

    if [ "$IS_DUP" = "true" ]; then
        echo "  WARNING: Duplicate slip!"
    fi
else
    ERROR=$(echo "$RESPONSE" | jq -r '.error.message')
    echo "Error: $ERROR"
    exit 1
fi

Check Quota Script

bash
#!/bin/bash
# check-quota.sh

API_KEY="${EASYSLIP_API_KEY}"

RESPONSE=$(curl -s -X GET "https://api.easyslip.com/v2/info" \
  -H "Authorization: Bearer $API_KEY")

SUCCESS=$(echo "$RESPONSE" | jq -r '.success')

if [ "$SUCCESS" = "true" ]; then
    APP_NAME=$(echo "$RESPONSE" | jq -r '.data.application.name')
    USED=$(echo "$RESPONSE" | jq -r '.data.application.quota.used')
    MAX=$(echo "$RESPONSE" | jq -r '.data.application.quota.max')
    REMAINING=$(echo "$RESPONSE" | jq -r '.data.application.quota.remaining')

    echo "Application: $APP_NAME"
    echo "Quota: $USED / $MAX (Remaining: $REMAINING)"

    # Alert if above 90%
    if [ "$MAX" != "null" ]; then
        PERCENT=$((USED * 100 / MAX))
        if [ $PERCENT -ge 90 ]; then
            echo "WARNING: Quota usage at ${PERCENT}%!"
        fi
    fi
else
    ERROR=$(echo "$RESPONSE" | jq -r '.error.message')
    echo "Error: $ERROR"
    exit 1
fi

Testing with jq

Parse Response

bash
# Get transaction reference
curl -s -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payload": "YOUR_PAYLOAD"}' | jq '.data.rawSlip.transRef'

# Get amount
curl -s -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payload": "YOUR_PAYLOAD"}' | jq '.data.rawSlip.amount.amount'

# Get sender info
curl -s -X POST https://api.easyslip.com/v2/verify/bank \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"payload": "YOUR_PAYLOAD"}' | jq '.data.rawSlip.sender'

Environment Setup

Using Environment Variables

bash
# Export API key
export EASYSLIP_API_KEY="your-api-key-here"

# Use in curl
curl -X GET https://api.easyslip.com/v2/info \
  -H "Authorization: Bearer $EASYSLIP_API_KEY"

Using .env File

bash
# Load from .env file
export $(cat .env | xargs)

# Or use direnv
# echo 'export EASYSLIP_API_KEY="your-key"' >> .envrc
# direnv allow

Bank Slip Verification API for Thai Banking