Download Receipt PDF
Endpoint for downloading the receipt PDF of a paid Payment Link.
info
This endpoint does not use an API Key. Send the session_token obtained from the Get Public response as the Authorization header instead. The session token is scoped to the specific Payment Link it was issued for.
The Payment Link must already be paid, otherwise a 400 Bad Request is returned.
GET
/api/v1/groups/{group_id}/payment-links/{payment_link_id}/receipt/pdf
Response
| Code | Description |
|---|---|
| 200 | Success |
| 400 | The Payment Link has not been paid yet |
| 403 | The session token does not belong to this Payment Link |
| 404 | Not Found |
| 500 | Internal Error |
Example Usage
- JavaScript
- Python
- Go
downloadPdf.js
var headers = new Headers();
headers.append('Authorization', 'SESSION_TOKEN');
var requestOptions = {
method: 'GET',
headers: headers,
redirect: 'follow'
};
const group_id = '';
const payment_link_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/payment-links/${payment_link_id}/receipt/pdf`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));
downloadPdf.py
import requests
group_id = ""
payment_link_id = ""
url = "https://api.reverepayments.dev/api/v1/groups/"+group_id+"/payment-links/"+payment_link_id+"/receipt/pdf"
headers = {
'Authorization': 'SESSION_TOKEN'
}
response = requests.request("GET", url, headers=headers)
print(response.text)
downloadPdf.go
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
const group_id = ""
const payment_link_id = ""
url := "https://api.reverepayments.dev/api/v1/groups/" + group_id + "/payment-links/" + payment_link_id + "/receipt/pdf"
client := &http.Client{}
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "SESSION_TOKEN")
res, _ := client.Do(req)
defer res.Body.Close()
bytes, err := io.ReadAll(res.Body)
if err != nil {
fmt.Println(err.Error())
return
}
fmt.Println(string(bytes))
}
Example Success Response
Header
Content Type: application/pdf
Body
PDF binary data