Price a cart
const url = 'https://apisandbox.puurk.com/checkout/quotes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"oid":"example","items":[{"service_id":"example","quantity":1}],"candidates":["example"]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://apisandbox.puurk.com/checkout/quotes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "oid": "example", "items": [ { "service_id": "example", "quantity": 1 } ], "candidates": [ "example" ] }'Prices a cart of catalog services and returns its payment plans, the lowest monthly payment, the pay-in-full total, and, for each candidate service, what the cart would cost with one more of it. Nothing is saved. Callable with a service token or, from a browser, with a publishable client. A publishable client is an API client issued with POST /auth/clients whose scope is {resource: 'checkout', oid: <org>, actions: ['read', 'write'], public: true} and whose allowed_origins list is non-empty. Pass its id as client_id (or the X-Puurk-Client-Id header) instead of a bearer token. No secret is used, so the request must come from a browser Origin in allowed_origins and target the one organization the scope names.
Authorizations
Section titled “Authorizations”- service_token
- None
Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”Publishable client id, for browser calls with no bearer token. Omit when calling with a service token.
Request Bodyrequired
Section titled “Request Bodyrequired”Cart to price
object
Organization ID
Cart lines. May be empty, to price candidates on their own.
object
Catalog service ID
Units of the service. Repeated service ids are merged.
Service ids to price as “one more of this” increments on the cart
Responses
Section titled “Responses”Successful operation
object
Cart total in cents
Cart down payment in cents
Plan length cap in months from the services’ term caps, when the organization uses them
object
Price per unit in cents
Unit_price x quantity, in cents
Down payment for the line in cents
object
Lowest monthly payment in cents
Plan length in months for that payment
Payment plans for the cart, in the same shape as a session’s plans
object
Offer these terms belong to
User the terms were generated for
Down payment in cents
Amount financed in cents
Provider’s share of the premium as a fraction between 0 and 1
Plan length in months
Premium charged per month in cents
Provider share of the monthly premium in cents
Puurk share of the monthly premium in cents
Principal per month in cents
Fees included in each monthly payment in cents
Payout fees per month in cents
Provider fees per month in cents
Monthly payment in cents
Monthly opportunity for the provider in cents
Total paid over the plan in cents
Total premium over the plan in cents
Provider share of the total premium in cents
Puurk share of the total premium in cents
Total principal (down payment plus financed amount) in cents
Total fees over the plan in cents
Total payout fees over the plan in cents
Total provider fees over the plan in cents
Total opportunity for the provider in cents
object
Amount in cents
Fee in cents
Amount plus fee in cents
Keyed by candidate service id
object
object
Cart amount in cents with one more unit of the service
Cart down payment in cents with one more unit of the service
object
Lowest monthly payment in cents
Plan length in months for that payment
Change in the lowest monthly payment versus the current cart, in cents. May be zero or negative when the larger cart qualifies for a longer plan.
object
Amount in cents
Fee in cents
Amount plus fee in cents
Examplegenerated
{ "oid": "example", "amount": 1, "down_payment": 1, "max_term": 1, "lines": [ { "service_id": "example", "name": "example", "quantity": 1, "unit_price": 1, "amount": 1, "down_payment": 1 } ], "as_low_as": { "monthly_payment": 1, "term_length": 1 }, "plans": [ { "offer_id": "example", "uid": "example", "down_payment": 1, "financed_amount": 1, "provider_premium_share": 1, "term_length": 1, "monthly_premium": 1, "monthly_provider_premium": 1, "monthly_puurk_premium": 1, "monthly_principal": 1, "monthly_fees": 1, "monthly_payout_fees": 1, "monthly_provider_fees": 1, "monthly_payment": 1, "monthly_opportunity": 1, "total_amount": 1, "total_premium": 1, "total_provider_premium": 1, "total_puurk_premium": 1, "total_principal": 1, "total_fees": 1, "total_payout_fees": 1, "total_provider_fees": 1, "total_opportunity": 1 } ], "pay_in_full": { "amount": 1, "fee_amount": 1, "total_amount": 1 }, "increments": { "additionalProperty": { "amount": 1, "down_payment": 1, "as_low_as": { "monthly_payment": 1, "term_length": 1 }, "delta": 1, "pay_in_full": { "amount": 1, "fee_amount": 1, "total_amount": 1 } } }}Invalid input (missing oid, more than 20 lines, a quantity outside 1 to 10, or more than 50 candidates)
Unauthorized (no token, or an unknown client id)
Forbidden (origin not allowed, client inactive, or no checkout scope on the organization)
A service is not available for online checkout, or no payment plans can be generated for the cart
Internal server error