Pay Invoice
Endpoint for paying an Invoice.
POST /api/v1/groups/{group_id}/invoices/{invoice_id}/pay
Request Parameters
| Name | Description | Type | Required |
|---|---|---|---|
| token | The payment token received by tokenizer to pay for the invoice. | string | Required |
Response
| Code | Description |
|---|---|
| 200 | Success |
| 400 | Bad Request / Validation error |
| 500 | Internal Error |
Example Usage
- JavaScript
- Python
- Go
plans.js
var headers = new Headers();
headers.append('Authorization', 'API_KEY');
var requestOptions = {
method: 'POST',
headers: headers,
redirect: 'follow',
body: {
// request body data
}
};
const group_id = '';
const invoice_id = '';
const url = `https://api.reverepayments.dev/api/v1/groups/${group_id}/invoices/${invoice_id}/pay`;
fetch(url, requestOptions)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log('error', error));
plans.py
import requests
group_id = ""
invoice_id = ""
url = "https://api.reverepayments.dev/api/v1/groups/"+group_id+"/invoices/"+invoice_id+"/pay"
headers = {
'Authorization': 'API_KEY'
}
response = requests.request("POST", url, headers=headers, json={
// request body data
})
print(response.text)
plans.go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
const group_id = ""
const invoice_id = ""
url := "https://api.reverepayments.dev/api/v1/groups/" + group_id + "/invoices/" + invoice_id + "/pay"
client := &http.Client{}
body := bytes.NewBuffer(nil)
_ = json.NewEncoder(body).Encode(map[string]any{
// body data
})
req, _ := http.NewRequest("POST", url, body)
req.Header.Add("Authorization", "API_KEY")
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 Request
{
"token": "9d3edfce-3029-40ad-bfcc-467a49f2d5ea"
}
Example Success Response
The response body will be null, the status code is 200.