Skip to main content

CCC API - Documentation

Confidentiality

If you have not signed an NDA with Calm Experts or Calm Commerce you are not permitted to have access to this document nor any of its associated documents. If you are an employee or contractor with Calm Experts, you are bound by your Employment Agreement, NDA, our Code of Conduct and Development Guidelines. Make sure you have refreshed your memory on all these internal guidelines before reading this document or working on this project.

This is a simple api to do
*create product
*delete products
*get all products
*create orders
*get all orders
*payments

headers

{

"Content-Type":"application/json"

}

Users

*GET

lists of users

*get
https://us-central1-calm-commerce.cloudfunctions.net/api/v1/users

Get single user

*get
https://us-central1-calm-commerce.cloudfunctions.net/api/v1/users/id

//

//create user

https://us-central1-calm-commerce.cloudfunctions.net/api/v1/signup

Request body {  
"email":"hayderab@outlook.net",
"password":"1234568"
}

Response {

"id": "yBNz4xNba6eUBirVUwsa6MFzEDh1",
"email": "hayderab@outlook.net",
"emailVerified": **false**,
"refreshToken": "AOvuKvTqhHeJ51HjlCZDasYffEVTGkgtVz3i\_Cn6y4dX6zuY2okvXTEbGkNGVLdf4WjTB7eHV2jIAhgaSgvFYIO0dA”

}

Login

Same as signup*
https://us-central1-calm-commerce.cloudfunctions.net/api/v1/login

Create Product

Key ( The project id from calm commerce)

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/create_product

*post

Request body {  
`"`name`"`:”product name”,
`"Price:””,`
`"Brand":””,`
`"is_visible":true,`
`"images": [`
`{`
`"product_id": 632910392,`
`"position": 1,`
`"created_at": "2018-01-08T12:34:47-05:00",`
`"updated_at": "2018-01-08T12:34:47-05:00",`
`"width": 110,`
`"height": 140,`
`"src": "http://example.com/burton.jpg",`
`"variant_ids": [`
`{}`
`]`
`}`
`],`
`"variants": [`
`{`
`"barcode": "1234_pink",`
`"compare_at_price": null,`
`"created_at": "2012-08-24T14:01:47-04:00",`
`"fulfillment_service": "manual",`
`"grams": 567,`
`"weight": 0.2,`
`"weight_unit": "kg",`
`"id": 808950810,`
`"inventory_item_id": 341629,`
`"inventory_management": "shopify",`
`"inventory_policy": "continue",`
`"inventory_quantity": 10,`
`"option1": "Pink",`
`"position": 1,`
`"price": 199.99,`
`"presentment_prices": [`
`{`
`"price": {`
`"currency_code": "USD",`
`"amount": "199.99"`
`},`
`"compare_at_price": null`
`},`
`{`
`"price": {`
`"currency_code": "EUR",`
`"amount": "158.95"`
`},`
`"compare_at_price": null`
`},`
`{`
`"price": {`
`"currency_code": "GBP",`
`"amount": "143.00"`
`},`
`"compare_at_price": null`
`},`
`{`
`"price": {`
`"currency_code": "JPY",`
`"amount": "22400"`
`},`
`"compare_at_price": null`
`}`
`],`
`"product_id": 632910392,`
`"requires_shipping": true,`
`"sku": "IPOD2008PINK",`
`"taxable": true,`
`"title": "Pink",`
`"updated_at": "2012-08-24T14:01:47-04:00"`
`}]` }

Get all products

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/products
*post

Request Body {  
`"`team\_id`"`: `"ZdTjczDIf8dtl6DnxXGX",`
`"store_id": "PSKjCUkrBDPqbYiguwas",`
}

This will Retrieve all products in the store

Create order

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/create_order
//

