Skip to content

westinpay-com/API

Repository files navigation

API

Automatic payment documentation with WestinPay Wallet

API

Automatic payment documentation with WestinPay Wallet

Introduction

This section describes the WestinPay payment gateway API.


WestinPay API is easy to implement in your business software. Our API is well formatted URLs, accepts cURL requests, returns JSON responses.

You can use the API in test mode, which does not affect your live data. The API key is use to authenticate the request and determines the request is valid payment or not. For test mode just use the sandbox URL and In case of live mode use the live URL from section Initiate Payment .

Supported Currencies

This section describes the currencies supported by WestinPay


WestinPay allows to make transaction with below currencies. Any new currency may update in future.

Currency Name Currency Symbol Currency Code
United States Dollar $ USD
GBP £ GBP
Euro EUR
Canadian dollar CAD CAD
Swiss franc CHF CHF
Australian dollar A$ AUD
Hong Kong dollar HK$ HKD
Indian rupee INR
New Zealand dollar NZ$ NZD
Russian ruble RUB
Romanian leu L RON
Bulgarian lev BGN BGN
Swedish krona kr SEK
Turkish lira TRY
Brazilian real R$ BRL
Polonya zlotisi PLN
South Africa ZAR R ZAR
Bitcoin BTC
ETHEREUM Ξ ETH
DOGECOİN Ð DOGE
AZN MANAT AZN
TRX TRX TRX
USDT.TRC20 USDT

Get The Api Key

This section describes how you can get your api key.


Login to your WestinPay merchant account. If you don't have any ? https://westinpay.com/merchant

Next step is to find the Api Key menu in your dashboard sidebar. Click the menu.

The api keys can be found there which is Public key and Secret key. Use these keys to initiate the API request. Every time you can generate new API key by clicking Generate Api Key button. Remember do not share these keys with anyone.

Initiate Payment

This section describes the process of initaiing the payment.


To initiate the payment follow the example code and be careful with the perameters. You will need to make request with these following API end points.

Live End Point: https://westinpay.com/payment/initiate

Test End Point: https://westinpay.com/sandbox/payment/initiate

Test Mode Mail: test_mode@mail.com

Test Mode Verification Code: 222666

Request Method: POST

Request to the end point with the following parameters below.

Param Name Param Type Description
public_key string (50) Required Your Public API key
identifier string (20) Required Identifier is basically for identify payment at your end
currency string (4) Required Currency Code, Must be in Upper Case. e.g. USD,EUR
amount decimal Required Payment amount.
details string (100) Required Details of your payment or transaction.
ipn_url string Required The url of instant payment notification.
success_url string Required Payment success redirect url.
cancel_url string Required Payment cancel redirect url.
site_logo string/url Required Your business site logo.
checkout_theme string Optional Checkout form theme dark/light. Default theme is light
customer_name string (30) Required Customer name.
customer_email string (30) Required Customer valid email.
<?php
    $parameters = [
        'identifier' => 'DFU80XZIKS',
        'currency' => 'USD',
        'amount' => 100.00,
        'details' => 'Purchase T-shirt',
        'ipn_url' => 'http://example.com/ipn_url.php',
        'cancel_url' => 'http://example.com/cancel_url.php',
        'success_url' => 'http://example.com/success_url.php',
        'public_key' => 'your_public_key',
        'site_logo' => 'https://westinpay.com/assets/images/logoIcon/logo.png',
        'checkout_theme' => 'dark',
        'customer_name' => 'John Doe',
        'customer_email' => 'john@mail.com',

    ];

    //live end point
    $url = "https://westinpay.com/payment/initiate";

    //test end point
    $url = "https://westinpay.com/sandbox/payment/initiate";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);

    //$result contains the response back.
?>
//Error Response.
{
    "error": "true",
    "message": "Invalid api key"
}

//Success Response.
{
    "success": "ok",
    "message": "Payment Initiated. Redirect to url.",
    "url":"http://example.com/initiate/payment/checkout?payment_id=eJSAASDxdrt4DASDASVNASJA7893232432cvmdsamnvASF"
}
<?php
    $parameters = [
        'identifier' => 'DFU80XZIKS',
        'currency' => 'USD',
        'amount' => 100.00,
        'details' => 'Purchase T-shirt',
        'ipn_url' => 'http://example.com/ipn_url.php',
        'cancel_url' => 'http://example.com/cancel_url.php',
        'success_url' => 'http://example.com/success_url.php',
        'public_key' => 'your_public_key',
        'site_logo' => 'https://westinpay.com/assets/images/logoIcon/logo.png',
        'checkout_theme' => 'dark',
        'customer_name' => 'John Doe',
        'customer_email' => 'john@mail.com',

    ];

    //live end point
    $url = "https://westinpay.com/payment/initiate";

    //test end point
    $url = "https://westinpay.com/sandbox/payment/initiate";

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_POSTFIELDS,  $parameters);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $result = curl_exec($ch);
    curl_close($ch);

    //$result contains the response back.
?>