curl --request POST \
--url https://api.paygentic.io/v0/contracts/{id}/decision \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"basedOnUpdatedAt": "2023-11-07T05:31:56Z",
"reason": "<string>",
"text": "<string>"
}
'import requests
url = "https://api.paygentic.io/v0/contracts/{id}/decision"
payload = {
"basedOnUpdatedAt": "2023-11-07T05:31:56Z",
"reason": "<string>",
"text": "<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({basedOnUpdatedAt: '2023-11-07T05:31:56Z', reason: '<string>', text: '<string>'})
};
fetch('https://api.paygentic.io/v0/contracts/{id}/decision', 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}/decision",
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([
'basedOnUpdatedAt' => '2023-11-07T05:31:56Z',
'reason' => '<string>',
'text' => '<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/v0/contracts/{id}/decision"
payload := strings.NewReader("{\n \"basedOnUpdatedAt\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"text\": \"<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/v0/contracts/{id}/decision")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"basedOnUpdatedAt\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/contracts/{id}/decision")
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 \"basedOnUpdatedAt\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"text\": \"<string>\"\n}"
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"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Approve or reject
Approves or rejects the draft of a contract that was never approved, or the change that waits beside an approved contract. Needs the contracts:approve permission, whoever wrote the contract. Send the updatedAt of the version you read as basedOnUpdatedAt.
approve writes every line item of the whole term in one transaction, and the contract becomes the version in force with the approver and the time recorded. The approval time is read from the customer’s test clock when it has one. Approving a change to a contract that is already approved is not available yet and answers 409 CONTRACT_RETILE_NOT_AVAILABLE. reject ends a draft as rejected, or discards a pending change and leaves the version in force as it was.
409 carries a code. CONTRACT_NOT_PENDING: nothing waits for a decision, because the contract was decided or rejected. CONTRACT_CHANGED: the version changed after you read it. CONTRACT_INVALID: the content has validation errors, listed in details.errors. Each 409 leaves the contract as it was.
curl --request POST \
--url https://api.paygentic.io/v0/contracts/{id}/decision \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"basedOnUpdatedAt": "2023-11-07T05:31:56Z",
"reason": "<string>",
"text": "<string>"
}
'import requests
url = "https://api.paygentic.io/v0/contracts/{id}/decision"
payload = {
"basedOnUpdatedAt": "2023-11-07T05:31:56Z",
"reason": "<string>",
"text": "<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({basedOnUpdatedAt: '2023-11-07T05:31:56Z', reason: '<string>', text: '<string>'})
};
fetch('https://api.paygentic.io/v0/contracts/{id}/decision', 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}/decision",
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([
'basedOnUpdatedAt' => '2023-11-07T05:31:56Z',
'reason' => '<string>',
'text' => '<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/v0/contracts/{id}/decision"
payload := strings.NewReader("{\n \"basedOnUpdatedAt\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"text\": \"<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/v0/contracts/{id}/decision")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"basedOnUpdatedAt\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"text\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/contracts/{id}/decision")
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 \"basedOnUpdatedAt\": \"2023-11-07T05:31:56Z\",\n \"reason\": \"<string>\",\n \"text\": \"<string>\"\n}"
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"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Body
A decision on the version that waits, and the updatedAt of the version the person decided on.
Notes on the rejection. An approval refuses it.
2000Response
The decided 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?