curl --request GET \
--url https://api.paygentic.io/v0/contracts/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/contracts/{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": "<string>",
"object": "contract",
"merchantId": "<string>",
"customerId": "<string>",
"currency": "<string>",
"status": "draft",
"createdAt": "2023-11-07T05:31:56Z",
"externalReference": {
"provider": "<string>",
"externalId": "<string>"
},
"name": "<string>",
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"billingStartsAt": "2023-11-07T05:31:56Z",
"upliftPercent": "<string>",
"note": "<string>",
"autoCharge": true,
"bankTransferOnly": true,
"autoApprove": {
"contract": true,
"invoices": true
},
"terminatedAt": "2023-11-07T05:31:56Z",
"terminationReason": "<string>",
"lines": [
{
"id": "<string>",
"itemId": "<string>",
"billableMetricId": "<string>",
"copiedFromPriceId": "<string>",
"price": {
"model": "<string>",
"properties": {}
},
"quantity": "<string>",
"billingCadence": "<string>",
"paymentTerm": "in_advance",
"billDate": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"invoiceOffsetDays": 123,
"featureId": "<string>",
"entitlementTemplate": {},
"invoiceDisplayName": "<string>",
"description": "<string>",
"invoiceDisplayGroup": "<string>",
"rateType": "amount",
"supplyScope": "IN_SCOPE",
"outsideScopeLabel": "<string>"
}
],
"updatedAt": "2023-11-07T05:31:56Z",
"createdByPrincipalId": "<string>",
"pendingChange": {
"name": "<string>",
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"billingStartsAt": "2023-11-07T05:31:56Z",
"upliftPercent": "<string>",
"note": "<string>",
"autoCharge": true,
"bankTransferOnly": true,
"autoApprove": {
"contract": true,
"invoices": true
},
"terminatedAt": "2023-11-07T05:31:56Z",
"terminationReason": "<string>",
"lines": [
{
"id": "<string>",
"itemId": "<string>",
"billableMetricId": "<string>",
"copiedFromPriceId": "<string>",
"price": {
"model": "<string>",
"properties": {}
},
"quantity": "<string>",
"billingCadence": "<string>",
"paymentTerm": "in_advance",
"billDate": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"invoiceOffsetDays": 123,
"featureId": "<string>",
"entitlementTemplate": {},
"invoiceDisplayName": "<string>",
"description": "<string>",
"invoiceDisplayGroup": "<string>",
"rateType": "amount",
"supplyScope": "IN_SCOPE",
"outsideScopeLabel": "<string>"
}
],
"updatedAt": "2023-11-07T05:31:56Z",
"createdByPrincipalId": "<string>"
},
"decidedAt": "2023-11-07T05:31:56Z",
"decidedByPrincipalId": "<string>",
"rejectReason": "<string>",
"rejectText": "<string>",
"validation": [
{
"scope": "contract",
"code": "<string>",
"message": "<string>",
"lineId": "<string>",
"field": "<string>",
"allowedDates": [
"2023-11-07T05:31:56Z"
]
}
],
"conflicts": [
{
"code": "ITEM_ON_OTHER_LIVE_CONTRACT",
"lineId": "<string>",
"otherContractId": "<string>",
"otherLineId": "<string>",
"message": "<string>",
"itemId": "<string>",
"billableMetricId": "<string>"
}
]
}{
"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"
}Get
Returns the contract in force with its lines: the last approved version, or the draft while nothing is approved yet. When a change waits for approval, pendingChange holds it in the same shape, with its own updatedAt. A contract of another merchant answers 404, as an unknown one does.
curl --request GET \
--url https://api.paygentic.io/v0/contracts/{id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{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.paygentic.io/v0/contracts/{id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/contracts/{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": "<string>",
"object": "contract",
"merchantId": "<string>",
"customerId": "<string>",
"currency": "<string>",
"status": "draft",
"createdAt": "2023-11-07T05:31:56Z",
"externalReference": {
"provider": "<string>",
"externalId": "<string>"
},
"name": "<string>",
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"billingStartsAt": "2023-11-07T05:31:56Z",
"upliftPercent": "<string>",
"note": "<string>",
"autoCharge": true,
"bankTransferOnly": true,
"autoApprove": {
"contract": true,
"invoices": true
},
"terminatedAt": "2023-11-07T05:31:56Z",
"terminationReason": "<string>",
"lines": [
{
"id": "<string>",
"itemId": "<string>",
"billableMetricId": "<string>",
"copiedFromPriceId": "<string>",
"price": {
"model": "<string>",
"properties": {}
},
"quantity": "<string>",
"billingCadence": "<string>",
"paymentTerm": "in_advance",
"billDate": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"invoiceOffsetDays": 123,
"featureId": "<string>",
"entitlementTemplate": {},
"invoiceDisplayName": "<string>",
"description": "<string>",
"invoiceDisplayGroup": "<string>",
"rateType": "amount",
"supplyScope": "IN_SCOPE",
"outsideScopeLabel": "<string>"
}
],
"updatedAt": "2023-11-07T05:31:56Z",
"createdByPrincipalId": "<string>",
"pendingChange": {
"name": "<string>",
"contractStart": "2023-11-07T05:31:56Z",
"contractEnd": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"billingStartsAt": "2023-11-07T05:31:56Z",
"upliftPercent": "<string>",
"note": "<string>",
"autoCharge": true,
"bankTransferOnly": true,
"autoApprove": {
"contract": true,
"invoices": true
},
"terminatedAt": "2023-11-07T05:31:56Z",
"terminationReason": "<string>",
"lines": [
{
"id": "<string>",
"itemId": "<string>",
"billableMetricId": "<string>",
"copiedFromPriceId": "<string>",
"price": {
"model": "<string>",
"properties": {}
},
"quantity": "<string>",
"billingCadence": "<string>",
"paymentTerm": "in_advance",
"billDate": "2023-11-07T05:31:56Z",
"startDate": "2023-11-07T05:31:56Z",
"endDate": "2023-11-07T05:31:56Z",
"billingAnchor": "2023-11-07T05:31:56Z",
"invoiceOffsetDays": 123,
"featureId": "<string>",
"entitlementTemplate": {},
"invoiceDisplayName": "<string>",
"description": "<string>",
"invoiceDisplayGroup": "<string>",
"rateType": "amount",
"supplyScope": "IN_SCOPE",
"outsideScopeLabel": "<string>"
}
],
"updatedAt": "2023-11-07T05:31:56Z",
"createdByPrincipalId": "<string>"
},
"decidedAt": "2023-11-07T05:31:56Z",
"decidedByPrincipalId": "<string>",
"rejectReason": "<string>",
"rejectText": "<string>",
"validation": [
{
"scope": "contract",
"code": "<string>",
"message": "<string>",
"lineId": "<string>",
"field": "<string>",
"allowedDates": [
"2023-11-07T05:31:56Z"
]
}
],
"conflicts": [
{
"code": "ITEM_ON_OTHER_LIVE_CONTRACT",
"lineId": "<string>",
"otherContractId": "<string>",
"otherLineId": "<string>",
"message": "<string>",
"itemId": "<string>",
"billableMetricId": "<string>"
}
]
}{
"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"
}Response
The contract
A set of priced lines with a fixed term, owned by one customer and billed in one currency. The fields show the version in force: the last approved one, or the draft while nothing is approved yet. A change that waits for approval is in pendingChange.
draft and rejected hold while the contract was never approved. After approval the status follows the dates, on the customer's clock: scheduled before contractStart, active from it, and ended once contractEnd or terminatedAt has passed.
draft, rejected, scheduled, active, ended Was this page helpful?