Api Documentation

Currencies

Our supported currencies are listed below.

Currency Name Currency Symbol Currency Code
US Dollar$USD
EuroEUR
British Pound£GBP
BitcoinBTC
EthereumΞETH
Indian RupeeINR
Mexican Peso$MXN

Obtain API Key

Login to your merchant account. Go to Merchant App → API Access Key. Your Public Key and Secret Key can be found in the API Access Key menu. These keys are mandatory for API requests. Use the Regenerate button to generate new API keys. Keep your keys private and never share them.

Access Token POST

Access Token is required to make payment requests through the API. It serves as a secure key to authorize and validate your transactions. Generate the Access Token using your API credentials (Public Key) and include it in the header of every payment request. Keep the token secure and update it regularly.

Live URL: https://api.swix.pro/merchant/access-token

Test URL: https://api.swix.pro/sandbox/access-token

Request method: POST

// Example: POST request with your public key
$url = 'https://api.swix.pro/merchant/access-token';
$publicKey = 'your_public_key';

$response = Http::withHeaders([
    'Content-Type' => 'application/json',
])->post($url, [
    'public_key' => $publicKey,
]);

return $response->json();

Make Payment POST

To get started with the payment process, follow the example code and ensure the parameters are set correctly. Use the provided API endpoints for your requests.

Live URL: https://api.swix.pro/merchant/make-payment

Test URL: https://api.swix.pro/sandbox/make-payment

Request method: POST

Request to the endpoint with the following parameters:

Param Name Param Type Description
amount float|integer Required The amount to be charged for the transaction.
currency string (4) Required Currency code (e.g. USD, EUR).
transaction_id string (12) Required A unique identifier for the transaction, 12 alphanumeric characters.
description string (20) Required A brief description of the transaction.
ipn_url string (255) Optional Notification URL where you want to receive the notification.
callback_url string (255) Optional Redirect the user to this URL after the transaction is completed.
customer_name string (50) Optional Customer name.
customer_email string (255) Optional Customer email.
// Set up the request headers
$headers = [
    'Content-Type' => 'application/json',
    'Authorization' => 'Bearer ' . $authToken,
];

// Request payload
$data = [
    'amount' => 100.00,
    'currency' => 'USD',
    'transaction_id' => 'ABC123456789',
    'description' => 'Test payment',
    'ipn_url' => 'https://yourdomain.com/ipn',
    'callback_url' => 'https://yourdomain.com/callback',
    'customer_name' => 'John Doe',
    'customer_email' => 'johndoe@example.com',
];

Example Response

Success and error response examples.

Success 200

{
  "status": "success",
  "payment_url": "https://..."
}

Error (400/401)

// Token invalid or expired (401)
{
  "status": "error",
  "message": "Token is invalid or expired"
}

// For validation rules error (400)
{
  "status": "error",
  "message": ["The transaction id has already been taken."]
}

IPN POST

An IPN is a POST request sent to your business application URL to notify about a payment status update. It provides real-time data for identifying and verifying transactions. Key parameters:

  • URL: Your IPN URL.
  • Method: POST.

You will receive the following parameters:

Param Name Description
statusPayment success status.
signatureHash signature used to verify the payment at your end.
dataIncludes charges, amount, currency, payment transaction ID, and other relevant details.