Stripe | Financial Infrastructure to Grow Your Revenue

Stripe | Financial Infrastructure to Grow Your Revenue

5282 articles

Collect swiped data


Private preview

Collect swiped data Private preview

Use Terminal for collecting non-PCI data with the reader hardware interfaces.

Private preview

Request access to the Collect data private preview by sending an email to with the following information:

  • Use case
  • Terminal device and integration type
  • Magstripe data format
  • Provider, if using a third-party card provider

Use the Terminal SDK and the reader’s hardware interfaces (such as the magnetic stripe reader) to read non-PCI payment methods such as gift cards. This feature isn’t available offline.

After swiping the card, Stripe provides a tokenised data object. Use the token to securely retrieve the cleartext track data on your back end.

The Terminal reader only reads and stores cleartext magstripe data that follows these formats:

  • The card data is available on track 2 only.
  • The card data uses only the ISO/IEC-7813 track 2 start sentinel ; and end sentinel ? , without the separator character.
  • The card data consists of only numeric digits.

Contact the Terminal team with your card format and BIN ranges if your card numbers don’t match one of these approved formats.

Collecting swiped data is available on:

  • Stripe Reader the related setting/the related setting , the related setting WisePOS E , Stripe M2 , and the related setting Chipper2X BT

Collect data

Use Terminal.collectData() to prompt your point-of-sale application to collect data. Specify the type of data you want to receive in the configuration passed to the function, such as .magstripe. After a customer swipes a card, the SDK returns a token that represents the data or an error if the swipe fails. Use this token in your integration to refer to the data.

Note

On supported readers, the ability for customers to cancel transactions is now enabled by default. To disable customer cancellation on smart readers, set customerCancellation to .disableIfAvailable.

PaymentViewController.swift

Select a language

Swift

Objective-C

No results

import UIKit
import StripeTerminal

class PaymentViewController: UIViewController {
 func readGiftCard() throws {
 let config = try CollectDataConfigurationBuilder()
 .setCollectDataType(.magstripe)
 .build()
 self.cancelable = Terminal.shared.collectData(config) { collectedData, collectError in
 if let error = collectError {
 // Handle read errors
 print("Collect data failed: \(error)")
 } else if let data = collectedData, let stripeId = data.stripeId {
 print("Received collected data token: \(stripeId)")
 }
 }
 }
}

Fetch collected data

When you need to perform operations such as redeeming a gift card, fetch the cleartext data from your back end using the collected data token. The collected data is stored on Stripe’s servers for 24 hours.

Command Line

cURL

Note

Stripe doesn’t perform and isn’t responsible for the authentication of collected data or the authorisation of transactions using collected data. Stripe isn’t liable for any illegal conduct or fraud by any third party associated with the collected data.

Last verified 2026-09-25

Is this helpful?