Manual key in a Card Payment
Taking a Payment
To accept a payment, you’ll need to collect customer information and tokenize it to create an Omni PaymentMethod. You can then use this PaymentMethod with Fattmerchant’s Omni API to run the transaction.
Collect payment information
First, collect card information and populate a CreditCard object.
var card = CreditCard(personName: "Joan Parsnip",
cardNumber: "4111111111111111",
cardExp: "1229",
addressZip: "32814")Once you have a CreditCard object, create a TransactionRequest object with it and pass it to Omni’s pay method.
var transactionRequest = TransactionRequest(amount: Amount(cents: 3), card: card)
omni?.pay(transactionRequest: transactionRequest, completion: { completedTransaction ->
log("Finished transaction successfully")
}, error: { error in
log(error)
})Testing
If you’d like to try tokenization without real payment information, you can use the CreditCard.testCreditCard() method to get a test credit card.
val creditCard = CreditCard.testCreditCard()If you want to test failures, you can use the following method:
val failingCreditCard = CreditCard.failingTestCreditCard()Or you can create the CreditCard object with the following testing payment information located here: Payment Testing Cards
Use any CVV number and a post-dated expiration date for the above cards.
Updated about 2 months ago
