Reporting Transactions
The SDK can report various types of transactions to the server. For any product sold, we can create a product, set transaction type, and provide additional attributes.
You must have to provide a valid id to post a transaction. Please make sure you first call PJDSDK.setCurrentUser(pjdSDKUser ,this) before reporting transaction data.
An entire list of transaction types is provided in Appendix B
Report Product Purchases
val transaction = PJDTransactions()val productsList = ArrayList<Product>()val product = Product()product.currencyCode = "USD"product.description = "description"product.name = "Product Name"productsList.add(product)transaction.products = productsListtransaction.orderId = "100"transaction.subtotal=80.0transaction.tax=10.0transaction.total= 90.0PJDSDK.reportEvent(Context, TransactionType.OTT_SUBSCRIPTION, transaction)
The attributes that are available to be populated for a transaction event are listed below.
Syntax | Description |
---|---|
Product | - |
name | String |
description | String |
sku | String |
quantity | Integer |
total | Double |
tax | Double |
price | Double |
meta | HashMap<String,String> key/value pair |
vendor | String |
currencyCode | String |
Transaction | - |
type | String (ticketing, merch, food and bev, subscription, etc) for event types refer Appendix B |
tax | Double (any tax assessed on the transaction) |
total | Double (the total monetary amount of the transaction) |
orderId | String (Order ID from source system) |
products | List of Product objects |
meta | Hashmap<String,String> |
transactedAt | String (yyyy-mm-dd H:i:s) |
subtotal | Double |
Mandatory properties: From v1.7 BasicPermissions is a mandatory property.
Syntax | Description |
---|---|
BasicPermissions | - |
cookies | Cookies |
Note: From v1.7 The PJDSDKModel.Transaction class also requires PJDSDKModel.BasicPermissions as mandatory class property at the time of its init, in order to work, See section (#2-initialization) for how to create “permissions”