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 ...

Get iOS eCommerce App Development with Parse now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.