Skip to content

Test events and payments ​

Choose between custom event and payment tracking, then verify each event end to end.

Use this guide after SDK Integration Testing. It helps you decide whether an action is a custom event or a payment, then confirms that Linkrunner records it correctly.

Choose the right method ​

What happenedApp SDKServer-side API
A user action with no authoritative transactiontrackEventPOST /capture-event
A payment with an amount and unique transaction IDtrackEvent with amount, paymentId, currency, and userId in the event dataPOST /capture-event with amount, payment_id, and currency

When you attach a payment, the event name becomes the payment type in reports. See Payment fields for the rules. For SDK examples, payment status, and how payments reach ad networks, see Track payments.

The event name alone is not enough. If purchase_completed represents a real transaction, send it as a payment. If it only represents a funnel step with no authoritative transaction, send it as a custom event.

Do not send the same transaction as both a revenue-bearing custom event and a payment. This can duplicate revenue in downstream ad networks.

Usually send as a custom event ​

  • Product view, search, add to cart, and checkout started
  • Content view, level completion, and referral
  • Purchase initiated when it only marks the start of checkout
  • Payment failure shown for product analytics when you do not need a payment record

Usually send as a payment ​

  • Completed purchase
  • First or second payment
  • One-time or recurring payment
  • Subscription creation or renewal with a charge
  • Wallet top-up or funds withdrawal
  • A failed or cancelled transaction when you need it recorded with PAYMENT_FAILED or PAYMENT_CANCELLED

If you record a failed or cancelled payment, send its final state once. Linkrunner deduplicates payments by the combination of event name, payment_id, and status, so a later call with the same combination is ignored.

Before you test ​

  • Complete the click → install → signup flow so the test user is attributed.
  • Use the same user_id that your app registered through signup.
  • Generate a fresh payment_id for each real transaction.
  • Send amount as a number, with its 3-letter ISO 4217 currency, such as USD.
  • Pick one source for each payment, either the app SDK or your backend.
  • For server-side tests, generate a server key from Settings → Data APIs.

Test flow ​

Create traceable test values

Use values that you can find in the Events Log:

text
user_id: your attributed test user
event_name: purchase_completed
payment_id: lr_test_payment_001
amount: a small test amount
currency: USD

Use a new payment_id every time you test a new transaction.

Send a custom event control

Send a non-payment action such as checkout_started through your SDK's trackEvent method or the Event Capture API.

bash
curl -X POST https://api.linkrunner.io/api/v1/capture-event \
  -H "Content-Type: application/json" \
  -H "linkrunner-key: YOUR-SERVER-KEY" \
  -d '{
    "event_name": "checkout_started",
    "event_data": { "test_run": "lr_payment_flow_001" },
    "user_id": "YOUR_ATTRIBUTED_USER_ID",
    "event_id": "lr_test_event_001"
  }'

A successful API request returns a captured-event response.

Send a completed payment

Send the actual transaction through your SDK's trackEvent method with a payment, or the Revenue Tracking API. Leaving out status records the payment as PAYMENT_COMPLETED.

bash
curl -X POST https://api.linkrunner.io/api/v1/capture-event \
  -H "Content-Type: application/json" \
  -H "linkrunner-key: YOUR-SERVER-KEY" \
  -d '{
    "event_name": "purchase_completed",
    "user_id": "YOUR_ATTRIBUTED_USER_ID",
    "payment_id": "lr_test_payment_001",
    "amount": 1,
    "currency": "USD"
  }'

A successful API request returns HTTP 200 with Event capture request received!. If a payment shows up as a custom event, one of the three payment fields is missing.

Verify both records in Linkrunner

Open Events → Events Log, then filter by your test user or event name.

  • checkout_started appears as a custom event.
  • The transaction appears as a payment event.
  • The payment row contains the expected Amount, Payment ID, and Payment Status.
Expanded Events Log row showing event details and payment fields

Verify payment deduplication

Send the same payment again with the same event name, payment_id, and status.

Expected result: the Events Log still contains one payment for that combination. Linkrunner records the first request and ignores later duplicates.

Verify a new transaction

Send another completed payment with a new payment_id, such as lr_test_payment_002.

Expected result: the Events Log contains a second payment. If it does not, confirm that the new transaction did not reuse the previous payment_id.

Expected classification ​

Example actionSend asKey fields
item_viewedCustom eventevent_name, user_id
add_to_cartCustom eventevent_name, user_id, product data
checkout_startedCustom eventevent_name, user_id
purchase_initiated as a funnel stepCustom eventevent_name, user_id
Completed purchasePaymentevent_name, user_id, payment_id, amount, currency
Subscription renewal with a chargePaymentevent_name: SUBSCRIPTION_RENEWED
Wallet top-upPaymentevent_name: WALLET_TOPUP
Failed payment that must be recordedPaymentstatus: PAYMENT_FAILED
Cancelled payment that must be recordedPaymentstatus: PAYMENT_CANCELLED

Test Meta Purchase forwarding ​

Use this section only when the payment must reach Meta Commerce Manager.

  1. In Linkrunner, map the payment event name you send, such as purchase_completed, to Meta's standard Purchase event.
  2. Include the required event_data fields for Purchase, including product IDs, contents, content_type, value, currency, num_items, and order_id.
  3. Send a new payment with a new payment_id.
  4. Check Meta Commerce Manager → Events. The real-time hit should appear within about 15 minutes. Full reporting can take a few days.
Linkrunner Meta event mapping screen

See Meta Commerce Manager for the full ecommerce payload.

Troubleshooting ​

Nothing appears in the Events Log

Confirm the device completed the attribution test flow and that the event uses the same user_id registered through signup.

The purchase appears as a custom event

The app or backend sent it without all three payment fields. From the SDK, put amount, paymentId, and currency in the event data. From your backend, send amount, payment_id, and currency at the top level of the request. An amount without the other two is a custom event property.

A new payment is missing

Check whether it reused the same event name, payment_id, and status as an earlier transaction. Linkrunner treats that combination as a duplicate.

The same payment appears more than once

Confirm the app and backend are not both sending the transaction with different payment IDs. Choose one source, or use the same stable payment ID for safe retries.

The payment shows more than one status

status is part of the deduplication key, so sending PAYMENT_INITIATED and then PAYMENT_COMPLETED with the same payment_id creates two records. This is expected when you track the payment lifecycle. Only the PAYMENT_COMPLETED record counts as revenue and is sent to ad networks. If you do not need the lifecycle, send only the final state. See Payment status.

Meta does not show the Purchase event

Confirm the payment event name is mapped to Purchase, the payment status is PAYMENT_COMPLETED, the ecommerce payload includes every required field, and the test has had at least 15 minutes to reach Meta Events Manager.

Need help? Contact support@linkrunner.io