NAV Navbar
HTTP Node SDK PHP SDK

Introduction

API Endpoint

https://api.joinclyde.com

Welcome to Clyde's API documentation page.

Clyde's API implements the JSON API specification.

All requests must use the JSON API media type (application/vnd.api+json).

Authentication

Requests to the Clyde API need to be signed. The steps to build a signature are as follows:

Example signing function

const crypto = require('crypto');

const makeMessage = (method, url, body, nonce, timestamp) => {
  const message = JSON.stringify([method, url, body, ""+nonce, ""+timestamp]);
  return message;
}

const signMessage = (secret, method, url, body, nonce, timestamp) => {
  const message = makeMessage(method.toUpperCase(), url, body, nonce, timestamp);
  const hash = new crypto.createHash('sha256');
  const hmac = new crypto.createHmac('sha512', Buffer.from(secret));
  const hash_digest = hash.update(message).digest('binary');
  const hmac_digest = hmac.update(url + hash_digest, 'binary').digest('base64');
  return hmac_digest;
}
  1. Generate a Unix timestamp.
  2. Generate a nonce. This can be any unique integer — for example, a numeric order ID.
  3. Construct an array of UTF-8 encoded strings containing, in order:
    • The HTTP verb of the request being signed (e.g. GET).
    • The full url of the request.
    • The body of the request being sent (if the request has no body, an empty string must be used).
    • The nonce as a string.
    • The Unix timestamp as a string.
  4. Convert that array to JSON, encoded as UTF-8. The resulting JSON should contain no spaces or other whitespace characters and no backslashes.
  5. Construct the SHA-256 hash of the string generated in step 4.
  6. Prepend the UTF-8 encoded request URL to the message hash.
  7. Generate the SHA-512 HMAC of the string generated in step 6 using your API secret as the key.
  8. Base64 encode the HMAC digest generated in step 7. This is your signature.

Generate your authorization header by concatenating your client key with a colon and the signature (i.e. clientkey:signature).

Once you have generated your signature, you’ll need to send the following headers on your request:

Header Content
Authorization The authorization header defined above.
X-Auth-Timestamp The Unix timestamp used to generate the signature.
X-Auth-Nonce The nonce used to generate the signature.
Content-Type application/vnd.api+json.

GeoIP Check

All endpoints that return contract information for a particular product or set of products accept a customer's IP address (v4) on the X-Clyde-Client-IP header. This is used to determine the customer's region in order to serve the correct contract information.

Products

Create Product

Request

POST /products HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "product",
    "attributes": {
      "name": "Clyde Couch",
      "type": "furniture",
      "sku": "SKU789",
      "description": "A cool couch.",
      "manufacturer": "Clyde Couch Co.",
      "barcode": "couch99",
      "price": 599.99,
      "imageLink": "clydeimagehosting.com/SKU789",
      "attributes": {
        "size": "loveseat",
        "color" : "purple"
      }
    }
  }
}
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.createProduct({
  name: "Clyde Couch",
  type: "furniture",
  sku: "SKU789",
  description: "A cool couch.",
  manufacturer: "Clyde Couch Co.",
  barcode: "couch99",
  price: 599.99,
  imageLink: "clydeimagehosting.com/SKU789"
});
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$productOps["name"] = "Clyde Couch";
$productOps["type"] = "furniture";
$productOps["sku"] = "SKU789";
$productOps["price"] = 599.99;
$productOps["description"] = "A cool couch.";
$productOps["manufacturer"] = "Clyde Couch Co.";
$productOps["barcode"] = "couch99";
$productOps["imageLink"] = "clydeimagehosting.com/SKU789";

$clyde->createProduct($productOps);

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/products/SKU123

{
  "data": {
    "type": "product",
    "id": "4c37be94-ad10-423b-aff1-02ed8e85b8e7",
    "attributes": {
      "name": "Clyde Couch",
      "type": "furniture",
      "sku": "SKU789",
      "description": "A cool couch.",
      "manufacturer": "Clyde Couch Co.",
      "barcode": "couch99",
      "price": 599.99,
      "imageLink": "clydeimagehosting.com/SKU789",
      "contracts" : [],
      "attributes": {
        "size": "loveseat",
        "color" : "purple"
      }
    },
    "links": {
      "self": "https://api.joinclyde.com/products/SKU789"
    }
  }
}

JSON Response

{
  "data": {
    "type": "product",
    "id": "4c37be94-ad10-423b-aff1-02ed8e85b8e7",
    "attributes": {
      "name": "Clyde Couch",
      "type": "furniture",
      "sku": "SKU789",
      "description": "A cool couch.",
      "manufacturer": "Clyde Couch Co.",
      "barcode": "couch99",
      "price": 599.99,
      "imageLink": "clydeimagehosting.com/SKU789",
      "contracts" : [],
      "attributes": {
        "size": "loveseat",
        "color" : "purple"
      }
    },
    "links": {
      "self": "https://api.joinclyde.com/products/SKU789"
    }
  }
}

Response

<?php

["data"] => [
  ["type"] => "product",
  ["id"] => "4c37be94-ad10-423b-aff1-02ed8e85b8e7",
  ["attributes"] => [
    ["name"] => "Clyde Couch",
    ["type"] => "furniture",
    ["sku"] => "SKU789",
    ["description"] => "A cool couch.",
    ["manufacturer"] => "Clyde Couch Co.",
    ["barcode"] => "couch99",
    ["price"] => 599.99,
    ["imageLink"] => "clydeimagehosting.com/SKU789",
    ["contracts"] => []
  ],
  ["links"] => [
    ["self"] => "https://api.joinclyde.com/products/SKU789"
  ]
]

Adds a new product to Clyde to be matched with contracts.

