POST
/
track
/
sale
JavaScript
import Codeqr from '@codeqr/ts';

const client = new Codeqr({
  apiKey: 'My API Key',
});

const response = await client.track.trackSale({ amount: 1, customerId: 'x', paymentProcessor: 'stripe' });

console.log(response.amount);
{
  "eventName": "<string>",
  "customerId": "<string>",
  "amount": 123,
  "paymentProcessor": "<string>",
  "invoiceId": "<string>",
  "currency": "<string>",
  "metadata": {}
}
Conversions endpoints require a Business plan subscription or higher.

Authorizations

Authorization
string
header
required

Default authentication mechanism

Body

application/json
customerId
string
required

This is the unique identifier for the customer in the client's app. This is used to track the customer's journey.

Required string length: 1 - 100
amount
integer
required

The amount of the sale. Should be passed in cents.

Required range: x > 0
paymentProcessor
enum<string>
required

The payment processor via which the sale was made.

Available options:
stripe,
shopify,
paddle
eventName
string
default:Purchase

The name of the sale event. It can be used to track different types of event for example 'Purchase', 'Upgrade', 'Payment', etc.

Maximum length: 50
Example:

"Purchase"

invoiceId
string | null

The invoice ID of the sale.

currency
string
default:usd

The currency of the sale. Accepts ISO 4217 currency codes.

metadata
object | null

Additional metadata to be stored with the sale event.

Response

A sale was tracked.

eventName
string
required
customerId
string
required
amount
number
required
paymentProcessor
string
required
invoiceId
string | null
required
currency
string
required
metadata
object | null
required