Vouchers

Create Voucher

Create a new voucher.

POST
/vouchers
AuthorizationBearer <token>

In: header

The details required to create a voucher.

descriptionstring

Short description about the voucher.

typestring

The applicable rate type.

Value in"percentage" | "fixed"
codestring

Unique code that will be shared with customers.

amountnumber

Discount amount.

Formatfloat
Range1 <= value
max_redeemsnumber

Max number of redeems.

Range1 <= value <= 1000000
expiresstring

Expiration date in relative time. (e.g. 'In 3 days')

Response Body

curl -X POST "https://api.live.paisr.tech/v2/vouchers" \
  -H "Content-Type: application/json" \
  -d '{
    "description": "string",
    "type": "percentage",
    "code": "string",
    "amount": 1,
    "max_redeems": 1,
    "expires": "string"
  }'
const body = JSON.stringify({
  "description": "string",
  "type": "percentage",
  "code": "string",
  "amount": 1,
  "max_redeems": 1,
  "expires": "string"
})

fetch("https://api.live.paisr.tech/v2/vouchers", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "https://api.live.paisr.tech/v2/vouchers"
  body := strings.NewReader(`{
    "description": "string",
    "type": "percentage",
    "code": "string",
    "amount": 1,
    "max_redeems": 1,
    "expires": "string"
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "https://api.live.paisr.tech/v2/vouchers"
body = {
  "description": "string",
  "type": "percentage",
  "code": "string",
  "amount": 1,
  "max_redeems": 1,
  "expires": "string"
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers;
import java.time.Duration;
import java.net.http.HttpRequest.BodyPublishers;

var body = BodyPublishers.ofString("""{
  "description": "string",
  "type": "percentage",
  "code": "string",
  "amount": 1,
  "max_redeems": 1,
  "expires": "string"
}""");
HttpClient client = HttpClient.newBuilder()
  .connectTimeout(Duration.ofSeconds(10))
  .build();

HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()
  .uri(URI.create("https://api.live.paisr.tech/v2/vouchers"))
  .header("Content-Type", "application/json")
  .POST(body)
  .build();

try {
  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());
  System.out.println("Status code: " + response.statusCode());
  System.out.println("Response body: " + response.body());
} catch (Exception e) {
  e.printStackTrace();
}
using System;
using System.Net.Http;
using System.Text;

var body = new StringContent("""
{
  "description": "string",
  "type": "percentage",
  "code": "string",
  "amount": 1,
  "max_redeems": 1,
  "expires": "string"
}
""", Encoding.UTF8, "application/json");

var client = new HttpClient();
var response = await client.PostAsync("https://api.live.paisr.tech/v2/vouchers", body);
var responseBody = await response.Content.ReadAsStringAsync();
{
  "success": true,
  "data": {
    "id": "string"
  }
}
{
  "success": false,
  "message": "string"
}
{
  "success": false,
  "message": "string"
}