Attribute Required Content
name true string: Product name — will be truncated if over 250 characters.
type true string: Product type.
sku true string: Product SKU — must be unique for your shop.
description false string: Short product description — will be truncated if over 500 characters.
manufacturer false string: Product Manufacturer.
barcode false string: Can be used to store any metadata that identifies the product type such as a model number.
price true float: Product price in USD.
imageLink false string: Link to an image of the product — will be shown in Clyde's dashboard.

Update Product

Request

PUT /products/SKU789 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "product",
    "attributes": {
      "name": "Clyde Couch",
      "type": "furniture",
      "sku": "SKU789",
      "description": "An extremely cool couch.",
      "manufacturer": "Clyde Couch Co.",
      "barcode": "couch99",
      "price": 799.99,
      "imageLink": "clydeimagehosting.com/SKU789",
      "attributes": {
        "size": "loveseat",
        "color" : "purple"
      }
    }
  }
}
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.updateProduct(
  "SKU789",
  {
    description: "An extremely cool couch.",
    price: 799.99
  }
);
<?php 

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$productOps["price"] = 799.99;
$productOps["description"] = "A really cool couch.";

$clyde->updateProduct("SKU789", $productOps);

Response

HTTP/1.1 200 Updated
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/products/SKU123

{
  "data": {
    "type": "product",
    "id": "4c37be94-ad10-423b-aff1-02ed8e85b8e7",
    "attributes": {
      "name": "Clyde Couch",
      "type": "furniture",
      "sku": "SKU789",
      "description": "An extremely cool couch.",
      "manufacturer": "Clyde Couch Co.",
      "barcode": "couch99",
      "price": 799.99,
      "imageLink": "clydeimagehosting.com/SKU789",
      "contracts" : [],
      "attributes": {
        "size": "loveseat",
        "color" : "purple"
      }
    },
    "links": {
      "self": "https://api.joinclyde.com/products/SKU789"
    }
  }
}

JSON Response

{
  "data": {
    "type": "product",
    "id": "4c37be94-ad10-423b-aff1-02ed8e85b8e7",
    "attributes": {
      "name": "Clyde Couch",
      "type": "furniture",
      "sku": "SKU789",
      "description": "An extremely cool couch.",
      "manufacturer": "Clyde Couch Co.",
      "barcode": "couch99",
      "price": 799.99,
      "imageLink": "clydeimagehosting.com/SKU789",
      "contracts" : []
    },
    "links": {
      "self": "https://api.joinclyde.com/products/SKU789"
    }
  }
}

Response

<?php

["data"] => [
  ["type"] => "product",
  ["id"] => "4c37be94-ad10-423b-aff1-02ed8e85b8e7",
  ["attributes"] => [
    ["name"] => "Clyde Couch",
    ["type"] => "furniture",
    ["sku"] => "SKU789",
    ["description"] => "A really cool couch.",
    ["manufacturer"] => "Clyde Couch Co.",
    ["barcode"] => "couch99",
    ["price"] => 799.99,
    ["imageLink"] => "clydeimagehosting.com/SKU789",
    ["contracts"] => [],
  ] ,
  ["links"] => [
    ["self"] => "https://api.joinclyde.com/products/SKU789"
  ]
]

Updates a product by SKU. Please note that SKUs must be unique within your shop.

You can update the SKU we identify your product with by making a request to this route with the old SKU as a url parameter and the new SKU in the body.

Arguments

Argument Required Content
sku true string: The product SKU to update.
updateOpts true JSON Object: New product attributes to overwrite the existing ones.

updateOpts

Attribute Required Content
name false string: New product name.
type false string: New product type.
sku false string: New product SKU — must be unique for your shop. If passed in, will overwrite the sku used to look the product up..
description false string: Updated product description — will be truncated if over 500 characters.
manufacturer false string: New product Manufacturer.
barcode false string: New barcode. Can be used to store any metadata that identifies the product type such as a model number.
price false float: Updated product price in USD.
imageLink false string: New link to an image of the product — will be shown in Clyde's dashboard.

Get Product

Request

