Skip to main content
Version: Lab (preview)

Pay Theory Cash UI Fields

This documentation covers the SwiftUI views provided by the Pay Theory SDK for capturing cash payment information. These views are designed to be used within a PTForm and require a PayTheory object to be provided as an environment object.

Common Requirements​

All of these views:

  • Must be used within a PTForm view hierarchy
  • Require a PayTheory object to be provided as an environment object
  • Automatically handle data binding and validation with the Pay Theory SDK

Required Fields​

The following fields are required to capture cash payment information needed for processing payments:

  • PTCashName
  • PTCashContact

PTCashName​

A SwiftUI view that provides a text field for capturing the name of the person making the cash payment.

Usage​

PTCashName(placeholder: "Full Name")

Properties​

PropertyTypeDefaultDescription
placeholderString"Full Name"The placeholder text displayed when the field is empty

PTCashContact​

A SwiftUI view that provides a text field for capturing the contact information (phone or email) of the person making the cash payment.

Usage​

PTCashContact(placeholder: "Phone or Email")

Properties​

PropertyTypeDefaultDescription
placeholderString"Phone or Email"The placeholder text displayed when the field is empty

Example Usage​

Here's an example of how to use these fields together within a PTForm:

struct CashPaymentView: View {
@EnvironmentObject var payTheory: PayTheory

var body: some View {
PTForm {
VStack(spacing: 20) {
PTCashName()
PTCashContact()
// Add other UI elements as needed, such as amount display or submit button
}
}
.environmentObject(payTheory)
}
}

This example creates a cash payment form using the available cash UI fields. Remember to provide the PayTheory object as an environment object to the PTForm for proper functionality.