Getting Started with Paigo

This chapter describes a hands-on guide for getting started with Paigo platform. The chapter will guide through a typical case of SaaS billing setup and get ready to bill customers with a simple SaaS pricing structure. Guidance on further exploring additional features are also provided at the end of the chapter. Going through the entire onboarding process takes roughly 5 minutes 24 seconds.

Overview

Onboarding checklist can be found under Home page and navigate to Onboarding at the top right corner.

There are five major steps to get started with Paigo.

  • Set up a pricing plan

  • Add product metrics to the pricing plan (optional)

  • Create a customer and enroll in the plan

  • Meter product usage (optional)

  • Invoice the customer

Set up a pricing plan

Follow the steps in this video to quickly create a pricing plan.

Add product metrics to the pricing plan (optional)

Follow the steps in this video to quickly add product metrics into pricing plan:

Create a customer and enroll in the plan

Follow the steps in this video to quickly create a customer and enroll in the plan we just created:

Meter product usage (optional)

Paigo implements a wide range of ways to meter SaaS customer's usage of software in real-time. In this guide, we are going to use Paigo dashboard to create usage record and then use a sample script for sending mocked usage data to Paigo. In this step, we are going to send the usage of metric VM Compute Time that we created in a previous step continuously with some interval to mock the behavior of a hypothetical SaaS application.

Using Dashboard

From Paigo Dashboard, usage data can be recorded without writing code. Navigate to Customer tab and select the customer that you just created from the table. In the customer view, select the Usage Monitoring tab near the top navigation bar. Next, from the Select Dimension dropdown, choose the dimension VM Compute Time and click on the Report Usage button. In the Report Usage form, the fields of Customer ID and Dimension ID, are all prefilled. Set value for the following fields with suggested value:

Click on Add Metadata to add the key-value pair to metadata. See screenshot below for an example.

In the Preview Record Code Snippet section down below, the code to create the same usage record is provided. Click on the Copy button on the top right corner of Preview Record Code Snippet to copy the code. Click Submit button to submit the usage record.

At this point, we have already posted exactly one usage record for the service specified. Now let's explore more automated way to continuously collect usage data.

Using Script

Paigo API can be used to measure and collect usage data for SaaS application. In this guide, we are using a sample script to demonstrate how it works with Paigo's API-based Method. There are more intelligent methods of usage measurement documented in Meter Usage Data at Scale chapter. Download the below script to a local machine as ingestToPaigo.js and modify the 4 lines marked with TODO as the instruction below.

// npm i cross-fetch --save
const fetch = require("cross-fetch");

const sleep = time => new Promise(res => setTimeout(res, time, "done sleeping"));

const ingestToPaigo = async () => {
    const authResponse = await fetch('https://auth.paigo.tech/oauth/token', {
        method: 'POST',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
        },
        body: JSON.stringify({
            "audience": "https://qnonyh1pc7.execute-api.us-east-1.amazonaws.com",
            "grant_type": "client_credentials",
            "client_id": "client_id", // TODO
            "client_secret": "client_secret" // TODO
        })
    })
    const bearerToken = JSON.parse(await authResponse.text()).access_token;
    for (let i = 0; i < 120; i++) {
        await postUsageRecord(bearerToken);
        await sleep(1000);
    }
    console.log(bearerToken);
};

const postUsageRecord = async (bearerToken) => {
    const response = await fetch('https://api.prod.paigo.tech/usage', {
        method: 'POST',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'Authorization': 'Bearer ' + bearerToken,
        },
        body: JSON.stringify({
            "timestamp": new Date().toISOString(),
            "customerId": "customerId", // TODO
            "dimensionId": "dimensionId", // TODO
            "recordValue": "0.8",
            "metadata": { "Foo": "Bar" }
        })
    })
    console.log(await response.text());
};

ingestToPaigo();
  • Client ID: the client id used for auth. Can be provided on request via the Settings > API

  • Client Secret: the client secret used for auth. Can be provided on request via the Settings > API

  • Customer ID: navigate to Customer tab in Paigo dashboard and click in the table the customer profile just created in the step above. In the customer view, copy the Customer ID in the customer information widget and paste it on the line marked with customerId. It should be in the form of UUID.

  • Dimension ID: navigate to Product Metrics tab in Paigo dashboard and click in the table the dimension just created in the above step, such as VM Compute Time. In the dimension view, copy the Dimension ID and paste it on the line marked with dimensionId. It should be in the form of UUID.

Save the script and run locally with the following command:

node ingestToPaigo.js

This script first authenticates with Paigo API, then sends a number that mimics the amount of data processed every 1 second to Paigo server. The script will stop by itself after 120 seconds.

Now we have some usage data collected, we are going to see how Paigo can leverage them for billing.

Invoice the customer

Follow the steps in this video to invoice the customer:

Congratulations! When you finish this list, you have finished the basic steps to get started with Paigo. There are a lot more exciting features available on the platform. Again, Paigo is free to use. Just go ahead to explore how they can help your daily work. The last section in this chapter provides some pointer for next reading material.

Next Steps

  • To explore Paigo's different ways of metering usage of SaaS applications, read Meter Usage Data at Scale chapter for full documentation.

  • To explore more ways of modeling pricing in Paigo, read Product Plans chapter for full documentation.

  • To understand the key concepts in Paigo and how they work together, read Key Conceptspage for more details.

  • To dive deep into how invoicing and payment works, read Issue Invoicefor full documentation.

Last updated