---
title: "makePayload(url:ownershipToken:)"
framework: homekit
role: symbol
role_heading: Instance Method
path: "homekit/hmaddaccessoryrequest/makepayload(url:ownershiptoken:)"
---

# makePayload(url:ownershipToken:)

Builds an accessory setup payload with the given setup payload URL and ownership token.

## Declaration

```swift
func makePayload(url setupPayloadURL: URL, ownershipToken: HMAccessoryOwnershipToken) -> HMAccessorySetupPayload?
```

## Parameters

- `setupPayloadURL`: The setup payload URL for the accessory. Provide this URL when HomeKit sends an add request to the app associated with your accessory. You determine the URL based on the category and name of your accessory, as given in the doc://com.apple.homekit/documentation/HomeKit/HMAddAccessoryRequest/accessoryCategory and doc://com.apple.homekit/documentation/HomeKit/HMAddAccessoryRequest/accessoryName properties of the associated doc://com.apple.homekit/documentation/HomeKit/HMAddAccessoryRequest instance.
- `ownershipToken`: A token proving ownership of the accessory. Your app negotiates the token with the accessory outside of HomeKit.

## Return Value

Return Value An accessory setup payload that you use to add the accessory. The method fails and returns nil if the setup payload URL is invalid.

## See Also

### Creating a Payload

- [makePayload(ownershipToken:)](homekit/hmaddaccessoryrequest/makepayload(ownershiptoken:).md)
