Calculate payment terms
const url = 'https://apisandbox.puurk.com/offers/terms?purchase_amount=1&oid=example';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://apisandbox.puurk.com/offers/terms?purchase_amount=1&oid=example' \ --header 'Authorization: Bearer <token>'Calculate payment plan terms for a purchase. Authenticate with either a service token carrying terms:read for the organization, or a public client_id issued for the terms widget.
Authorizations
Section titled “Authorizations”- service_token
- None
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Purchase amount in cents
Down payment amount in cents
Organization ID
Public API client ID (widget auth path; omit when sending a service token)
Responses
Section titled “Responses”Successful operation
object
One payment-plan option returned by GET /offers/terms
object
Plan length in months
Monthly payment in cents
Total paid over the plan in cents
Examplegenerated
{ "terms": [ { "term_length": 1, "monthly_payment": 1, "total_payment": 1 } ]}Missing or invalid parameters (invalid_params). Returned when oid or purchase_amount is absent, when purchase_amount or down_payment is not a non-negative integer amount in cents, or when down_payment exceeds purchase_amount.
The standard error body. error is a stable, machine-readable code — branch on it rather than on message, which is for humans and may change.
object
Machine-readable error code.
Human-readable detail.
Example
{ "error": "invalid_params", "message": "oid is required"}Unauthorized