Create a purchase. If some product or contact does not exists, an error is returned (see Custom Error Codes for more info)

Request

POST https://api.connectif.cloud/purchases/

Query parameters

Parameter name Value Description Additional
triggerPurchaseEvent boolean

Whether the purchase event should be triggered or not in the Workflow, executing the On-Purchase Trigger Node. Notice some other events may be triggered as a result of creating the Purchase, i.e. contact entered segment. Defaults to true.

Request body

The request body takes a complete PurchaseCreation resource, containing the following writable properties:

{
    "cartId": "string",
    "contactEmail": "email",
    "paymentMethod": "string",
    "products": [
        {
            "brand": "string",
            "categories": [
                "string"
            ],
            "customField1": "string",
            "customField2": "string",
            "customField3": "string",
            "description": "string",
            "discountedAmount": "number",
            "discountedPercentage": "number",
            "imageUrl": "uri",
            "name": "string",
            "price": "number",
            "productDetailUrl": "uri",
            "productId": "string",
            "publishedAt": "date-time",
            "quantity": "integer",
            "rating": "number",
            "ratingCount": "integer",
            "reviewCount": "integer",
            "tags": [
                "string"
            ],
            "thumbnailUrl": "uri",
            "unitPrice": "number",
            "unitPriceOriginal": "number",
            "unitPriceWithoutVAT": "number"
        }
    ],
    "purchaseDate": "date-time",
    "purchaseId": "string",
    "totalPrice": "number",
    "totalQuantity": "integer"
}

Properties

Name Type Description Additional
cartId string

The id of the cart purchased

contactEmail email

The email of the contact who made the purchase

paymentMethod string

The payment method used to purchase

Optional
products[] array

The products purchased

products[].brand string

The brand of the product

Optional
products[].categories[] array of string

The categories of the product. In case of sub-categories the symbol "/" must be used to represent the hierarchy, i.e.: [ "Latest Arrivals", "Pc/Keyboards/Special" ]

Optional
products[].customField1 string

Field reserved for custom purposes 1

Optional
products[].customField2 string

Field reserved for custom purposes 2

Optional
products[].customField3 string

Field reserved for custom purposes 3

Optional
products[].description string

The description of the product

Optional
products[].discountedAmount number

The price of the product discounted comparing with unitPrice

Optional
products[].discountedPercentage number

The discount percentage of the product comparing unitPrice with unitPriceOriginal

Optional
products[].imageUrl uri

The image url of the product

Optional
products[].name string

The name of the product

products[].price number

The result of multiplying unitPrice by quantity

products[].productDetailUrl uri

The detail url of the product, must be accessible

products[].productId string

The external id of the product in your store

products[].publishedAt date-time

Date in ISO8601 format of the first time the product appeared in the store catalog

Optional
products[].quantity integer

The quantity of this product in the purchase

products[].rating number

The product rating

Optional
products[].ratingCount integer

The number of ratings of the product

Optional
products[].reviewCount integer

The number of reviews of the product

Optional
products[].tags[] array of string

The tags of the product

Optional
products[].thumbnailUrl uri

The image thumbnail url of the product

Optional
products[].unitPrice number

The unit price of the product

products[].unitPriceOriginal number

The unit price of the product before applying any discount

Optional
products[].unitPriceWithoutVAT number

The unit price of the product before applying any taxes

Optional
purchaseDate date-time

The date of purchase in ISO8601 format

purchaseId string

The external id of the purchase in your store

totalPrice number

The total price of the purchase. Not necessarily has to be equal to the addition of all individual product prices, it could include taxes or shipping costs

totalQuantity integer

The quantity of products purchased. This should match the addition of all individual product quantities

Authorization

This request requires the use of one of following authorization methods: API key .

Response

The following HTTP status codes may be returned, optionally with a response resource.

Status code Description Resource
201 Created

Success.

Purchase
400 Bad Request

Bad request, i.e.: invalid json.

HttpError
401 Unauthorized

Not authorized to access API.

403 Forbidden

Permission not granted to the API Key or account has been blocked.

HttpError
409 Conflict

Purchase already exists.

HttpError
415 Unsupported Media Type

Request without application/json Content-Type header.

HttpError
422 Unprocessable Entity

Resource contains validation errors.

HttpUnprocessableEntityError
429 Too Many Requests

Requests rate limit reached.