# Purchases

> Record a purchase or a refund from the app, in minor units of its currency.

URL: https://docs.xulo.io/ios/purchases
iOS SDK version: 0.1.4

## Record a purchase

```swift
await Xulo.purchase(amount: 1500, currency: "USD", orderId: "ORDER_ID")
```

| Argument | Notes |
| --- | --- |
| `amount` | Minor units of the currency. `1500` with `USD` is $15.00. |
| `currency` | A three-letter code. Stored in upper case. |
| `orderId` | Your order id. Optional. |

## Refunds

Sending the same order id again replaces that order. A refund is the same order id with the amount that remains.

```swift
await Xulo.purchase(amount: 500, currency: "USD", orderId: "ORDER_ID")
```

## Who it belongs to

If the install is logged in with an External ID, the purchase belongs to that person, and purchases from all of their phones add up. Otherwise it stays on the install.

The person page in the dashboard shows the lifetime total in each currency, and the orders. Saved segments can filter on spend. See [Purchases and sessions](https://docs.xulo.io/concepts/purchases-and-sessions).

A purchase is not a separate charge on your bill.
