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 information
    3 let card = BTCard()
    4 card.number = "4111111111111111"
    5 card.cvv = "123"
    6 card.expirationMonth = "01"
    7 card.expirationYear = "2021"
    8 return card
    9}

    Step 2: Check out with the card

    1. Use the PYPLClient to call checkoutWithCard with a valid PayPal orderID.
    2. Inspect the results on the completion of checkoutWithCard to handle checkout errors, or to proceed on to completing the transaction.
      1// Checkout with card
      2func tappedCard() {
      3 client?.checkoutWithCard(orderID: self.orderID, card: createBTCard()) { (result, error) in
      4 if (error != nil) {
      5 // handle checkout error
      6 return
      7 }
      8
      9 guard let orderID = result?.orderID else { return }
      10 // Send orderID to your server to process the payment
      11 // Capture or authorize the orderID
      12 }
      13}

      Next step

      Process the order