Manual key in a Card Payment

let card = CreditCard(personName: "Testy McTesterson",  
                      cardNumber: "4111111111111111",  
                      cardExp: "1129",  
                      addressZip: "12345")

Handling the response

The response object includes useful information about the payment. You can view the transaction status and any errors.

if let transaction = completedTransaction, transaction.status == .success {  
  print("Transaction successful!")  
} else if let error = error {  
  print("Transaction failed: \(error.localizedDescription)")  
}
{
  "status": "success",
  "transactionId": "abc123",
  "amount": 30
}

When testing, ensure your network connection is stable. An unstable connection might cause unexpected errors during transactions.

For more information on testing and payment method testing, see Testing in your Sandbox


Did this page help you?