Quickstart

Get started with WiaPay API integration in a few simple steps.

Prerequisites

Before you start integrating with WiaPay API, make sure you have the following:

  • API Key - Your unique identifier for API requests
  • API Secret - Used to generate request signatures
  • Callback URL - Endpoint to receive transaction status updates
  • Callback Secret - Used to verify callback signatures

Get Your Credentials

Contact the WiaPay support team to obtain your API credentials. Make sure to provide your server IP addresses for whitelisting.

API Base URL

All API requests should be made to the following base URL:

https://<service_name>.api.wiapay.co/v1

Replace <service_name> with your assigned service name provided by the integration team.

Authentication

Every API request must include the following headers:

HeaderDescription
X-API-KeyYour API Key
X-SignatureHMAC-SHA256 signature
X-TimestampUnix timestamp in seconds
Content-Typeapplication/json

The signature is calculated using HMAC-SHA256 algorithm:

signature = HMAC-SHA256(timestamp + method + path + body, apiSecret)
Learn more about signature generation

Quick Example

Here is a complete example of making a deposit request:

Node.js Example
const crypto = require('crypto');
const axios = require('axios');

const API_KEY = 'your-api-key';
const API_SECRET = 'your-api-secret';
const BASE_URL = 'https://<service_name>.api.wiapay.co';

// Generate signature
function generateSignature(timestamp, method, path, body = '') {
  const message = timestamp + method + path + body;
  return crypto
    .createHmac('sha256', API_SECRET)
    .update(message)
    .digest('hex');
}

// Create deposit transaction
async function createDeposit() {
  const timestamp = Math.floor(Date.now() / 1000).toString();
  const method = 'POST';
  const path = '/v1/deposit';

  const body = {
    merchantTransactionId: 'ORDER-12345',
    amount: 1000,
    currency: 'TRY',
    customer: {
      id: 'user-123',
      name: 'John Doe',
      email: '[email protected]'
    }
  };

  const bodyString = JSON.stringify(body);
  const signature = generateSignature(timestamp, method, path, bodyString);

  const response = await axios.post(BASE_URL + path, body, {
    headers: {
      'X-API-Key': API_KEY,
      'X-Signature': signature,
      'X-Timestamp': timestamp,
      'Content-Type': 'application/json'
    }
  });

  console.log('Transaction created:', response.data);
  // Redirect user to: response.data.data.checkoutUrl
}

createDeposit();

Example Response

{
  "success": true,
  "data": {
    "transactionId": "TXN-abc123def456",
    "merchantTransactionId": "ORDER-12345",
    "amount": 1000,
    "currency": "TRY",
    "status": "pending",
    "checkoutUrl": "https://pay.wiapay.co/pay/abc123",
    "expiresAt": "2024-01-15T12:30:00.000Z",
    "createdAt": "2024-01-15T12:00:00.000Z"
  },
  "timestamp": 1705320000
}

Next Steps