A node.js client library for the Clyde API. Head to https://api.joinclyde.com/docs for full documentation.
$ npm install clyde-sdk
The module supports all Clyde API Endpoints. For complete information about the API, head to the docs.
All endpoints require a valid
const Clyde = ;const clyde =clientKey: 'ck_your_key'clientSecret: 'sk_your_secret'isLive: true;
When testing, set
false and use test keys instead of live keys. This will allow you to test without creating active customers or contracts. When you are done testing, set
true and use your live keys. Note that at this point all contract orders are considered live and valid.
All methods will return a promise. Feel free to use promises or
async / await for control flow. Callbacks are not supported at this time. For a full list of parameters and return types, please see our documentation.
Create a product. Please see documentation for available properties.
Update your product. First parameter is the product SKU; second is a list of properties to update.
Get One Product
Get only one product. Product SKU is the first parameter; there is an optional second parameter of anIP address for geo-sensitive queries.
Get Many Products
Get all products associated with your store. Optionally, you may pass in an
opts object with a page number or comma-seperated list of SKUs to retrieve a particular page or a subset of SKUs, as well as an IP address for geo-sensitive queries.
Get Contracts for a Product
Get all available contracts for a product. Product SKU is the first parameter; there is an optional second parameter of anIP address for geo-sensitive queries.
Create an order. Use this to create a contract sale or report line items of insurable products for later sales. First parameter is your internal ID for the order; second is a list of options. Please see our documentation for available options.
Get an order that has already been placed. The order ID from your system is the first and only parameter.
Cancel an order you have already placed. Use this to cancel all contract sales, or generally remove from our system all line items associated with an order. The order ID from your system is the first and only parameter.
Get Contract Sale
Get a previously sold contract sale. The ID returned from the original sale is the first and only parameter.
Cancel Contract Sale
Cancel a previously sold contract sale. The ID returned from the original sale is the first and only parameter.
When an error occurs
clyde-sdk will throw that error. Use
try / catch with
async / await or
.catch() syntax with promises.
tryconst product = await clyde;catche// Handle error