curl --request GET \
--url https://api.paygentic.io/v0/subscriptionProposals/{id}/projected \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paygentic.io/v0/subscriptionProposals/{id}/projected"
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/subscriptionProposals/{id}/projected', 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/subscriptionProposals/{id}/projected",
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/subscriptionProposals/{id}/projected"
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/subscriptionProposals/{id}/projected")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptionProposals/{id}/projected")
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{
"object": "list",
"data": [
{
"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"
}
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
}
}{
"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"
}{
"error": "conflict",
"message": "<string>",
"requestId": "105445aa7843bc8bf206b12000100000",
"code": "SUBSCRIPTION_PROPOSAL_RESYNC_CONFLICT",
"details": {
"code": "<string>",
"details": {},
"fields": [
"<string>"
],
"subscriptionId": "<string>",
"status": "<string>",
"field": "<string>",
"expected": 123,
"actual": 123,
"entityType": "<string>",
"entityId": "<string>"
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}List projected
Returns the invoices that approving this pending subscription proposal now would raise, as a list of Invoice in the envelope GET /v2/invoices/projected answers. It is not that endpoint: it takes no from or to, and it prices an elapsed metered period as described below. Today data holds the first invoice only, with the lines and amounts approve would bill at the moment of this read, and it is empty when approving now would raise no invoice. pagination.total says whether anything is owed: 1 when it is and 0 when it is not, whatever the offset. Nothing is stored, and the content is as of this read: the clock, the plan, its prices and the customer can change it before approval. The tax and the total are estimates from stored tax rates, not the tax provider’s calculation. Grant discounts are not applied. A metered period that has already elapsed shows at zero usage, or at a minimum quantity in force for that period. subscriptionId holds the proposal id, because no subscription exists yet, so GET /v0/subscriptions/{id} answers 404 for it. The invoice has status PROJECTED and an id that is the same on every read, but GET /v2/invoices/{id} answers 404 for it. Needs the subscriptionProposals:read permission. The preview refuses what approve would refuse, with approve’s answer. A plan, plan version or customer that no longer exists answers 404. A pending proposal blocks deleting its plan and its customer, so this happens only when a delete runs at the same time. A proposal of another merchant answers 404, as an unknown one does. 409 carries a code: SUBSCRIPTION_PROPOSAL_NOT_PENDING for a proposal that is not pending; SUBSCRIPTION_PROPOSAL_INVALID when the proposal fails a check subscription create makes, with details.code the failed check’s own code and details.details its details, each only when the check has one; SUBSCRIPTION_PROPOSAL_DUPLICATE when the customer already has a live subscription for the plan’s product, with its id in details.subscriptionId.
curl --request GET \
--url https://api.paygentic.io/v0/subscriptionProposals/{id}/projected \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.paygentic.io/v0/subscriptionProposals/{id}/projected"
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/subscriptionProposals/{id}/projected', 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/subscriptionProposals/{id}/projected",
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/subscriptionProposals/{id}/projected"
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/subscriptionProposals/{id}/projected")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paygentic.io/v0/subscriptionProposals/{id}/projected")
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{
"object": "list",
"data": [
{
"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"
}
}
],
"pagination": {
"limit": 123,
"offset": 123,
"total": 123
}
}{
"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"
}{
"error": "conflict",
"message": "<string>",
"requestId": "105445aa7843bc8bf206b12000100000",
"code": "SUBSCRIPTION_PROPOSAL_RESYNC_CONFLICT",
"details": {
"code": "<string>",
"details": {},
"fields": [
"<string>"
],
"subscriptionId": "<string>",
"status": "<string>",
"field": "<string>",
"expected": 123,
"actual": 123,
"entityType": "<string>",
"entityId": "<string>"
}
}{
"message": "The requested resource was not found",
"error": "not_found"
}{
"message": "The requested resource was not found",
"error": "not_found"
}Query Parameters
Was this page helpful?