I simply want to show a user's default Stripe payment method within an iOS app.
I’m trying to push an STPPaymentMethodsViewController onto a viewController. Stripe explicitly states that I have to create an STPCustomerContext. Do I have to create an STPPaymentContext as well? I don't want to create an STPPaymentContext because it requires 4 methods that I won't use in this part of my app... Here is what I have, but no dice.
Also, Stripe's docs instruct you to create a customerContext, but don't say how that is passed to the STPPaymentMethodsViewController. What am I missing?
https://stripe.com/docs/mobile/ios/custom
//AppDelegate.swift
var customerContext: STPCustomerContext?
func setupStripe() {
self.customerContext = STPCustomerContext(keyProvider: MyAPIClient.sharedClient)
}
From the user's settingsVC I'm trying to do the following:
func paymentMethodsButtonTapped() {
let paymentMethodsViewController = STPPaymentMethodsViewController()
paymentMethodsViewController.delegate = self // ERROR HERE: Cannot assign to property: 'delegate' is get only
let navigationController = UINavigationController(rootViewController: paymentMethodsViewController)
self.present(navigationController, animated: true, completion: nil)
}