     }
 
     override var intrinsicContentSize: CGSize {
-        return CGSize(width: UIView.noIntrinsicMetric, height: cellSize.height)
-    }
-}
-
-// MARK: - UICollectionViewDataSource, UICollectionViewDelegate
-
-extension PaymentMethodTypeCollectionView: UICollectionViewDataSource, UICollectionViewDelegate {
+        return CGSize(width: UIView.noIntrinsicMetric, height: cellHeight)
+    }
+}
+
+// MARK: - UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout
+
+extension PaymentMethodTypeCollectionView: UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
     func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int)
         -> Int
     {

        layout.sectionInset = UIEdgeInsets(
            top: 0, left: PaymentSheetUI.defaultPadding, bottom: 0,
            right: PaymentSheetUI.defaultPadding)
        layout.itemSize = cellSize
        layout.minimumInteritemSpacing = 12
        super.init(frame: .zero, collectionViewLayout: layout)
        self.dataSource = self
        self.delegate = self

}

// MARK: - Constants
private let paymentMethodLogoSize: CGSize = CGSize(width: UIView.noIntrinsicMetric, height: 12)
private let cellHeight: CGFloat = 52
private let minInteritemSpacing: CGFloat = 12

/// A carousel of Payment Method types e.g. [Card, Alipay, SEPA Debit]
class PaymentMethodTypeCollectionView: UICollectionView {