Body  {  
`"id": 456789101,`
`"name": "#1001",`

`"customer": {`
`"id": 207119551,`
`"email": "bob.norman@hostmail.com",`
`"accepts_marketing": false,`
`"created_at": "2012-03-13T16:09:55-04:00",`
`"updated_at": "2012-03-13T16:09:55-04:00",`
`"first_name": "Bob",`
`"last_name": "Norman",`
`"orders_count": "1",`
`"state": "disabled",`
`"total_spent": "0.00",`
`"last_order_id": 450789469,`
`"note": null,`
`"verified_email": true,`
`"multipass_identifier": null,`
`"tax_exempt": false,`
`"tax_exemptions": {},`
`"phone": "+13125551212",`
`"tags": "loyal",`
`"last_order_name": "#1001",`
`"currency": "USD",`
`"addresses": {},`
`"default_address": {}},`

`"shipping_address": {`
`"address1": "123 Amoebobacterieae St",`
`"address2": "",`
`"city": "Ottawa",`
`"company": null,`
`"country": "Canada",`
`"first_name": "Bob",`
`"last_name": "Bobsen",`
`"latitude": "45.41634",`
`"longitude": "-75.6868",`
`"phone": "555-625-1199",`
`"province": "Ontario",`
`"zip": "K2P0V6",`
`"name": "Bob Bobsen",`
`"country_code": "CA",`
`"province_code": "ON"`
`},`

`"billing_address": {`
`"address1": "123 Amoebobacterieae St",`
`"address2": "",`
`"city": "Ottawa",`
`"company": null,`
`"country": "US",`
`"first_name": null,`
`"id": 207119551,`
`"last_name": null,`
`"phone": "(555)555-5555",`
`"province": "KY",`
`"zip": "40202",`
`"name": null,`
`"province_code": null,`
`"country_code": null,`
`"default": true`
`},`
`"currency": "USD",`
`"title": "IPod Nano",`
`"variant_id": 4264112,`
`"variant_title": "Pink",`
`"vendor": "Apple",`
`"name": "IPod Nano - Pink",`
`"gift_card": false,`
`"properties": [`
`{`
`"name": "custom engraving",`
`"value": "Happy Birthday Mom!"`
`}`
`],`
`"taxable": true,`

}

Get all orders

Route: [https://us-central1-calm-commerce.cloudfunctions.net/api/v1/orders](https://us-central1-calm-commerce.cloudfunctions.net/api/v1/orders)  
post\*
Request Body {
`"`team\_id`"`: `"ZdTjczDIf8dtl6DnxXGX",`
`"store_id": "PSKjCUkrBDPqbYiguwas",`
}
`"email": "bob.norman@example.com",`
`"invoice_sent_at": "2008-01-10T11:00:00-05:00",`
`"quantity": 1,`
`"requires_shipping": true,`
`"sku": "IPOD-342-N",`

This will return all orders

Transfer Money

Transfer money from customers to vendors
*post
Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/transfer_money

Request {  
`"amount": 1500 //int this is what customer pay,`
`“transfer_amount”: 1000 //this is what vendors get`
`"payment_method": "PSKjCUkrBDPqbYiguwas",`
`"payment_method_types": "card",`
`"description": "string",`
`"receipt_email": "vendor@gmail.com",`
`"currency": "CAD",`
"confirm": true
Set to true to attempt to confirm this PaymentIntent immediately
`"customer_id": “stripe id “,`
`"destination": "vendor stripe id"`
`"sender": "user id in your database",`
`"receiver": "user id in your database"`

}

Refund

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/refund

Request body {  
"payment\_id": "string",
"amount": "pass null if you want refund full amount"

}

Finish Auth Flow

post*
//
For vendors (connected account) finish auth after redirect to your page

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/finish_flow

Request  {

"auth\_code" :”string you will get from stripe url”

}

///
This will return connected account id

Response  
{
"id":"ZdTjczDIf8dtl6DnxXGX"
}

Add source /card

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/add_source
post*

Set Default Source

//set default payment method for customer by passing method_id

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/set_source
Note: use this if the user has multiple cards/bank accounts and he wants to change default methods .

`Req  {`  
`“customer_id”:”customer_id”,`
`“source_id”:”card/bank id”`
`}`

Delete source

Route: [https://us-central1-calm-commerce.cloudfunctions.net/api/v1/`delete_source`](https://us-central1-calm-commerce.cloudfunctions.net/api/v1/orders)  
\*post
`Req {`
`“customer_id”:”customer_id”,`
`“source_id”:”card/bank id”`
`}`

This will delete source/card and then return any card available in customer account

All Payments

Route: https://us-central1-calm-commerce.cloudfunctions.net/api/v1/charges
*use get

This return all payments in database