The “Notify completed purchase event” is used to describe a purchase made by the customer. It notifies, via the Mobile SDK, when a user completes a purchase using the sendPurchase method.
How to use it
The purchase information notification uses the method Connectif.sendPurchase(purchase: Purchase), in which we will add the purchase property with all the purchase information.
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 | Yes | String | Unique identifier of the cart from which this purchase originated. |
| totalQuantity | Yes | Int | Total quantity of products in the purchase (including duplicates). |
| totalPrice | Yes | Decimal | Total amount of the purchase. |
| purchaseDate | No | Date | Purchase date. |
| paymentMethod | No | String | The payment method. |
| products | Yes | Product Basket Item | Items in the purchase, including quantity and price. |
| source_name | No | String | Name of the source to provide context about the type of purchase source. |
| source_type | No | String | The name of the source where the purchase occurred. Possible values are: "marketplace", "digital-store", "point-of-sale", "third-party" and "other". |
Organization of source values (source_type)
Below is an explanation of each possible value of the source_type field:
| Value | Description | Example |
|---|---|---|
| marketplace | Third-party e-commerce platforms where you publish your products. | Amazon Marketplace, eBay, Zalando… |
| digital-store | Sales from the retailer's own website or e-commerce app. | Direct, Organic search, Paid search, Email marketing… |
| pont-of-sale | Sales in physical stores processed through a POS system. | In-store checkout, Kiosk, Pop-up stores… |
| third-party | Sales through distributors, retailers, or partner networks (not marketplaces). | Wholesale, Distributors, Affiliates… |
| other | Special cases or channels not fitting other categories. | Telemarketing, Trade shows, Social commerce… |
This event type automatically collects the following information:
- Operating system: Android or iOS.
- App version.
- Operating system version.
- Connectif SDK version.
Example
The notification will look like this:
let productBasketItem = ProductBasketItem(
productDetailUrl: "https://example.com/product/12345",
productId: "59a31949a1a562d4979fbca2",
name: "Example Product",
unitPrice: Decimal(51.88),
description: "This is an example product",
imageUrl: "https://example.com/product/images/12345.jpg",
categories: ["Electronics", "Gadgets"],
tags: ["Trending", "New Arrival"],
brand: "ExampleBrand",
reviewCount: 150,
rating: Decimal(4.5),
ratingCount: 124,
thumbnailUrl: "https://example.com/product/thumbnails/12345.jpg",
unitPriceOriginal: Decimal(120.00),
unitPriceWithoutVAT: Decimal(80.00),
discountedAmount: Decimal(20.00),
discountedPercentage: Decimal(16.67),
publishedAt: Date(),
customField1: "Special Edition",
customField2: "Limited Stock",
customField3: "Online Only",
quantity: 1,
price: Decimal(51.88)
)
let purchase = Purchase(
purchaseId: "purchase-e3418b5a-8709-4593-a7c8-d8a7f12df737",
products: [productBasketItem],
totalQuantity: 1,
totalPrice: Decimal(51.88),
cartId: "cart-0098caf9-42f4-44e9-afdd-45eafe892293",
paymentMethod: "Credit Card",
purchaseDate: Date()
)
Connectif.sendPurchase(purchase)
Callbacks (Optional)
If you want feedback on potential errors when sending events, you can add EventCallbacks when using the method.
EventCallbacks(
onSuccess: {
// Handle success
},
onError: { error in
// Handle error
})Keep learning!
To make the most of your Connectif account, we recommend the following articles:
- Android SDK Get Started, to add the Connectif Mobile SDK to your Android project.
- Firebase Cloud Messaging Configuration, to enable push messaging via the Android Mobile SDK.
- iOS SDK Get Started, to add the Connectif Mobile SDK to your iOS project.
- Apple Push Notification Service Configuration, to enable push messaging via the iOS Mobile SDK.