Skip to navigation

Track a sale

View as Markdown

Called by your server for every payment of a customer you reported as a lead. amount and taxAmount are in the currency’s minor unit (cents for USD, yen for JPY; a multiple of 10 for three-decimal currencies such as KWD). Each invoiceId is one sale: reporting it again with the same values changes nothing and answers 200; a paidAt or eventName the retry leaves out is not compared, and one it sends that differs is refused as other values (409 invoice_id_reused), so a corrected date is never silently dropped. The first sale enrolls the lead at your commission rate; each sale inside the earning window earns on the amount less tax, maturing your payout delay after paidAt. When you import past invoices, send them oldest first: an earlier sale sent later moves the window’s start back to it only while none of the lead’s commissions is paid or on a payout, and the result matches an oldest-first import, so sales that fall after the moved window earn nothing and earlier sales it now covers earn; once one is paid or on a payout, the earlier sale is recorded and earns nothing. Pass the clickId from the customer’s pp_click cookie whenever you have it: a sale with a clickId for a customer we do not know yet creates the lead, and the lead’s own click confirms a lead the pasted script reported. Anyone can report a lead from the browser, so while no call of your server has named its click, the earnings of a lead only the script reported stay on hold until you release them, even once you approve the lead. A customer whose payments Stripe reports is refused. Every call is real: try it on a test directory.

curl -X POST https://v1.api.partnerpage.io/api/deal-registration/private/v1alpha/tracking/sale/ \
-H "Authorization: Token $PARTNERPAGE_API_KEY" -H "Content-Type: application/json" \
-d '{"trackingId":"pp_trk_…","clickId":"<pp_click cookie>","customerId":"user_123","amount":5000,"currency":"usd","invoiceId":"inv_123","eventName":"Invoice paid"}'

Authentication

AuthorizationToken

Your API key, sent as Authorization: Token <your API key>

Request

This endpoint expects an object.
trackingIdstringRequiredformat: "^pp_trk_[A-Za-z0-9]{24}$"1-40 characters

The directory’s Tracking ID, from Settings › Partner links (pp_trk_…).

customerIdstringRequired1-255 characters
Your own ID for the customer, as in the lead call.
amountlongRequired1-1000000000000000

What the customer paid, tax included, in the currency’s minor unit (cents for USD).

currencystringRequired1-3 characters

The three-letter ISO 4217 code, for example USD.

invoiceIdstringRequired1-255 characters

Your own ID for the invoice; one sale per invoice ID.

taxAmountlongOptional0-1000000000000000Defaults to 0
The tax part of the amount, in the same unit.
paidAtdatetime or nullOptional

When the customer paid; now when left out. Send past invoices oldest first: the first sale reported starts the earning window. An earlier sale sent later moves the start back to it while none of the lead’s commissions is paid or on a payout, and the result matches an oldest-first import: sales after the moved window earn nothing. A move that would void commissions already earned is refused (409 paid_at_voids_earnings) unless voidLaterEarnings is true. After that it is recorded and earns nothing.

voidLaterEarningsbooleanOptionalDefaults to false
Set true to let an earlier paidAt move the earning window back even though it voids the commissions of later sales now outside it. Without it such a sale is refused and nothing is recorded.
eventNamestringOptional<=255 charactersDefaults to
Your own name for the event, for example Sign up.
clickIdstring or nullOptionalformat: "uuid"

The click ID from the customer’s pp_click cookie. Send it whenever you have it: a customer PartnerPage does not know yet needs it, and it confirms a lead the pasted script reported. Without it, what the sales of a lead only the script reported earn stays on hold until you release it.

Response

This invoice was already reported with these values (a paidAt or eventName left out is not compared)

idstringformat: "uuid"
leadIdstringformat: "uuid"
invoiceIdstring
amountinteger
currencystring
taxAmountinteger
commissionobject or null

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error