Table of Contents
When developing a product or service that involves payment processing, it’s important to be able to track payment events in real-time to identify and resolve issues as soon as possible. Delayed payments, fraudulent activities, and other payment-related issues can negatively impact the business.
LogHive offers an efficient way to track payment events such as user subscription, purchase, cancellation, and redemption directly from your C application. This allows you to stay informed of payment activities and detect any potential problems early on, providing a better experience for your customers.
By using LogHive, you can ensure the smooth operation of your payment processing system and maintain the trust of your customers. Its event tracking capabilities help you gain valuable insights into your payment process and enable you to make data-driven decisions to improve your business performance.
How it works in C
LogHive provides a simple REST API that you can use to push events and errors to the LogHive service. You can organize your events into projects and groups to keep them organized and easily searchable. Once an event is pushed to LogHive, it is processed and can be viewed in the event stream or dashboard.
With just a few lines of C-code, you can start pushing events to LogHive and receiving push notifications for your application’s events and errors.
#include <stdio.h>
#include <curl/curl.h>
#include <string.h>
#include <stdlib.h>
int main(void)
{
CURL *curl;
CURLcode res;
char *data = "{\"project\":\"MySaas\",\"group\":\"Payments\",\"event\":\"Payment received\",\"description\":\"YourDescription\",\"notify\":true}";
char *url = "https://api.loghive.app/v1/event/add";
char *content_type = "Content-Type: application/json";
char *authorization = "ApiKey: your-api-key";
struct curl_slist *header_list = NULL;
header_list = curl_slist_append(header_list, content_type);
header_list = curl_slist_append(header_list, authorization);
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, header_list);
res = curl_easy_perform(curl);
if (res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
curl_easy_cleanup(curl);
curl_slist_free_all(header_list);
}
return 0;
}
If an error occurs while creating an event, you will receive an Error object in return.
{'StatusCode': 400, 'Message': 'missing group name'}
You can receive your API-Key here: API-Key.
Receive Push Notifications
To receive push notifications, you simply need to install the LogHive Android app (Playstore) or use LogHive through the web application and allow notifications.
Add an element to your project dashboard
In addition to push notifications, LogHive allows you to display captured events in a dashboard with various elements. With just a few clicks, you can display the events already pushed in the dashboard.
Ensure seamless payment experiences for your C application with LogHive. Track user subscriptions, purchases, cancellations, and redemptions in real-time with ease. Avoid delayed payments, fraud, and other issues with LogHive’s simple event tracking tool.