The event “Notify purchase completed event” is used to describe a purchase made by the customer. It notifies, via JavaScript, when a user completes a purchase using the connectif.managed.sendEvents.
How to use it
The shopping cart notification uses the entityInfo option of the sendEvents method to enrich the information of the events sent.
Notify the completed purchase
This object represents the Shopping Cart model which includes the following properties:
Name | Required | Type | Description |
---|---|---|---|
purchaseId | Yes | string | Unique identifier of the purchase. |
cartId | No | string | Unique identifier of the cart from which this purchase originated. |
totalQuantity | Yes | number | Total number of products in the purchase (including duplicates). For example: if a cart has 3 units of one product and 7 units of another, totalQuantity will be 10. |
totalPrice | Yes | number | Total purchase amount. |
purchaseDate | No | string | Date of the purchase. Expected ISO_8601 format. |
paymentMethod | No | string | The payment method |
products | Yes | Product Basket Item | Items included in the purchase, along with their quantity and total price. |
Example
The notification will look like this:
connectif.managed.sendEvents([ { "type": "purchase", "purchase": { "cartId": "cart-0098caf9-42f4-44e9-afdd-45eafe892293", "totalQuantity": 1, "totalPrice": 51.88, "products": [{ "name": "My Product", "productDetailUrl": "https://myshop.com/product/details/59a31949a1a562d4979fbca2", "productId": "59a31949a1a562d4979fbca2", "unitPrice": 51.88, "availability": "outofstock", "imageUrl": "https://myshop.com/img/59a31949a1a562d4979fbca2.jpg", "description": "Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "priority": 10, "rating": 4, "tags": ["tag1", "tag2", "tag3"], "relatedExternalProductIds": ["59a31953a1a562d4979fbd90", "59a31b2ba1a562d4979fe5b8"], "brand": "Jata", "publishedAt": "2020-05-03T10:15:00Z", "quantity": 1, "price": 51.88 }], "purchaseId": "purchase-e3418b5a-8709-4593-a7c8-d8a7f12df737", "purchaseDate": "2020-06-26T12:52:51.591Z", "paymentMethod": "Credit Card" } }, { "type": "page-visit" }], { entityInfo });
Keep learning!
To make the most of your Connectif account, we recommend continuing with the following articles:
- Add Connectif JavaScript to your website, to insert the code and start collecting information about visits to your page.
- Integration via tags, to learn about all the notifications you can send from your eCommerce to Connectif and how they work.
- Integration with Connectif via API, to synchronize contacts, products, purchases, and coupons.
- Check eCommerce integration, to ensure that all data is being properly synchronized in your Connectif account.