Get a coupon
curl --request GET \
--url https://api.paybridgenp.com/v1/billing/coupons/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paybridgenp.com/v1/billing/coupons/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.paybridgenp.com/v1/billing/coupons/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paybridgenp.com/v1/billing/coupons/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.paybridgenp.com/v1/billing/coupons/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.paybridgenp.com/v1/billing/coupons/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paybridgenp.com/v1/billing/coupons/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "cpn_01j9x2k3m4n5p6q7r8s9t0u1v2",
"object": "coupon",
"code": "WELCOME10",
"name": "Welcome 10%",
"discount_type": "percent",
"percent_off": 10,
"amount_off": 123,
"currency": "NPR",
"duration": "once",
"duration_in_cycles": 123,
"max_redemptions": 123,
"redeemed_count": 0,
"redeem_by": "2023-11-07T05:31:56Z",
"applies_to_plan_ids": [
"<string>"
],
"active": true,
"metadata": {},
"livemode": true
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}Coupons
Get a coupon
Retrieves a single coupon by ID.
GET
/
v1
/
billing
/
coupons
/
{id}
Get a coupon
curl --request GET \
--url https://api.paybridgenp.com/v1/billing/coupons/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paybridgenp.com/v1/billing/coupons/{id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.paybridgenp.com/v1/billing/coupons/{id}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paybridgenp.com/v1/billing/coupons/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.paybridgenp.com/v1/billing/coupons/{id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.paybridgenp.com/v1/billing/coupons/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paybridgenp.com/v1/billing/coupons/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"id": "cpn_01j9x2k3m4n5p6q7r8s9t0u1v2",
"object": "coupon",
"code": "WELCOME10",
"name": "Welcome 10%",
"discount_type": "percent",
"percent_off": 10,
"amount_off": 123,
"currency": "NPR",
"duration": "once",
"duration_in_cycles": 123,
"max_redemptions": 123,
"redeemed_count": 0,
"redeem_by": "2023-11-07T05:31:56Z",
"applies_to_plan_ids": [
"<string>"
],
"active": true,
"metadata": {},
"livemode": true
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}Authorizations
Your PayBridgeNP API key. Obtain one from the dashboard under Settings → API Keys. Prefix: sk_test_ for testing, sk_live_ for production.
Path Parameters
Response
Coupon.
Example:
"cpn_01j9x2k3m4n5p6q7r8s9t0u1v2"
Available options:
coupon Example:
"WELCOME10"
Example:
"Welcome 10%"
Available options:
percent, amount Percent discount (1–100), when discount_type is percent.
Example:
10
Fixed discount in paisa, when discount_type is amount.
Example:
"NPR"
Available options:
once, repeating, forever Billing cycles the discount applies, when duration is repeating.
Example:
0
Restrict to specific plan IDs, or null for all plans.
true when created with a live key, false for sandbox.
Was this page helpful?