Chapter 12
Pay with Credit Card
In the previous chapter, I talked about capturing a user’s shipping address before checking out. In this chapter, I cover how a user can pay with a credit card. For this app, you will use the Stripe iOS SDK to make the process easier. To incorporate the Stripe iOS SDK, you need to update your Cocoapods Podfile by adding these two lines:
pod 'Stripe'pod 'Stripe/ApplePay'
Then run “Pod update.”
Payment Model
You need a new PFObject model for a user’s credit card. Instead of naming it EMABCreditCard, name it EMABPaymentMethod because you might incorporate other payment methods such as PayPal in the future. Remember to register an NSString constant on the EMABConstants class and to register the model in the AppDelegate ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access