<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "HomeKit",
  "identifier" : "/documentation/HomeKit/HMAddAccessoryRequest/makePayload(url:ownershipToken:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "HomeKit"
    ],
    "preciseIdentifier" : "c:objc(cs)HMAddAccessoryRequest(im)payloadWithURL:ownershipToken:"
  },
  "title" : "makePayload(url:ownershipToken:)"
}
-->

# makePayload(url:ownershipToken:)

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

```
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 [`accessoryCategory`](/documentation/HomeKit/HMAddAccessoryRequest/accessoryCategory) and [`accessoryName`](/documentation/HomeKit/HMAddAccessoryRequest/accessoryName) properties of the associated [`HMAddAccessoryRequest`](/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

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

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)