GET /products/SKU123 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.getProduct(
  "SKU123",
  "192.168.2.1"
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->getProduct("SKU789", "192.168.2.1");

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/products/SKU123

{
  "data": {
    "type": "product",
    "id": "bd41282a-9b53-4107-8a08-7d2bef6024d3",
    "attributes": {
      "name": "Example Product",
      "type": "Appliance",
      "sku": "SKU123",
      "description": "A good product",
      "manufacturer": "Clyde General Store",
      "barcode": "",
      "price": 14.99,
      "imageLink": "",:
      "contracts": [{
        "type": "contract",
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "attributes": {
          "sku": "TEST3Y",
          "category": "electronics",
          "term": 3,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST3Y",
          "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
          "premium": 10.00,
          "recommendedPrice": 12.50
        }
      }, {
        "type": "contract",
        "id": "ec4b4682-7df5-49cd-ad26-ad619fb38df0",
        "attributes": {
          "sku": "TEST5Y",
          "category": "electronics",
          "term": 5,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST5Y",
          "summary": "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
          "premium": 16.00,
          "recommendedPrice": 20.00
        }
      }]
    },
    "links": {
      "self": "https://api.joinclyde.com/products/SKU123"
    }
  }
}

JSON Response

{
  "data": {
    "type": "product",
    "id": "bd41282a-9b53-4107-8a08-7d2bef6024d3",
    "attributes": {
      "name": "Example Product",
      "type": "Appliance",
      "sku": "SKU123",
      "description": "A good product",
      "manufacturer": "Clyde General Store",
      "barcode": "",
      "price": 14.99,
      "imageLink": "",:
      "contracts": [{
        "type": "contract",
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "attributes": {
          "sku": "TEST3Y",
          "category": "electronics",
          "term": 3,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST3Y",
          "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
          "premium": 10.00,
          "recommendedPrice": 12.50
        }
      }, {
        "type": "contract",
        "id": "ec4b4682-7df5-49cd-ad26-ad619fb38df0",
        "attributes": {
          "sku": "TEST5Y",
          "category": "electronics",
          "term": 5,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST5Y",
          "summary": "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
          "premium": 16.00,
          "recommendedPrice": 20.00
        }
      }]
    },
    "links": {
      "self": "https://api.joinclyde.com/products/SKU123"
    }
  }
}

Response

<?php

["data"] => [
  ["type"] =>  "product",
  ["id"] =>  "bd41282a-9b53-4107-8a08-7d2bef6024d3",
  ["attributes"] =>  [
    ["name"] =>  "Example Product",
    ["type"] =>  "Appliance",
    ["sku"] =>  "SKU123",
    ["description"] =>  "A good product",
    ["manufacturer"] =>  "Clyde General Store",
    ["barcode"] =>  "",
    ["price"] =>  14.99,
    ["imageLink"] =>  "",
    ["contracts"] => [[
      ["type"] =>  "contract",
      ["id"] =>  "fbd13a8f-b746-4988-8925-456843ddc533",
      ["attributes"] =>  [
        ["sku"] =>  "TEST3Y",
        ["category"] =>  "electronics",
        ["term"] =>  3,
        ["type"] =>  "Repair plan with accident protection",
        ["bulletPoints"] =>  "Extended warranty|Accident Protection|No deductibles",
        ["link"] =>  "https://hiclyde.com/contracts/test?id=TEST3Y",
        ["summary"] =>  "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
        ["premium"] =>  10.00,
        ["recommendedPrice"] =>  12.50
      ]
    ], [
      ["type"] =>  "contract",
      ["id"] =>  "ec4b4682-7df5-49cd-ad26-ad619fb38df0",
      ["attributes"] =>  [
        ["sku"] =>  "TEST5Y",
        ["category"] =>  "electronics",
        ["term"] =>  5,
        ["type"] =>  "Repair plan with accident protection",
        ["bulletPoints"] =>  "Extended warranty|Accident Protection|No deductibles",
        ["link"] =>  "https://hiclyde.com/contracts/test?id=TEST5Y",
        ["summary"] =>  "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
        ["premium"] =>  16.00,
        ["recommendedPrice"] =>  20.00
      ]
    ]]
  ],
  ["links"] =>  [
    ["self"] =>  "https://api.joinclyde.com/products/SKU123"
  ]
]

Fetches details of a product by its SKU. Product SKUs are user inputs and must be unique, so that you're not required to store any IDs external to your system.

Argument Required Content
sku true string: The product SKU to filter on.
ip false string: The customer's IP address.

Get Products

Request

GET /products HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.getProducts();

clyde.getProducts(
  1,
  ["SKU123", "SKU456"],
  "192.168.2.1"
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->getProducts();
// OR
$opts["page"] = 1;
$opts["skus"] = ["SKU123","SKU456"];
$opts["ip"] = "192.168.2.1";
$clyde->getProducts($opts);

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/products

{
  "meta": {
    "totalPages": 1
  },
  "data": [{
    "type": "product",
    "id": "bd41282a-9b53-4107-8a08-7d2bef6024d3",
    "attributes": {
      "name": "Example Product",
      "type": "Appliance",
      "sku": "SKU123",
      "description": "A good product",
      "manufacturer": "Clyde General Store",
      "barcode": "",
      "price": 14.99,
      "imageLink": "",
      "contracts": [{
        "type": "contract",
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "attributes": {
          "sku": "TEST3Y",
          "category": "electronics",
          "term": 3,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST3Y",
          "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
          "premium": 10.00,
          "recommendedPrice": 12.50
        }
      }, {
        "type": "contract",
        "id": "ec4b4682-7df5-49cd-ad26-ad619fb38df0",
        "attributes": {
          "sku": "TEST5Y",
          "category": "electronics",
          "term": 5,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST5Y",
          "summary": "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
          "premium": 16.00,
          "recommendedPrice": 20.00
        }
      }]
    },
    "links": {
      "self": "https://api.joinclyde.com/products?page=1"
    }
  }, {
    "type": "product",
    "id": "hs7UJ1pL-88Hn-121L-LKmc-jH9jMga7J01q",
    "attributes": {
      "name": "Another Example Product",
      "type": "Television",
      "sku": "SKU456",
      "description": "A great product",
      "manufacturer": "Clyde General Store",
      "barcode": "",
      "price": 249.99,
      "imageLink": "",
      "contracts": []
    },
    "links": {
      "self": "https://api.joinclyde.com/products?page=1"
    }
  }]
}

JSON Response

{
  "meta": {
    "totalPages": 1
  },
  "data": [{
    "type": "product",
    "id": "bd41282a-9b53-4107-8a08-7d2bef6024d3",
    "attributes": {
      "name": "Example Product",
      "type": "Appliance",
      "sku": "SKU123",
      "description": "A good product",
      "manufacturer": "Clyde General Store",
      "barcode": "",
      "price": 14.99,
      "imageLink": "",
      "contracts": [{
        "type": "contract",
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "attributes": {
          "sku": "TEST3Y",
          "category": "electronics",
          "term": 3,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST3Y",
          "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
          "premium": 10.00,
          "recommendedPrice": 12.50
        }
      }, {
        "type": "contract",
        "id": "ec4b4682-7df5-49cd-ad26-ad619fb38df0",
        "attributes": {
          "sku": "TEST5Y",
          "category": "electronics",
          "term": 5,
          "type": "Repair plan with accident protection",
          "bulletPoints": "Extended warranty|Accident Protection|No deductibles",
          "link": "https://hiclyde.com/contracts/test?id=TEST5Y",
          "summary": "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
          "premium": 16.00,
          "recommendedPrice": 20.00
        }
      }]
    },
    "links": {
      "self": "https://api.joinclyde.com/products?page=1"
    }
  }, {
    "type": "product",
    "id": "hs7UJ1pL-88Hn-121L-LKmc-jH9jMga7J01q",
    "attributes": {
      "name": "Another Example Product",
      "type": "Television",
      "sku": "SKU456",
      "description": "A great product",
      "manufacturer": "Clyde General Store",
      "barcode": "",
      "price": 249.99,
      "imageLink": "",
      "contracts": []
    },
    "links": {
      "self": "https://api.joinclyde.com/products?page=1"
    }
  }]
}

Response

<?php

["meta"] => [
  ["totalPages"] => 1
],
["data"] => [[
  ["type"] => "product",
  ["id"] => "bd41282a-9b53-4107-8a08-7d2bef6024d3",
  ["attributes"] => [
    ["name"] => "Example Product",
    ["type"] => "Appliance",
    ["sku"] => "SKU123",
    ["description"] => "A good product",
    ["manufacturer"] => "Clyde General Store",
    ["barcode"] => "",
    ["price"] => 14.99,
    ["imageLink"] => "",
    ["contracts"] => [[
      ["type"] => "contract",
      ["id"] => "fbd13a8f-b746-4988-8925-456843ddc533",
      ["attributes"] => [
        ["sku"] => "TEST3Y",
        ["category"] => "electronics",
        ["term"] => 3,
        ["type"] => "Repair plan with accident protection",
        ["bulletPoints"] => "Extended warranty|Accident Protection|No deductibles",
        ["link"] => "https://hiclyde.com/contracts/test?id=TEST3Y",
        ["summary"] => "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
        ["premium"] => 10.00,
        ["recommendedPrice"] => 12.50
      ]
    ],[
      ["type"] => "contract",
      ["id"] => "ec4b4682-7df5-49cd-ad26-ad619fb38df0",
      ["attributes"] => [
        ["sku"] => "TEST5Y",
        ["category"] => "electronics",
        ["term"] => 5,
        ["type"] => "Repair plan with accident protection",
        ["bulletPoints"] => "Extended warranty|Accident Protection|No deductibles",
        ["link"] => "https://hiclyde.com/contracts/test?id=TEST5Y",
        ["summary"] => "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
        ["premium"] => 16.00,
        ["recommendedPrice"] => 20.00
      ]
    ]]
  ],
  ["links"] => [
    ["self"] => "https://api.joinclyde.com/products?page=1"
  ]
],
[
  ["type"] => "product",
  ["id"] => "hs7UJ1pL-88Hn-121L-LKmc-jH9jMga7J01q",
  ["attributes"] => [
    ["name"] => "Another Example Product",
    ["type"] => "Television",
    ["sku"] => "SKU456",
    ["description"] => "A great product",
    ["manufacturer"] => "Clyde General Store",
    ["barcode"] => "",
    ["price"] => 249.99,
    ["imageLink"] => "",
    ["contracts"] => []
  ],
  ["links"] => [
    ["self"] => "https://api.joinclyde.com/products?page=1"
  ]
]]

Fetches all products for your store.

Argument Required Content
page false integer: A page number between 1 and the totalPages value returned under the meta object in each response. Each page is limited to 25 products. Default 1.
sku false array: A comma-separated list of product SKUs to filter on.
ip false string: The customer's IP address.

Delete Product

Request

DELETE /products/SKU123 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.deleteProduct(
  "SKU123" // Product sku
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->deleteProduct("SKU123");

Response

HTTP/1.1 204 No Content
Content-Type: application/vnd.api+json

JSON Response

// No return, will come through as undefined

Response

<?php

// No return, will come through without a value

Deletes product by SKU.

Argument Required Content
SKU true string: The SKU of the product.

Contracts

Get Contracts

Request

GET /contracts HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.getContracts();
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->getContracts();

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/contracts

"data": [
  {
    "type": "contract",
    "id": "0100ed46-fec0-4a09-845f-7a985ac5f0c1",
    "attributes": {
      "sku": "TEST3Y",
      "adh": false,
      "category": "Test Protection",
      "term": 3,
      "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
      "bulletPoints": "",
      "urlSlug": "test?id=TEST3Y",
      "priceBandMin": 0,
      "priceBandMax": 100000,
      "premium": 20
    }
  }, {
    "type": "contract",
    "id": "0100ed46-fec0-4a09-845f-7a985ac5f0c0",
    "attributes": {
      "sku": "TEST2Y",
      "adh": false,
      "category": "Test Protection",
      "term": 2,
      "summary": "This plan covers your product and protects against accidents for 2 years, starting at the date of purchase.",
      "bulletPoints": "",
      "urlSlug": "test?id=TEST2Y",
      "priceBandMin": 0,
      "priceBandMax": 100000,
      "premium": 15
    }
  }
]

Response

{
  "data": [{
    "type": "contract",
    "id": "0100ed46-fec0-4a09-845f-7a985ac5f0c1",
    "attributes": {
      "sku": "TEST3Y",
      "adh": false,
      "category": "Test Protection",
      "term": 3,
      "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
      "bulletPoints": "",
      "urlSlug": "test?id=TEST3Y",
      "priceBandMin": 0,
      "priceBandMax": 100000,
      "premium": 20
    },
  }, {
    "type": "contract",
    "id": "0100ed46-fec0-4a09-845f-7a985ac5f0c0",
    "attributes": {
      "sku": "TEST2Y",
      "adh": false,
      "category": "Test Protection",
      "term": 2,
      "summary": "This plan covers your product and protects against accidents for 2 years, starting at the date of purchase.",
      "bulletPoints": "",
      "urlSlug": "test?id=TEST2Y",
      "priceBandMin": 0,
      "priceBandMax": 100000,
      "premium": 15
    },
  }]
}

Response

<?php

["data"] =>  [[
  ["type"] =>  "contract"
  ["id"] => "0100ed46-fec0-4a09-845f-7a985ac5f0c1"
  ["attributes"] =>  [
    ["sku"] =>  "TEST3Y"
    ["adh"] => false
    ["category"] =>  "Test Protection"
    ["term"] =>  3
    ["summary"] =>  "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase."
    ["bulletPoints"] =>  ""
    ["urlSlug"] =>  "test?id=TEST3Y"
    ["priceBandMin"] =>  0
    ["priceBandMax"] =>  100000
    ["premium"] =>  20
  ]
],[
  ["type"] =>  "contract"
  ["id"] => "0100ed46-fec0-4a09-845f-7a985ac5f0c0"
  ["attributes"] =>  [
    ["sku"] =>  "TEST2Y"
    ["adh"] => false
    ["category"] =>  "Test Protection"
    ["term"] =>  2
    ["summary"] =>  "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase."
    ["bulletPoints"] =>  ""
    ["urlSlug"] =>  "test?id=TEST2Y"
    ["priceBandMin"] =>  0
    ["priceBandMax"] =>  100000
    ["premium"] =>  15
  ]
]]

Fetches all contracts associated with your store.

Get Contracts for Product

Request

GET /products/SKU123/contracts HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.getContractsForProduct(
  "SKU123",
  "192.168.2.1"
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->getContractsForProduct("SKU123", "192.168.2.1");

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/products/SKU123/contracts

{
  "data": [{
    "type": "contract",
    "attributes": {
      "sku": "TEST3Y",
      "category": "electronics",
      "term": 3,
      "type": "Repair plan with accident protection",
      "link": "https://hiclyde.com/contracts/test?id=TEST3Y",
      "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
      "premium": 10.00,
      "recommendedPrice": 12.50
    }
  }, {
    "type": "contract",
    "attributes": {
      "sku": "TEST5Y",
      "category": "electronics",
      "term": 5,
      "type": "Repair plan with accident protection",
      "link": "https://hiclyde.com/contracts/test?id=TEST5Y",
      "summary": "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
      "premium": 16.00,
      "recommendedPrice": 20.00
    }
  }]
}

JSON Response

{
  "data": [{
    "type": "contract",
    "attributes": {
      "sku": "TEST3Y",
      "category": "electronics",
      "term": 3,
      "type": "Repair plan with accident protection",
      "link": "https://hiclyde.com/contracts/test?id=TEST3Y",
      "summary": "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase.",
      "premium": 10.00,
      "recommendedPrice": 12.50
    }
  }, {
    "type": "contract",
    "attributes": {
      "sku": "TEST5Y",
      "category": "electronics",
      "term": 5,
      "type": "Repair plan with accident protection",
      "link": "https://hiclyde.com/contracts/test?id=TEST5Y",
      "summary": "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase.",
      "premium": 16.00,
      "recommendedPrice": 20.00
    }
  }]
}

Response

<?php

["data"] =>  [[
  ["type"] =>  "contract"
  ["attributes"] =>  [
    ["sku"] =>  "TEST3Y"
    ["category"] =>  "electronics"
    ["term"] =>  3,
    ["type"] =>  "Repair plan with accident protection"
    ["link"] =>  "https://hiclyde.com/contracts/test?id=TEST3Y"
    ["summary"] =>  "This plan covers your product and protects against accidents for 3 years, starting at the date of purchase."
    ["premium"] =>  10.00,
    ["recommendedPrice"] =>  12.50
  ]
],[
  ["type"] =>  "contract"
  ["attributes"] =>  [
    ["sku"] =>  "TEST5Y"
    ["category"] =>  "electronics"
    ["term"] =>  5,
    ["type"] =>  "Repair plan with accident protection"
    ["link"] =>  "https://hiclyde.com/contracts/test?id=TEST5Y"
    ["summary"] =>  "This plan covers your product and protects against accidents for 5 years, starting at the date of purchase."
    ["premium"] =>  16.00,
    ["recommendedPrice"] =>  20.00
  ]
]]

Fetches all contracts matched to a product by the product's SKU.

We recommend loading contracts matched with your products in real time using this endpoint. This ensures that you always have the most up-to-date contract information to display to your customers and don't need to maintain any mapping of contracts to products within your own system.

Argument Required Content
productSku true string: The product SKU to filter on.
ip false string: The customer's IP address.

Orders

Create Order

Request

POST /orders HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "order",
    "id": "1234567890", // order ID from your system
    "attributes": {
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      },
      "contractSales": [{
        "lineItemId": "0987654321",
        "productSku": "SKU123",
        "contractSku": "TEST3Y",
        "productPrice": 14.99,
        "contractPrice": 10.00
        "serialNumber": "cont123"
      }],
      "lineItems": [{
        "id":"1234567899",
        "productSku": "SKU123",
        "price": 14.99,
        "quantity": 1,
        "serialNumber": "pro456"
      }]
    }
  }
}
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.createOrder(
  "1234567890", // order ID from your system
  {
    "customer": {
      "firstName": "Angelica",
      "lastName": "Ferro",
      "email": "angelica@sample.com",
      "phone": "123-456-7890",
      "address1": "311 Greenwich St",
      "address2": "",
      "city": "New York",
      "province": "New York",
      "zip": "10013",
      "country": "US"
    },
    "contractSales": [{
      "lineItemId": "0987654321",
      "productSku": "SKU123",
      "contractSku": "TEST3Y",
      "productPrice": 14.99,
      "contractPrice": 10.00
      "serialNumber": "cont123"
    }],
    "lineItems": [{
      "id":"1234567899",
      "productSku": "SKU123",
      "price": 14.99,
      "quantity": 1,
      "serialNumber": "pro456"
    }]
  }
);
<?php

$orderOpts["customer"] = [
  ["firstName"] => "Angelica",
  ["lastName"] => "Ferro",
  ["email"] => "angelica@sample.com",
  ["phone"] => "123-456-7890",
  ["address1"] => "311 Greenwich St",
  ["address2"] => "",
  ["city"] => "New York",
  ["province"] => "New York",
  ["zip"] => "10013",
  ["country"] => "US"
];

$orderOpts["contractSales"] = [
  ["lineItemId"] => "0987654321",
  ["productSku"] => "SKU123",
  ["contractSku"] => "TEST3Y",
  ["productPrice"] => 14.99,
  ["contractPrice"] => 10.00
];

$orderOpts["lineItems"] = [
  ["id"] => "1234567899",
  ["productSku"] => "SKU123",
  ["price"] => 14.99,
  ["quantity"] => 1,
  ["serialNumber"] => "pro456"
];

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->createOrder("1234567890", $orderOpts);

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/orders/1234567890

{
  "data": {
    "type": "order",
    "id": "1234567890",
    "attributes": {
      "clydeId": "5f070170-5241-4d22-a3b3-3f1bc8dba1b2",
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      },
      "contractSales": [{
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "lineItemId": "0987654321",
        "productSku": "SKU123",
        "contractSku": "TEST3Y",
        "productPrice": 14.99,
        "contractPrice": 10.00
      }],
      "lineItems":[{
        "id": 11234567890,
        "productSku": "SKU123",
        "productName": "A good product",
        "price": "14.99",
        "serialNumber": "pro456"
      }]
    }
  }
}

