No momento, esta página não está disponível em português
Point-of-sale icon

Register a device

Steps

  1. Obtain an ADYDevice object through the ADYDeviceRegistry, available as a property of the Adyen class. ADYDevice is a representation of a terminal connected by Bluetooth, Lightning port or Ethernet. It is possible that multiple devices are connected at the same time, and a device may become connected or disconnected at any time.

    1. If you know the name of the device (because you stored in the NSUserDefaults, for instance) call [ADYDeviceRegistry findDeviceByName:].
      This returns an ADYDevice, even if a device with the given name is not currently connected. You can then start observing its status property to see if it is connected, and, if not, to be notified when it becomes connected. If it is connected, it is a good idea to keep observing its status since the device might disconnect at any time.

      When a device disconnects, the ADYDevice instance remains valid. The status property changes to ADYDeviceStatusGone, but when the device becomes connected again at some later point, its status will change back to ADYDeviceStatusInitializing, and then to ADYDeviceStatusInitialized.

    2. If you don't know the name of the device in advance, you can get access to all currently connected devices using the devices property of the ADYDeviceRegistry. This is an NSMutableArray that is updated each time a device is connected or disconnected.

    3. For networked devices, you must add the device to the ADYDeviceRegistry. Use addDeviceWithHostname: and removeDeviceWithHostname: to add Ethernet payment devices to the devices list.
      The registry attempts to connect to the device until it is online. Ethernet devices and Lightning devices go through the same states as Bluetooth devices. The main difference is that an Ethernet device attempts to connect to the device until it is online and is always in the devices array, even if it is not connected.

  2. Your app should either choose a device programmatically from the devices array (such as always using the first available device), or present a list of devices to the user allowing them to pick one.

    The contents of the devices array can change at any time when devices connect or disconnect. Either make a copy of the array before using it, or use key-value observing on the array to notify the app when devices connect or disconnect and present live information about connected devices.