Sunbit Estimate
Overview#
The Sunbit Estimate "As Low As" API allows you to get a quick view into monthly payments with a simple API call. You can easily retrieve a monthly payment amount for one or more items in a single request.
Sunbit Estimate API#
PUT https://api-sandbox.sunbit.com/purchase/api/v1/payment-estimation#
Request Headers#
| Property | Required | Type | Description |
|---|---|---|---|
| sunbit-key | yes | text | Provided to you by Sunbit |
Query Parameters#
| Parameter | Default | Description |
|---|---|---|
| timeZone | America/Los_Angeles | Timezone of the client. |
| location | --- | Store Id, or Store Name, or any other identifier of the location. |
| representative | --- | Representative Employee Id, or Representative Name, or any other identifier of the representative. |
TimeZone, location, and representative request parameters are optional.
Body#
Array of objects containing the following fields:
| Attribute | Type | Description |
|---|---|---|
| id | text | Client Id for the total amount. |
| totalAmount | number | Total amount of a purchase in USD. |
In order to resolve timezone in a browser the following JS snippet can be used:
let timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone;Response#
The response will contain an array of objects with the following fields:
Important
Returned payment estimation of '-1' indicates that the amount sent was inapplicable for financing.
| Attribute | Type | Description |
|---|---|---|
| id | text | The id that was provided for this estimation |
| monthlyAmount | number | The monthly payment of the loan |
| amountFinanced | number | The amount borrowed |
| downPayment | number | The required down payment; amount due at checkout |
| apr | number | The APR of the loan |
| downPaymentPercent | number | The percentage of the amount financed that will be required as down payment |
Example#
Estimate monthly payment amount for one or more items in a single request.
curl "https://api-sandbox.sunbit.com/purchase/api/v1/payment-estimation?timeZone=America%2FLos_Angeles&location=ABC123&representative=John%20Doe" -X PUT -H "sunbit-key: YOUR_KEY" --data-binary $'[{ "id":"123", "totalAmount":600},{ "id":"567", "totalAmount":1200},{ "id":"999", "totalAmount":12500}]'The above command returns an array of payment plans consisting of monthly payment amount in USD, financed amount in USD, down payment amount in USD, and APR:
[ { 'id': '123', 'monthlyAmount': 46.56, 'amountFinanced': 480, 'downPayment': 120, 'apr': 28.99908327584324 }, { 'id': '567', 'monthlyAmount': 93.12, 'amountFinanced': 960, 'downPayment': 240, 'apr': 29.002176259712886 }, { 'id': '999', 'monthlyAmount': -1, 'amountFinanced': -1, 'downPayment': -1, 'apr': -1 },]Errors#
| Error Code | Message | Description |
|---|---|---|
| 403 | Bad credentials | Sunbit key or secret is not valid |
| 422 | LocationNotFound | Location is required for multiple-vertical alliance |
| 422 | LocationNotFound | Location not found for alliance |
| 422 | LocationNotFound | Alliance vertical not found |
| 500 | Internal Server Error | Something went wrong on Sunbit's side |