JSON Response

{
  "data": {
    "type": "order",
    "id": "1234567890",
    "attributes": {
      "clydeId": "5f070170-5241-4d22-a3b3-3f1bc8dba1b2",
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      },
      "contractSales": [{
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "lineItemId": "0987654321",
        "productSku": "SKU123",
        "contractSku": "TEST3Y",
        "productPrice": 14.99,
        "contractPrice": 10.00
      }],
      "lineItems":[{
        "id": 11234567890,
        "productSku": "SKU123",
        "productName": "A good product",
        "price": "14.99",
        "serialNumber": "pro456"
      }]
    }
  }
}

Response

<?php

["data"] =>  [
  ["type"] => "order"
  ["id"] => "1234567890"
  ["attributes"] => [
    ["clydeId"] => "5f070170-5241-4d22-a3b3-3f1bc8dba1b2"
    ["customer"] => [
      ["firstName"] => "Angelica"
      ["lastName"] => "Ferro"
      ["email"] => "angelica@sample.com"
      ["phone"] => "123-456-7890"
      ["address1"] => "311 Greenwich St"
      ["address2"] => ""
      ["city"] => "New York"
      ["province"] => "New York"
      ["zip"] => "10013"
      ["country"] => "US"
    ],
    ["contractSales"] =>  [[
      ["id"] => "fbd13a8f-b746-4988-8925-456843ddc533"
      ["lineItemId"] => "0987654321"
      ["productSku"] => "SKU123"
      ["contractSku"] => "TEST3Y"
      ["productPrice"] => 14.99,
      ["contractPrice"] => 10.00
    ]],
    ["lineItems"] => [[
      ["id"] => 11234567890
      ["productSku"] => "SKU123"
      ["productName"] => "A good product"
      ["price"] => "14.99"
      ["serialNumber"] => "pro456"
    ]]
  ]
]

