REST Purchase


In order to purchase vouchers, this API needs to be called .
The POST request will be send over HTTPS to the voucherServices/REST/v1/purchaseVoucher endpoint.

In our API Specifications you can find a full list of parameters that can be sent in the initial request.

   Authentication token needs to be set in header for each request. To generate authentication token, please refer Auth token API.

Sample Request

{
    "customer": {
    "customerId": "1"
    },

    "voucher": {
    "amount": "200",
    "quantity": "2"
    },

    "totalAmount": "1900.00",
    "currency": "EUR",

    "authentication": {
    "partner": "1",
    "checksum": "4118b83ebe8bfd2d84b6a65b7b2f80cc"
    },

    "redirectUrl": "http://localhost:3000/purchase"

}
            

Sample Response

The redirect.parameters needs to be sent over POST request in the URL encoded x-www-form-urlencoded format on redirect.url .

{
        "customerId": "1",
        "partnerId": "1",
        "redirect": {
        "url ": "https: //www.redirectUrl.com/transaction/Checkout",
        "parameters": [
        {
        "name": "toid",
        "value": "12345"
        },
        {
        "name": "checksum",
        "value": "94a2450c70b96028b68c27502ba9d1e7"
        },
        {
        "name": "totype",
        "value": "totype"
        },
        {
        "name": "description",
        "value": "My Order Description"
        },
        {
        "name": "amount",
        "value": "400.00"
        },
        {
        "name": "TMPL_AMOUNT",
        "value": "400.00"
        },
        {
        "name": "orderdescription",
        "value": "ORDER101"
        },
        {
        "name": "redirecturl",
        "value": "https://www.redirecturl.com/voucher/CommonFrontEndServlet?vTrackingId=1"
        },
        {
        "name": "currency",
        "value": "EUR"
        },
        {
        "name": "TMPL_CURRENCY",
        "value": "EUR"
        },
        {
        "name": "firstName",
        "value": "John"
        },
        {
        "name": "lastName",
        "value": "Doe"
        },
        {
        "name": "notificationUrl",
        "value": "htt//www.notificationUrl.com/voucher/CommonBackEndServlet?vTrackingId=427"
        }
        ]
        },
        "status": "success",
        "timestamp": "2019-08-20 16:56:02"
}

Hashing Rule For Request

supports MD5 Cryptographic Hash for the authenticity of payment request sent to the server.


Below are the description of fields used for generating checksum.
  • customerId <Customer ID as shared by >
  • partnerId <Partner Id of the customer >
  • redirectUrl <Redirect URL where the customer needs to redirected after the payment >
  • currency <Currency of the transaction >
  • totalAmount <Total amount of the transaction >

How to generate Checksum for request ?

Checksum can be calculated with the following combination and needs to be send along with the authentication parameters in each server-to-server request:
<customerId>|<partnerId>|<redirectUrl>|<currency>|<totalAmount>


Sample Code

Copyright © . All Rights Reserved