Skip to main content
Version: Lab (preview)

PayTheory Configuration

The PayTheoryConfiguration class handles all configuration settings for payment processing and tokenization.

Initialization​

The PayTheoryConfiguration requires two parameters when initializing:

val config = PayTheoryConfiguration(
payTheoryButton: PayTheoryButton, // Button that triggers payment/tokenization
apiKey: String // Your Pay Theory API key
)

Configurable Properties​

After initialization, you can configure the following properties:

PropertyTypeDefaultDescription
amountInt0Transaction amount in cents (e.g., 1000 = $10.00)
paymentMethodTypePaymentMethodTypeCARDType of payment method to accept
requireAccountNameBooleanfalseWhether to require account name input
requireBillingAddressBooleanfalseWhether to require billing address
feeModeStringMERCHANT_FEEWho pays the service fee
metadataMap<String, Any>emptyAdditional transaction data
payorInfoPayorInfonullInformation about the person paying
payorIdStringnullExisting payor ID to use
skipTokenizeValidationBooleanFalseSkip payment method validation. Should only be used if you intend to immediately use the tokenized payment method
accountCodeStringnullAccount code for transaction
referenceStringnullReference for transaction
paymentParametersStringnullAdditional payment parameters
invoiceIdStringnullInvoice ID for transaction
sendReceiptBooleanfalseWhether to send receipt email
receiptDescriptionString"Payment Confirmation"Description for receipt
serviceFeeInt0Service fee in cents

Example Usage​

val config = PayTheoryConfiguration(
payTheoryButton = submitButton,
apiKey = "your-api-key"
).apply {
// Required for payments
amount = 1000 // $10.00
paymentMethodType = PaymentMethodType.CARD

// Optional settings
requireBillingAddress = true
feeMode = FeeMode.SERVICE_FEE
metadata = hashMapOf(
"orderId" to "12345",
"customerName" to "John Doe"
)
payorInfo = PayorInfo(
first_name = "John",
last_name = "Doe",
email = "john@example.com"
)
sendReceipt = true
receiptDescription = "School Payment"
}

Usage Notes​

  • The payTheoryButton and apiKey are required during initialization
  • amount is required for payments but should not be set for tokenization
  • paymentMethodType determines which payment fields are displayed
  • metadata can contain any key-value pairs for transaction tracking
  • payorInfo is recommended for receipt delivery and payment tracking
  • feeMode determines who pays the processing fee (merchant or customer)
  • sendReceipt requires valid email in payorInfo
  • skipTokenizeValidation should be used with caution
  • serviceFee is automatically calculated based on amount and fee mode