All contract sales are recorded within an order. Often more than one contract will be sold in a single checkout, with all contracts having the same customer information. The request body must contain an id used to reference the order, which should correspond to the order ID in your system.

The id of each item in the returned contractSales array can be used to retrieve or cancel individual sales (see Get Contract Sale and Cancel Contract Sale).

Top Level Properties

Argument Required Content
id true string: A unique order ID. Should correspond to the ID of the order in your system.
orderOpts true JSON Object: Contains the customer, contractSales, and lineItems information of the order, all of which are detailed below.

Customer Object

A valid customer must be passed along with every order.

Attribute Required Content
firstName true string: Customer first name.
lastName true string: Customer last name.
email true string: Customer email — must be a valid email for contract information to be properly sent to your customer.
phone true string: Customer phone number — if unavailable an empty string may be used.
address1 true string: Customer delivery address line 1.
address2 false string: Customer delivery address line 2.
city true string: Customer delivery address city.
province true string: Customer delivery address state/province.
zip true string: Customer delivery address zip code.
country true string: Customer delivery address country.

Contract Sales Object

contractSales may be sent as an empty array if no contracts were purchased with an order.

Attribute Required Content
lineItemId true string: ID of the line item this contract was sold with.
productSku true string: Product SKU.
contractSku true string: Contract SKU.
productPrice true float: Product price at time of sale.
contractPrice true float: Contract price at time of sale.
serialNumber false string: Serial number if available, or null.

