Settle Invoice Payment
curl --request POST \
--url https://api.paygentic.io/v2/invoices/{id}/payment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.paygentic.io/v2/invoices/{id}/payment"
payload = { "reason": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.paygentic.io/v2/invoices/{id}/payment', 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.paygentic.io/v2/invoices/{id}/payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paygentic.io/v2/invoices/{id}/payment"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.paygentic.io/v2/invoices/{id}/payment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v2/invoices/{id}/payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"method": "out_of_band",
"invoice": {
"id": "<string>",
"object": "invoice",
"autoApprove": true,
"billingAnchor": "2023-11-07T05:31:56Z",
"billingCadence": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currency": "<string>",
"gracePeriodEnd": "2023-11-07T05:31:56Z",
"grandTotal": "<string>",
"itemCount": 123,
"merchantId": "<string>",
"paidAmount": "<string>",
"periodEnd": "2023-11-07T05:31:56Z",
"periodStart": "2023-11-07T05:31:56Z",
"sequenceNumber": 123,
"status": "ACTIVE",
"subscriptionId": "<string>",
"customerId": "<string>",
"subtotal": "<string>",
"totalTax": "<string>",
"unpaidAmount": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"failureReason": "<string>",
"paymentInFlight": true,
"invoiceNumber": "<string>",
"lineItems": {
"invoiceId": "<string>",
"lineItems": [
{
"eventType": "usage",
"eventId": "<string>",
"eventSourceId": "<string>",
"billableMetricId": "<string>",
"invoiceDisplayName": "<string>",
"lineItemType": "charge",
"meterEventId": "<string>",
"metricDescription": "<string>",
"metricName": "<string>",
"metricUnit": "<string>",
"quantity": 123,
"taxRate": 123,
"totalAmount": "<string>",
"totalPrice": "<string>",
"totalTax": "<string>",
"unitPrice": "<string>",
"itemId": "<string>",
"priceId": "<string>",
"periodStart": "2023-11-07T05:31:56Z",
"periodEnd": "2023-11-07T05:31:56Z",
"paymentTerm": "in_advance",
"provenance": {
"status": "<string>",
"version": 123,
"currency": "<string>",
"precision": {
"significantDigits": 123,
"rounding": "<string>"
},
"period": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"calculatedAt": "2023-11-07T05:31:56Z",
"subscriptionId": "<string>",
"inputs": {
"kind": "<string>",
"quantity": {
"value": "<string>",
"source": "<string>"
},
"selector": {
"value": "<string>",
"source": "<string>"
},
"price": {
"fn": {
"model": "<string>",
"rate": "<string>",
"bands": [
{
"upTo": "<string>",
"rate": "<string>"
}
],
"min": "<string>",
"max": "<string>",
"amount": "<string>"
},
"source": "<string>"
},
"amount": {
"value": "<string>",
"source": "<string>"
}
},
"sources": {},
"steps": [
{
"op": "<string>",
"on": "<string>",
"in": "<string>",
"out": "<string>",
"params": {},
"source": "<string>",
"inputsFrom": [
{
"lineItemId": "<string>",
"value": "<string>",
"share": "<string>"
}
],
"trace": [
{}
]
}
],
"notApplied": [
{
"source": "<string>",
"reason": "<string>"
}
],
"result": {
"amount": "<string>",
"quantity": "<string>",
"unitPrice": "<string>"
}
}
}
],
"totalCount": 123,
"items": [
{
"id": "<string>",
"name": "<string>",
"catalogId": "<string>",
"archivedAt": "2023-11-07T05:31:56Z",
"externalReferences": [
{
"id": "<string>",
"object": "externalReference",
"merchantId": "<string>",
"entityType": "item",
"entityId": "<string>",
"provider": "<string>",
"externalId": "<string>",
"metadata": {},
"isPrimary": true,
"isDefault": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"externalLabel": "<string>"
}
]
}
],
"nextPageToken": "<string>"
},
"metadata": {},
"nextActionAt": "2023-11-07T05:31:56Z",
"paidAt": "2023-11-07T05:31:56Z",
"issuedAt": "2023-11-07T05:31:56Z",
"dueAt": "2023-11-07T05:31:56Z",
"paymentUrl": "<string>",
"pdfUrl": "<string>",
"pdfSource": "paygentic",
"documentWithheldReason": "tax_unreconciled",
"permalink": "<string>",
"tax": {
"actualTax": "<string>",
"adjustmentApplied": true,
"adjustmentNeeded": true,
"difference": "<string>",
"estimatedTax": "<string>",
"reconciled": true,
"reconciledAt": "2023-11-07T05:31:56Z"
}
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Invoices V2
Settle Invoice Payment
Settle an unpaid invoice in status ISSUED or PAYMENT_FAILED. The method field selects how.
hosted_link: create a new hosted payment link and email it to the customer. The invoice stays unpaid until the customer pays on the link. Each call replaces the previous link. A payment link expires after 30 days; to collect an invoice whose link has expired, call this method again.out_of_band: record a payment that you collected outside Paygentic. The invoice changes toPAIDimmediately. A second call returns 409.
For hosted_link, an invoice that does not exist returns 404, the same as an invoice of another merchant.
Paygentic selects the payment provider from your connected payment account. The response reports the provider.
Warning: each hosted_link call creates a new link and sends the customer a new email. Do not retry a hosted_link call after a timeout: first read the invoice to see if a new link exists.
POST
/
v2
/
invoices
/
{id}
/
payment
Settle Invoice Payment
curl --request POST \
--url https://api.paygentic.io/v2/invoices/{id}/payment \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"reason": "<string>"
}
'import requests
url = "https://api.paygentic.io/v2/invoices/{id}/payment"
payload = { "reason": "<string>" }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({reason: '<string>'})
};
fetch('https://api.paygentic.io/v2/invoices/{id}/payment', 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.paygentic.io/v2/invoices/{id}/payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'reason' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.paygentic.io/v2/invoices/{id}/payment"
payload := strings.NewReader("{\n \"reason\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.paygentic.io/v2/invoices/{id}/payment")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"reason\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v2/invoices/{id}/payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"reason\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"method": "out_of_band",
"invoice": {
"id": "<string>",
"object": "invoice",
"autoApprove": true,
"billingAnchor": "2023-11-07T05:31:56Z",
"billingCadence": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"currency": "<string>",
"gracePeriodEnd": "2023-11-07T05:31:56Z",
"grandTotal": "<string>",
"itemCount": 123,
"merchantId": "<string>",
"paidAmount": "<string>",
"periodEnd": "2023-11-07T05:31:56Z",
"periodStart": "2023-11-07T05:31:56Z",
"sequenceNumber": 123,
"status": "ACTIVE",
"subscriptionId": "<string>",
"customerId": "<string>",
"subtotal": "<string>",
"totalTax": "<string>",
"unpaidAmount": "<string>",
"updatedAt": "2023-11-07T05:31:56Z",
"failureReason": "<string>",
"paymentInFlight": true,
"invoiceNumber": "<string>",
"lineItems": {
"invoiceId": "<string>",
"lineItems": [
{
"eventType": "usage",
"eventId": "<string>",
"eventSourceId": "<string>",
"billableMetricId": "<string>",
"invoiceDisplayName": "<string>",
"lineItemType": "charge",
"meterEventId": "<string>",
"metricDescription": "<string>",
"metricName": "<string>",
"metricUnit": "<string>",
"quantity": 123,
"taxRate": 123,
"totalAmount": "<string>",
"totalPrice": "<string>",
"totalTax": "<string>",
"unitPrice": "<string>",
"itemId": "<string>",
"priceId": "<string>",
"periodStart": "2023-11-07T05:31:56Z",
"periodEnd": "2023-11-07T05:31:56Z",
"paymentTerm": "in_advance",
"provenance": {
"status": "<string>",
"version": 123,
"currency": "<string>",
"precision": {
"significantDigits": 123,
"rounding": "<string>"
},
"period": {
"start": "2023-11-07T05:31:56Z",
"end": "2023-11-07T05:31:56Z"
},
"calculatedAt": "2023-11-07T05:31:56Z",
"subscriptionId": "<string>",
"inputs": {
"kind": "<string>",
"quantity": {
"value": "<string>",
"source": "<string>"
},
"selector": {
"value": "<string>",
"source": "<string>"
},
"price": {
"fn": {
"model": "<string>",
"rate": "<string>",
"bands": [
{
"upTo": "<string>",
"rate": "<string>"
}
],
"min": "<string>",
"max": "<string>",
"amount": "<string>"
},
"source": "<string>"
},
"amount": {
"value": "<string>",
"source": "<string>"
}
},
"sources": {},
"steps": [
{
"op": "<string>",
"on": "<string>",
"in": "<string>",
"out": "<string>",
"params": {},
"source": "<string>",
"inputsFrom": [
{
"lineItemId": "<string>",
"value": "<string>",
"share": "<string>"
}
],
"trace": [
{}
]
}
],
"notApplied": [
{
"source": "<string>",
"reason": "<string>"
}
],
"result": {
"amount": "<string>",
"quantity": "<string>",
"unitPrice": "<string>"
}
}
}
],
"totalCount": 123,
"items": [
{
"id": "<string>",
"name": "<string>",
"catalogId": "<string>",
"archivedAt": "2023-11-07T05:31:56Z",
"externalReferences": [
{
"id": "<string>",
"object": "externalReference",
"merchantId": "<string>",
"entityType": "item",
"entityId": "<string>",
"provider": "<string>",
"externalId": "<string>",
"metadata": {},
"isPrimary": true,
"isDefault": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"externalLabel": "<string>"
}
]
}
],
"nextPageToken": "<string>"
},
"metadata": {},
"nextActionAt": "2023-11-07T05:31:56Z",
"paidAt": "2023-11-07T05:31:56Z",
"issuedAt": "2023-11-07T05:31:56Z",
"dueAt": "2023-11-07T05:31:56Z",
"paymentUrl": "<string>",
"pdfUrl": "<string>",
"pdfSource": "paygentic",
"documentWithheldReason": "tax_unreconciled",
"permalink": "<string>",
"tax": {
"actualTax": "<string>",
"adjustmentApplied": true,
"adjustmentNeeded": true,
"difference": "<string>",
"estimatedTax": "<string>",
"reconciled": true,
"reconciledAt": "2023-11-07T05:31:56Z"
}
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Body
application/json
Response
The invoice is settled, or a new payment link exists. The method field identifies the shape: out_of_band returns the PAID invoice; hosted_link returns the provider and the new payment link.
Was this page helpful?