A customer in the Inveterate system is anyone that has purchased an Inveterate subscription product from this merchant's store.
A customer
is represented as an object with the following structure:
Copy {
accountState : String , // from Shopify
contractId : Number ,
createdAt : String ,
credit : Number ,
customerId : String ,
email : String ,
firstName : String ,
lastName : String ,
orderCount : Number ,
orderIds : Array[Number]
merchantId : String ,
status : String , // status of Inveterate subscription
totalSpend : Number ,
updatedAt : String
}
Endpoints & Methods
Get a single customer
GET
https://public.inveterateapi.com/customers/{customerId}
Gets a single customer.
Path Parameters
200 Get customer success 400: Bad Request All errors
Copy {
"data" : {
"customer" : {
"accountState" : "ENABLED" ,
"contractId" : 1234567890 ,
"createdAt" : "2021-10-27T18:10:08.754Z" ,
...
}
}
"success" : true ,
"errors" : []
}
Copy {
"data" : {}
"success" : false ,
"errors" : [
"Invalid API key"
]
}
Get all customers
GET
https://api.inveterate.com/2022-01/customers
Query Parameters
200: OK Get customers success 400: Bad Request All errors
Copy {
"data" : {
"customers" : [
{
"accountState" : "ENABLED" ,
"contractId" : 1234567890 ,
"createdAt" : "2021-10-27T18:10:08.754Z" ,
...
}
] ,
"lastCustomerId" : "1234567890"
}
"success" : true ,
"errors" : []
}
Copy {
"data" : {}
"success" : false ,
"errors" : [
"Invalid API key"
]
}
Get Customers (Paginated)
Optionally using the limit
and lastCustomerId
query string parameters, you can "paginate" through the customer records returned.
For the first page, just add the limit
parameter. The response for this will include the lastCustomerId
, which needs to be added as a query string parameter to the request for page 2.
Page 1 request example
Copy curl --location --request GET "${PUBLIC_API_URL}/customers?limit=1" \
--header "X-Inveterate-Api-Key: ${PUBLIC_API_KEY}"
Page 1 response example
Copy {
"success": true,
"data": {
"customers": [
{
"lastName": "Alda",
"firstName": "Alan",
"customerId": "6082598928622"
}
],
"lastCustomerId": "6082598928622",
"limit": "1"
},
"errors": []
}
Page 2 request example
Copy curl --location --request GET "${PUBLIC_API_URL}/customers?limit=1&lastCustomerId=6082598928622" \
--header "X-Inveterate-Api-Key: ${PUBLIC_API_KEY}"
Page 2 response example
Copy {
"success": true,
"data": {
"customers": [
{
"lastName": "Bernanke",
"firstName": "Ben",
"customerId": "6082606694638"
}
],
"lastCustomerId": "6082606694638",
"limit": "1"
},
"errors": []
}
Cancel Customer Subscription
Request customer cancellation
POST
https://public.inveterateapi.com/customers/{customerId}/cancel
Step 1 of the customer's subscription cancellation process. A successful request to this endpoint submits a customer cancellation request. Customer will receive an email with a link to confirm cancellation of their subscription.
Request Body
200: OK Request received successfully 400: Bad Request All errors
Copy {
"success" : true ,
"data" : {
"cancelRequest" : {
"merchantId" : "inveterate-staging-barefoot" ,
"cancelToken" : "c52157e9-2406-49d1-b374-583c92a3e3dd" ,
"customerId" : "5574691979318" ,
"status" : "INITIALIZED" ,
"createdAt" : "2022-03-15T00:07:16.168Z" ,
"updatedAt" : "2022-03-15T00:07:16.168Z"
}
} ,
"errors" : []
}
Copy {
"data" : {}
"success" : false ,
"errors" : [
"Invalid API key"
]
}
Last updated 8 months ago