ioscredit-card

Need Stripe API for iOS for passing credit card detail


I have to pass user's credit card number its expiry date and its secret number in stripe API. Have any one has demo of stripe API for iOS?


Solution

  • You can get official iOS Stripe api details from here.

    Stripe iOS Bindings

    The Stripe iOS bindings can be used to generate tokens in your iOS application. If you are building an iOS application that charges a credit card, you should use these bindings to make sure you don't pass credit card information to your server (and, so, are PCI compliant).

    Installation

    You can install the Stripe iOS bindings in two ways.

    Install with CocoaPods

    CocoaPods is a library dependency management tool for Objective-C. To use the Stripe iOS bindings with CocoaPods, simply add the following to your Podfile and run pod install:

    pod Stripe, :git => 'https://github.com/stripe/stripe-ios.git'

    Install by adding files to project

    1. Clone this repository
    2. In the menubar, click on 'File' then 'Add files to "Project"...'
    3. Select the 'Stripe' directory in your cloned stripe-ios repository
    4. Make sure "Copy items into destination group's folder (if needed)" is checked"
    5. Click "Add"

    Guide

    There are three main classes in the Stripe iOS bindings that you should care about. STPCard is a representation of a credit card. You will need to create and populate this object with the credit card details a customer enters. STPToken is a representation of the token Stripe returns for a credit card. You can't construct these yourself, but will need to create them (shown below). Stripe is a static class that you use to interact with the Stripe REST API.

    Also, there are a lot of comments in the code itself. Look through the .h files for a more thorough understanding of this library.