Line Items Object

lineItems may be an empty array if no line items were purchased with an order.

Attribute Required Content
id true string: Line item ID — must be unique to the order.
productSku true string: Product SKU.
price true float: Product price at time of sale.
quantity true integer: Number of this line item sold in the order.
serialNumber false string: Serial number if available, or null.

Update Line Item Status

Request

PUT /orders/1234567890/lineItem/9231 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json

{
  "data": {
    "type": "lineItem",
    "attributes": {
      "itemState": {
        "isShipped": true,
        "isDelivered": true,
        "isRefunded": false
      }
    }
  }
}
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.updateLineItem(
  "1234567890", // order ID from your system
  "9231", // lineItem ID from your system
  "state": {
    "isShipped": true,
    "isDelivered": true,
    "isRefunded": false
  }
);
<?php

$state["isShipped"] = true; 
$state["isDelivered"] = true; 
$state["isRefunded"] = false; 

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->updateLineItem("1234567890", "9231", $state);

Response

HTTP/1.1 201 Created
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/orders/1234567890/lineItem/9231

{
  "data": {
    "type": "lineItem",
    "id": "9231",
    "attributes": {
      "itemState": {
        "isShipped": true,
        "isDelivered": true,
        "isRefunded": false
      }
    }
  }
}

JSON Response

