Set up card payments
DOCS
Last updated: Aug 15th, 5:59am
Complete the steps to check out using credit or debit cards. Generate an approved order that is ready when finalizing the card payment. The PayPal SDK processes card payments using the 3D Secure verification flow.
Step 1: Create a payment card
Create a BTCard from the customer card information that the user entered in your app.
1func createBTCard() -> BTCard {2 // Collect Card information3 let card = BTCard()4 card.number = "4111111111111111"5 card.cvv = "123"6 card.expirationMonth = "01"7 card.expirationYear = "2021"8 return card9}
Step 2: Check out with the card
- Use the
PYPLClientto callcheckoutWithCardwith a valid PayPalorderID. - Inspect the results on the
completionofcheckoutWithCardto handle checkout errors, or to proceed on to completing the transaction.
1// Checkout with card2func tappedCard() {3 client?.checkoutWithCard(orderID: self.orderID, card: createBTCard()) { (result, error) in4 if (error != nil) {5 // handle checkout error6 return7 }89 guard let orderID = result?.orderID else { return }10 // Send orderID to your server to process the payment11 // Capture or authorize the orderID12 }13}
Note: If 3DS contingencies arise during validation, you will be notified via the BTViewControllerPresentingDelegate protocol you implemented during payment setup.