API Documentation

Build powerful payment integrations with our developer-friendly APIs. Simple, secure, and scalable.

Getting Started

Welcome to the Siapay API documentation. Our APIs are designed to be simple, secure, and developer-friendly. Follow this guide to quickly integrate Siapay into your application.

Quick Start Guide

1

Create Account

Sign up for a Siapay account and get your API credentials from the dashboard.

2

Get API Keys

Access your test and live API keys from the developer section of your dashboard.

3

Make First Request

Use our API to create your first payment or payout transaction.

Base URL

Production: https://api.siapay.io/v1
Test Mode: https://test-api.siapay.io/v1

Authentication

Siapay uses API keys to authenticate requests. You can find your API keys in your Siapay Dashboard. Authentication is performed via HTTP Bearer authentication.

Using Your API Key

Include your API key in the Authorization header of every request:

curl https://api.siapay.io/v1/payments \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json"

API Key Types

Key Type Environment Description
test_* Test Mode Use for development and testing. No real transactions.
live_* Production Use for real transactions in production.

API Reference

Complete reference for all Siapay API endpoints. All requests should be made over HTTPS with valid authentication.

POST /payments

Create a new payment request for collecting payments from customers.

Request Parameters

Parameter Type Required Description
amount integer Required Amount in smallest currency unit (e.g., paise for INR)
currency string Required Three-letter ISO currency code (e.g., "INR")
customer object Required Customer details object
description string Optional Payment description
metadata object Optional Additional metadata as key-value pairs

Example Request

const payment = await fetch('https://api.siapay.io/v1/payments', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    amount: 50000, // ₹500.00
    currency: 'INR',
    customer: {
      email: 'customer@example.com',
      phone: '+919999999999',
      name: 'John Doe'
    },
    description: 'Order #12345',
    metadata: {
      order_id: '12345'
    }
  })
});

Response

{
  "id": "pay_1234567890",
  "object": "payment",
  "amount": 50000,
  "currency": "INR",
  "status": "created",
  "customer": {
    "email": "customer@example.com",
    "phone": "+919999999999",
    "name": "John Doe"
  },
  "description": "Order #12345",
  "metadata": {
    "order_id": "12345"
  },
  "payment_link": "https://pay.siapay.io/p/pay_1234567890",
  "created_at": 1643723400,
  "expires_at": 1643809800
}
GET /payments/{payment_id}

Retrieve details of a specific payment by its ID.

Path Parameters

Parameter Type Description
payment_id string Unique payment identifier

Webhooks

Webhooks allow you to receive real-time notifications about events in your Siapay account. When an event occurs, we'll send an HTTP POST request to your webhook endpoint.

Setting Up Webhooks

  1. Go to your Siapay Dashboard
  2. Navigate to Developers → Webhooks
  3. Add your webhook endpoint URL
  4. Select the events you want to receive

Webhook Security

All webhook requests include a signature in the X-Siapay-Signature header. Verify this signature to ensure the webhook is from Siapay.

const crypto = require('crypto');

function verifyWebhookSignature(payload, signature, secret) {
  const expectedSignature = crypto
    .createHmac('sha256', secret)
    .update(payload)
    .digest('hex');
  
  return signature === expectedSignature;
}

Error Handling

Siapay uses conventional HTTP response codes to indicate the success or failure of API requests. In general, codes in the 2xx range indicate success, codes in the 4xx range indicate an error that failed given the information provided, and codes in the 5xx range indicate an error with Siapay's servers.

HTTP Status Codes

Code Description
200 Everything worked as expected
400 Bad request - often missing required parameter
401 Unauthorized - invalid API key
404 Not found - requested resource doesn't exist
429 Too many requests - rate limit exceeded
500 Server error - something went wrong on our end

Error Response Format

{
  "error": {
    "code": "resource_not_found",
    "message": "No such payment: pay_1234567890",
    "param": "id",
    "type": "invalid_request_error"
  }
}

SDKs & Libraries

We provide official SDKs for popular programming languages to make integration easier. All SDKs are open source and available on GitHub.

Node.js

npm install @siapay/node

Python

pip install siapay

PHP

composer require siapay/siapay-php

Ruby

gem install siapay

Java

<dependency>
  <groupId>io.siapay</groupId>
  <artifactId>siapay-java</artifactId>
  <version>1.0.0</version>
</dependency>

Go

go get github.com/siapay/siapay-go