Download Receipt
curl --request GET \
--url https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt"
headers = {"X-Access-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt', 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.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Access-Token: <api-key>"
],
]);
$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.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Access-Token", "<api-key>")
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.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyBill Payment
Download Receipt
The receipt file of a successful payment
GET
/
v3
/
bills
/
transactions
/
{transactionId}
/
receipt
Download Receipt
curl --request GET \
--url https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt \
--header 'X-Access-Token: <api-key>'import requests
url = "https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt"
headers = {"X-Access-Token": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-Access-Token': '<api-key>'}};
fetch('https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt', 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.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-Access-Token: <api-key>"
],
]);
$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.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Access-Token", "<api-key>")
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.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt")
.header("X-Access-Token", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.oneclickdz.com/v3/bills/transactions/{transactionId}/receipt")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Access-Token"] = '<api-key>'
response = http.request(request)
puts response.read_bodyReturns the receipt of a
The body is the file. Choose the extension from
SUCCESS transaction as a file. This is the only endpoint whose success response is not a JSON envelope; errors still are.
The transaction’s receiptUrl is this URL.
Path parameters
string
required
A transaction whose
status is SUCCESS.Response
| Header | Value |
|---|---|
Content-Type | application/pdf, image/png or image/jpeg |
Content-Disposition | attachment; filename="…" |
Content-Length | Size in bytes |
Cache-Control | private, max-age=86400 |
Content-Type. Sandbox receipts are PNG images.
Example
curl https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt \
-H "X-Access-Token: YOUR_API_KEY" \
--output receipt.pdf
import { writeFile } from "node:fs/promises";
const response = await fetch(
"https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt",
{ headers: { "X-Access-Token": process.env.ONECLICKDZ_API_KEY } },
);
if (!response.ok) {
const body = await response.json();
throw new Error(body.error.code);
}
const ext = response.headers.get("content-type") === "application/pdf" ? "pdf" : "png";
await writeFile(`receipt.${ext}`, Buffer.from(await response.arrayBuffer()));
import os, requests
response = requests.get(
"https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt",
headers={"X-Access-Token": os.environ["ONECLICKDZ_API_KEY"]},
)
if not response.ok:
raise RuntimeError(response.json()["error"]["code"])
ext = "pdf" if response.headers["Content-Type"] == "application/pdf" else "png"
with open(f"receipt.{ext}", "wb") as f:
f.write(response.content)
<?php
$ch = curl_init("https://api.oneclickdz.com/v3/bills/transactions/68cdf0a2b7c1e4d5f6a7b8c9/receipt");
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ["X-Access-Token: " . getenv("ONECLICKDZ_API_KEY")],
]);
$data = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
$type = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
curl_close($ch);
if ($status !== 200) {
throw new Exception(json_decode($data, true)["error"]["code"]);
}
$ext = $type === "application/pdf" ? "pdf" : "png";
file_put_contents("receipt.$ext", $data);
?>
Errors
| HTTP | Code | Meaning |
|---|---|---|
| 401 | MISSING_ACCESS_TOKEN / INVALID_ACCESS_TOKEN | Missing or rejected key |
| 404 | NOT_FOUND | Unknown transaction, not yours, not SUCCESS, or no receipt available |
| 500 | INTERNAL_ERROR | The file could not be read; retry later |
| 503 | AUTH_UNAVAILABLE | The key could not be verified in time; retry after Retry-After |

