Stripe ios what is the different between paymentContext and paymentMethodViewController

Multi tool use
Stripe ios what is the different between paymentContext and paymentMethodViewController
I am not working on an iOS app that uses stripe. I want to simply create a view controller that can collects user card information and saved to users customer id which I created when they register account for my app. But I want to know should I use paymentMethodViewController
or STPPaymentContext
to create the standard UI made by Stripe. On Stripe website, they have a demo iOS app called RocketRide, I downloaded the app and read through each line. This app only uses STPPaymentContext
but it has all the UI including selectPaymentMethod
and add the card. So can anyone tell me which one should I use and how to use them specifically, thank you!
You can see RocketRide's UI at the top of this link
paymentMethodViewController
STPPaymentContext
STPPaymentContext
selectPaymentMethod
1 Answer
1
STPPaymentContext
is an end-to-end class that handles the full checkout process, by collecting the user's payment, shipping and billing details. It does this by combining together several other components from the Stripe SDK, including STPPaymentMethodsViewController
, which handles only presenting a set of payment methods to the user and adding more.
STPPaymentContext
STPPaymentMethodsViewController
Basically the difference is that STPPaymentContext
is a full checkout flow integration, while STPPaymentMethodsViewController
is a component that is used in part of that flow. It is possible to build your own flow by combining the SDK elements yourself, and in that case you would directly use STPPaymentMethodsViewController
. For your use case though, it sounds like STPPaymentContext
is the better option, it is easier to use in general.
STPPaymentContext
STPPaymentMethodsViewController
STPPaymentMethodsViewController
STPPaymentContext
[0] - https://stripe.github.io/stripe-ios/docs/Classes/STPPaymentContext.html
[1] - https://stripe.github.io/stripe-ios/docs/Classes/STPPaymentMethodsViewController.html
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.