{
  "data": {
    "type": "lineItem",
    "id": "9231",
    "attributes": {
      "itemState": {
        "isShipped": true,
        "isDelivered": true,
        "isRefunded": false
      }
    }
  }
}

Response

<?php

["data"] =>  [
  ["type"] => "lineItem"
  ["id"] => "9231"
  ["lineItems"] => [[
    ["itemState"] => [
      ["isShipped"] => true,
      ["isDelivered"] => true,
      ["isRefunded"] => false,
    ]
  ]]

]

Updates the status of the line item in the Clyde system.

Top Level Properties

Argument Required Content
orderId true string: A unique order ID. Should correspond to the ID of the order in your system.
lineItemId true string: A unique line item ID. Should correspond to the ID of the line item in your system.
state true JSON Object: An object of booleans(true/false) that represent the status of the line item.

State Object

state is an object of boolean values that represent the status of the line item.

Attribute Required Content
isShipped false boolean: Has the item been shipped, true/false.
isDelivered false boolean: Has the item been delivered, true/false.
isRefunded false boolen: Has the item been refunded, true/false.

Get Order

Request

GET /orders/1234567890 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.getOrder(
  "1234567890" // order ID from your system
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->getOrder("1234567890");

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/orders/1234567890

{
  "data": {
    "type": "order",
    "id": "1234567890",
    "attributes": {
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      },
      "contractSales": [{
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "lineItemId": "0987654321",
        "productSku": "SKU123",
        "contractSku": "TEST3Y",
        "productPrice": 14.99,
        "contractPrice": 10.00,
        "serialNumber": "con123"
      }]
    }
  }
}

JSON Response

{
  "data": {
    "type": "order",
    "id": "1234567890",
    "attributes": {
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      },
      "contractSales": [{
        "id": "fbd13a8f-b746-4988-8925-456843ddc533",
        "lineItemId": "0987654321",
        "productSku": "SKU123",
        "contractSku": "TEST3Y",
        "productPrice": 14.99,
        "contractPrice": 10.00,
        "serialNumber": "con123"
      }]
    }
  }
}

Response

<?php

