> For the complete documentation index, see [llms.txt](https://developers.spiffy.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.spiffy.co/spiffyjs/events.md).

# Events

These global-only events can only be used on the global `spiffy` object using [event methods](/spiffyjs/methods.md#add-remove-event-listeners). In addition to these, any sub-object events can be used globally as well.

## Global Events

### ready

General event that fires once Spiffy.js has successfully loaded and is ready. As a rule of thumb, any code that uses any methods or objects that belong to Spiffy.js should wait until `ready` to fire

```javascript
spiffy.on('ready', function () {
			// safely do things here...
})
```

## Checkout Events

All checkout events can also be used globally

### iframe:ready

When an iframe url has been generated with all the necessary element and config data

* `data` - Object
  * `uid` - uid of the iframe container

### form:ready

When the checkout or portal components have mounted in the iframe

* `data` - Object
  * `uid` - uid of the iframe container
  * `modality` - the modality of the iframe, either `inline` or `popup`

### items:changed

When the items of a checkout/order change

* `data` - Object
  * `uid` - uid of the iframe container

### coupons:changed

When a user adds or removes a coupon

* `data` - Object
  * `uid` - uid of the iframe container
  * `code` - coupon code used

### payplan:changed

When the selected payment plan on a checkout changes

* `data` - Object
  * `uid` - uid of the iframe container
  * `payplan` - Object

### upsell:show

When changing from a checkout to an upsell or from one upsell to another

* `data` - Object
  * `uid` - uid of the iframe container
  * `slug` - checkout slug

### order:error

When an attempt to process an order fails

* `data` - Object
  * `uid` - uid of the iframe container

### order:success

When changing from a checkout or upsell to a thank you page

* `data` - Object
  * `uid` - uid of the iframe container
  * `slug` - checkout slug
  * `forward` - the forwarding url set for the thank you page otherwise `undefined`
