HomeGuidesReference
Log In

iOS

Add EBT payments to your iOS app

You can use the Forage iOS SDK to process EBT payments in your iOS app.

Two iPhone screens, one that prompts for an EBT PIN to process a payment, another that prompts for it to check a balance

Features

  • Native UI component for collecting and tokenizing a customer’s EBT Card number (also called the card PAN)
  • Native UI component for collecting a customer’s EBT PIN
  • Built-in EBT Card number validation
  • Control over the styling of a native EBT checkout experience
  • API methods that collect and tokenize an EBT Card number, perform a balance check, and capture a payment

Requirements

Before you can use the Forage iOS SDK, confirm that you’ve met all prerequisites for working with Forage, and that your app is built on the following:

  • iOS 13+
  • Swift 5

Forage iOS SDK on GitHub

For complete installation instructions and more comprehensive code examples, refer to the GitHub repository.

Starter code

After setting up your development environment and importing and initializing the SDK, include either or both of the UI components in your application’s views.

For example, the following snippet adds the EBT Card number element ForagePANTextField:

private let foragePanTextField: ForagePANTextField = {
    let tf = ForagePANTextField()

    tf.borderColor = .black
    tf.borderWidth = 3
    tf.clearButtonMode = .whileEditing
    tf.cornerRadius = 4
    tf.font = .systemFont(ofSize: 22)
    tf.placeholder = "EBT Card Number"

    return tf
}()

Then, call the relevant method. The below snippet calls the method to tokenize an EBT PAN:

// Usage

ForageSDK.shared.tokenizeEBTCard(
    foragePanTextField: foragePanTextField,
    // NOTE: The following line is for testing purposes only and should not be used in production.
    // Please replace this line with a real hashed customer ID value.
    customerID: UUID.init().uuidString,
    reusable: true
) { result in
    // Handle result and error here
}

Next steps

  • Check out the forage-ios-sdk GitHub repository for full installation instructions and a demo app