["data"] =>  [
  ["type"] =>  "order",
  ["id"] =>  "1234567890",
  ["attributes"] =>  [
    ["customer"] =>  [
      ["firstName"] =>  "Angelica",
      ["lastName"] =>  "Ferro",
      ["email"] =>  "angelica@sample.com",
      ["phone"] =>  "123-456-7890",
      ["address1"] =>  "311 Greenwich St",
      ["address2"] =>  "",
      ["city"] =>  "New York",
      ["province"] =>  "New York",
      ["zip"] =>  "10013",
      ["country"] =>  "US"
    ],
    ["contractSales": [[
      ["id"] =>  "fbd13a8f-b746-4988-8925-456843ddc533",
      ["lineItemId"] =>  "0987654321",
      ["productSku"] =>  "SKU123",
      ["contractSku"] =>  "TEST3Y",
      ["productPrice"] =>  14.99,
      ["contractPrice"] =>  10.00,
      ["serialNumber"] =>  "con123"
    ]]
  ]
]

Retrieves an order by its id. An order's ID is supplied by you at the time of order creation, and should be a unique identifier tracked in your own system.

Argument Required Content
id true string: The order ID to filter on.

Cancel Order

Request

DELETE /orders/1234567890 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.cancelOrder(
  "1234567890" // order ID from your system
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->cancelOrder("1234567890");

Response

HTTP/1.1 204 No Content
Content-Type: application/vnd.api+json

JSON Response

// No return, will come through as undefined
<!-- No return, undefined -->

Response

<?php

// No return, will come through without a value

Cancels all contract sales associated with a particular order. A sale cancelled before being reported will not be reported or billed for. A sale cancelled after being reported but before being billed for will be cancelled with the appropriate insurance partner and not billed for. A sale already reported and billed for will be cancelled with the insurer and a credit will be issued to your account for the amount charged for the sale(s) in question.

All cancellations made within 30 days of purchase must be refunded in full. For instruction on how to handle cancellations after 30 days, please reach out to us at refunds@joinclyde.com.

Argument Required Content
id true string: The order ID to cancel.

Contract Sales

Get Contract Sale

Request

GET /contract-sales/fbd13a8f-b746-4988-8925-456843ddc533 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.getContractSale(
  "fbd13a8f-b746-4988-8925-456843ddc533" // contract ID from Clyde
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->getContractSale("fbd13a8f-b746-4988-8925-456843ddc533");

Response

HTTP/1.1 200 OK
Content-Type: application/vnd.api+json
Location: https://api.joinclyde.com/contract-sales/5e3efc90-3afc-48af-b58e-c568b660f9a0

{
  "data": {
    "type": "contractSale",
    "id": "fbd13a8f-b746-4988-8925-456843ddc533",
    "attributes": {
      "orderId": "1234567890",
      "lineItemId": "0987654321",
      "productSku": "SKU123",
      "contractSku": "TEST3Y",
      "productPrice": 14.99,
      "contractPrice": 10.00,
      "serialNumber": "con123",
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      }
    },
    "links": {
      "self": "https://api.joinclyde.com/contract-sales/fbd13a8f-b746-4988-8925-456843ddc533"
    }
  }
}

JSON Response

{
  "data": {
    "type": "contractSale",
    "id": "fbd13a8f-b746-4988-8925-456843ddc533",
    "attributes": {
      "orderId": "1234567890",
      "lineItemId": "0987654321",
      "productSku": "SKU123",
      "contractSku": "TEST3Y",
      "productPrice": 14.99,
      "contractPrice": 10.00,
      "serialNumber": "con123",
      "customer": {
        "firstName": "Angelica",
        "lastName": "Ferro",
        "email": "angelica@sample.com",
        "phone": "123-456-7890",
        "address1": "311 Greenwich St",
        "address2": "",
        "city": "New York",
        "province": "New York",
        "zip": "10013",
        "country": "US"
      }
    },
    "links": {
      "self": "https://api.joinclyde.com/contract-sales/fbd13a8f-b746-4988-8925-456843ddc533"
    }
  }
}

Response

<?php

["data"] => [
  ["type"] => "contractSale",
  ["id"] => "fbd13a8f-b746-4988-8925-456843ddc533",
  ["attributes"] =>  [
    ["orderId"] => "1234567890",
    ["lineItemId"] => "0987654321",
    ["productSku"] => "SKU123",
    ["contractSku"] => "TEST3Y",
    ["productPrice"] => 14.99,
    ["contractPrice"] => 10.00,
    ["serialNumber"] => "con123",
    ["customer"] => [
      ["firstName"] => "Angelica",
      ["lastName"] => "Ferro",
      ["email"] => "angelica@sample.com",
      ["phone"] => "123-456-7890",
      ["address1"] => "311 Greenwich St",
      ["address2"] => "",
      ["city"] => "New York",
      ["province"] => "New York",
      ["zip"] => "10013",
      ["country"] => "US"
    ]
  ],
  ["links"] => [
    ["self"] => "https://api.joinclyde.com/contract-sales/fbd13a8f-b746-4988-8925-456843ddc533"
  ]
]

Retrieves data for an individual contract sale using an id from the contractSales array on the Create Order response.

Argument Required Content
id true string: The contract ID to filter on.

Cancel Contract Sale

Request

DELETE /contract-sales/fbd13a8f-b746-4988-8925-456843ddc533 HTTP/1.1
Content-Type: application/vnd.api+json
Accept: application/vnd.api+json
const Clyde = require("clyde-sdk");
const clyde = new Clyde({
  clientKey: "ck_test_sdfi73AGdkkiAD1a",
  clientSecret: "sk_test_1osnsdFk87yaawr3",
  isLive: false
});

clyde.cancelContractSale(
  "fbd13a8f-b746-4988-8925-456843ddc533" // contract ID from Clyde
);
<?php

$clyde = new Clyde("ck_test_sdfi73AGdkkiAD1a", "sk_test_1osnsdFk87yaawr3", false); 
$clyde->cancelContractSale("fbd13a8f-b746-4988-8925-456843ddc533");

Response

HTTP/1.1 204 No Content
Content-Type: application/vnd.api+json

JSON Response

// No return , will come through as undefined on success
<!-- No return, undefined -->

Response

<?php

// No return, no value on success

Cancels an individual contract sale using the id provided by Clyde. A contract sale cancelled before being reported will not be reported or billed for. A sale cancelled after being reported but before being billed for will be cancelled with the appropriate insurance partner and not billed for. A sale already reported and billed for will be cancelled with the insurer and a credit will be issued to your account for the amount charged for the sale(s) in question.

All cancellations made within 30 days of purchase must be refunded in full. For instruction on how to handle cancellations after 30 days, please reach out to us at refunds@joinclyde.com.

Argument Required Content
id true string: The contract ID to cancel.

Errors

Error Response Format

{
  "errors": [
    {
      "status": 401, // HTTP Status Code
      "code": 40100, // Five digit Clyde error code
      "title": "Example Error", // Short error description
      "detail": "This is an example of Clyde's API error format" // Long error description
    }
  ]
}

The Clyde API uses the following error codes:

Error Code Status Code Meaning
40100 401 Invalid Signature — Your signature is invalid.
40101 401 Invalid Client Key — Your Client Key was incorrect.
40102 401 Unauthorized — Your request lacked a valid authorization header.
40400 404 Contract Sale Not Found — The specified contract sale could not be found.
40401 404 Shop Order Not Found — The specified order could not be found.
40402 404 Product Not Found — No product matching the provided SKU could be found.
40403 404 Product Contracts Not Found — No contracts are matched with the specified product.
40410 404 Cannot decode user input ID — Cannot decode the input hashed sale ID.
40411 404 Decoded ID does not match — Hashed ContractSaleID does not match re-hashed ExternalID.
42200 422 Validation Failed — Your request was improperly formatted. The response will include information on the specific issues.
42201 422 Invalid SKU Pair — The Product/Contract SKU pair submitted for a contract sale was invalid.
42211 422 SKU already in use — Provided SKU is in use by a different product in this shop.
50001 500 Cart has issues, contact Clyde — Cart has errors, either too many line items or contracts.