Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var bankAccountParams = STPBankAccountParams()
- bankAccountParams.accountHolderName = "Jenny Rosen"
- bankAccountParams.country = "US"
- bankAccountParams.routingNumber = "110000000"
- bankAccountParams.accountNumber = "00044"
- print("Bank account parameters: ")
- print(bankAccountParams)
- STPAPIClient.shared.createToken(withBankAccount: bankAccountParams) { token, error in
- if let error = error {
- print(error)
- if let detailedError = error as? NSError {
- print("error_code: " + (detailedError.userInfo["com.stripe.lib:StripeErrorCodeKey"] as! String))
- print("error_type: " + (detailedError.userInfo["com.stripe.lib:StripeErrorTypeKey"] as! String))
- print("error parameter: " + (detailedError.userInfo["com.stripe.lib:ErrorParameterKey"] as! String))
- print("error_message: " + (detailedError.userInfo["com.stripe.lib:ErrorMessageKey"] as! String))
- }
- }
- else {
- print(token)
- }
- }
- /*
- Output:
- Bank account parameters:
- <Stripe.STPBankAccountParams: 0x600001912920; routingNumber = 110000000; last4 = 0044; country = US; currency = ;
- Error Domain=com.stripe.lib Code=50 "There was an unexpected error -- try again in a few seconds" UserInfo={com.stripe.lib:StripeErrorTypeKey=invalid_request_error, com.stripe.lib:StripeErrorCodeKey=account_number_invalid, com.stripe.lib:ErrorMessageKey=You must use a test bank account number in test mode. Try 000123456789 or see more options at https://stripe.com/docs/connect/testing#account-numbers., com.stripe.lib:ErrorParameterKey=bankAccount[AccountNumber], NSLocalizedDescription=There was an unexpected error -- try again in a few seconds}
- error_code: account_number_invalid
- error_type: invalid_request_error
- error parameter: bankAccount[AccountNumber]
- error_message: You must use a test bank account number in test mode. Try 000123456789 or see more options at https://stripe.com/docs/connect/testing#account-numbers.
- */
Add Comment
Please, Sign In to add comment