Skip to main content

Set Cart OptIn | Climes API


This has the sample request for how to set an Opt-in status for a specific cart_id. This opted_in value can be set to true or false - depending on the users interaction with the widget. Alternatively if all orders are to be opted in, this can be directly sent via the backend.

tip

Alternatively if all orders are to be opted in, this can be directly sent via the backend.

note

These API's are only for Climes Vote product.

Request Parameters​

Create OptIn Schema​

NameDescriptionTypeOptional
cart_idThis is the cart_id of you store. This has to be unique and one this will be used to show the OptIn Card and Success Card for that particular order.string
required
opted_idThis is the value that denotes if the user has opted_in for neutralising their order or not.boolean
required
climesThis is amount of climes that are required to neutralize the footprint.number
required

Endpoint​

/v3/integrations/vote/opt-in

Method​

POST

Headers​

{
'x-api-key' : 'API_KEY',
'Content-Type' : 'application/json'
}
tip

If you use a static order id for carts and for orders,in which case you can pass the order id as the value for cart_id.

Payload​

{
"cart_id" : "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"climes" : 5,
"opted_in" : true
}
caution

Resending the same cart_id again will update the old data with the latest data that is sent.

tip

If you want to update the OptIn data for any cart_id, just send the request again with the cart_id for which the data needs to be updated along with the updated data for that request.

Response Parameters​

Status Code​

200

Response Data​

{
message : "Opt-In data added successfully"
}

Sample Request​

curl --location --request POST 'BASE_URL/v3/integrations/vote/opt-in'  
--header 'x-api-key: API_KEY'
--header 'Content-Type: application/json'
--data-raw '{
"cart_id" : "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d",
"climes" : 5,
"opted_in" : true
}'

Sample Response​

Below are sample responses for the above request.

Responses

{
"message": "Opt-In data added successfully"
}