Thy Street
  • Getting started
  • 🤖Devices
    • What is a device?
    • Create Device
    • Device Page
    • Webhook
      • Set Up and Edit Webhooks
      • Validate and test webhooks
      • Custom Adapter
  • Tariff Manager
    • What is a tariff card?
    • Create Tariff Card
    • Edit Tariff Card
  • Accounts
    • Account Settings
      • API Credentials
    • Payment
  • Frequently Asked Questions
    • What are FAQs?
    • Create a question
  • Examples
    • Liquid Vending Device
      • Hardware
      • Software
Powered by GitBook
On this page
  • About Device:
  • Dashboard Actions
  • Client Integration

Was this helpful?

Getting started

NextWhat is a device?

Last updated 2 years ago

Was this helpful?

The following tutorial is a hello world equivalent of using tools provided by .

About Device:

For keeping it simple, the setup that we will be using is following:

  • Hardware: ESP32 devkit v1 module.

  • Software: Arduino using platform.io

  • MQTT: Any MQTT server available public

  • Username: USER_ID

  • Password: DEVICE_PASSWORD

  • Hostname: example.hivemq.cloud

Please understand we are in no way associated with HiveMQ., and this is not any sponsored post. The decision to select HiveMQ was purely random.

Dashboard Actions

  • Login into the dashboard.

    • Currency: INR

    • Add an entry in the tariff card with the following details:

      • Name: blink

      • Title: Fresh LED blinks

      • Minimum Value: 0

      • Maximum Value: 10

      • Increment: 1

      • Price: 10

      • Tax1 rate in percentage 8

Client Integration

Add authentication.

#include "DeviceApi.h"

...

const char *apiKey = "Thy Street API Key";
const char *apiSecret = "Thy Street API secret";


Tiny::DeviceApi api;
void setup()
{
    ...
    
    api.setAuthorization(apiKey, apiSecret);
    
    ...
}

Generate new token and set device status to available

void setup()
{
...

auto tokenResponse = api.generateToken();
Serial.println(resp.obj.c_str());

Tiny::DeviceStatusDto dto;
dto.setAvailable(true);
dto.setDeviceId("device-id");
auto resp = api.setStatus(dto);
Serial.println(resp.code);
Serial.println(resp.obj.c_str());
...
}

Update your MQTT listener loop

// Mark the order status as confirmed
// Blink the LED 8 times
// Generate the token again for the next customer 
// Mark order status as completed.

Upload the code on your esp32 and start the device. Navigate to the device's page, select 3 led blinks, click on pay. Once you enter the code and make the payment, the onboard led should blink three times.

When sharing your device installation over social media, please don't forget to tag us.

This guide majorly focuses on how you can set up a simple workflow for your device using Thy Street APIs. If you are interested in how to set up your environment, please check out Platform.io

After a simple google search, we found provides a free MQTT broker in their basic plan.Set up your details and get your MQTT credentials. We will be using the following details for the rest of this tutorial:

You can download the stater code from . Starter code is in starter branch.

(it takes up to 48 business hours to create your account in the payment gateway.)

.

with below details:

Create a to convert our HTTP webhook data to MQTT Arduino data, use the MQTT credentials created above.

Get the from your account page.

Add in your platform io project.

As a last step, make the device public. (This is a paid action and will ask for a ).

Help your customers by adding , and support information for your device.

Download and print the device's QR code, install your device and enjoy your sales on the .

If you have a device idea feel free to discuss with the

official documentation.
HiveMQ
github
Enable payment
Add a new device
Create a tariff card
custom adapter
API credentials
Thy Street client SDK
subscription
FAQs
payment gateway's dashboard
community
Thy Street