## Order Reporting

Each time a Publisher drives a purchase, they generate a commission. This section tests to make sure Button attribution is properly tracking these orders.

## New orders

### Mobile Web Integration

**Steps**

1. Uninstall your app from your device.
2. Retrieve a test link from the Button team.
3. Alternatively, you can append a test Attribution Token to a web link like `https://www.yourbrand.com?btn_ref=fakesrctok-xxx`

> Note: the format of the test Attribution Token is: `^fakesrctok-[a-f0-9]{16}$` (e.g.`fakesrctok-abcdef0123456789`). Do not use the same value multiple times.
4. Paste the link into your native browser.
5. After landing on your mobile website, take note of the Attribution Token value in the `btn_ref` parameter on the resulting link.
   
   You can retrieve this value in the developer console via `bttnio('getReferrerToken)`
6. Make a purchase, taking note of the Order ID.
   1. This is typically sent in a confirmation email or shown on the website after the purchase is made.
7. Head to the Orders tab in the Button Dashboard.
8. Search by Order ID or Attribution Token.
9. Ensure the order payload details are correct and that the correct Attribution Token is attributed to the order.

### App (iOS + Android)

Make sure to test each of the following scenarios with the steps outlined below:

- Cold Start – an app that has been launched but is not currently running
- App Running – an app that is running in the background

> Note: this test will work on mobile devices that already have installed your test app.

You will need to construct or receive a Button Universal link for your app that includes a valid test Attribution Token.

_Example_: `https://yourbrand.bttn.io?btn_ref=fakesrctok-abcdef0123456789`

> Note: the format of the test Attribution Token is: `^fakesrctok-[a-f0-9]{16}$` (e.g.`fakesrctok-abcdef0123456789`). Do not use the same value multiple times.

**Steps**

1. On iOS, paste this link into your notes app.
   1. Tapping on the resulting hyperlink should deeplink you directly into your app.
2. On Android, paste this link into your native browser.
   1. Tapping the link should prompt you to open your app.
3. After deeplinking into your app, ensure you were routed to the proper in-app destination.
4. Go through your normal checkout flow and make a purchase.
5. Obtain the Order ID.
   1. This is typically sent in a confirmation email or shown in-app after the purchase is made.
6. Head to the Orders tab in the Button Dashboard.
7. Search for the Order ID in the search bar at the top.
8. Ensure the order payload details are correct and that the correct Attribution Token is attributed to the order.

## Order Payload Validation

Button requires the following list of fields be reported for all orders. Note: some of these fields may not yet be a technical requirement of Button’s Order API, i.e. may not be needed to receive an HTTP 200 response code.

**JSON**

```text
order_id
 total
 currency
 purchase_date
 btn_ref
 customer_order_id
 line_items[].identifier
 line_items[].total
 line_items[].quantity
 line_items[].description
 line_items[].sku
 line_items[].category
```

## Additional Testing

There are a few tests that must be completed by the Button team before launch. Please reach out to the Button team for additional test cases, requirements, and next steps.

## Getting Help

Having trouble testing your apps? Reach out to the Button team with any questions!
