POST | /CreateACHToken |
---|
import Foundation
import ServiceStack
// @DataContract
public class CreateACHTokenRequest : Codable
{
// @DataMember
public var credentials:RequestorCredentials
// @DataMember
public var sessionId:String
// @DataMember
public var extendedData:ACHExtendedData
required public init(){}
}
public class RequestorCredentials : Codable
{
// @Required()
public var merchantId:String?
// @Required()
public var userName:String?
// @Required()
public var password:String?
// @Required()
public var version:String?
required public init(){}
}
// @DataContract
public class ACHExtendedData : Codable
{
// @DataMember
public var cashbackAmount:Int
// @DataMember
public var connectPaySubScriberId:String
// @DataMember
public var organizationId:String
// @DataMember
public var deviceFingerPrint:String
// @DataMember
public var merchantSessionId:String
// @DataMember
public var currencyCode:String
// @DataMember
public var paymentType:String
// @DataMember
public var verifyCustomer:Bool
// @DataMember
public var customerExternalId:String
// @DataMember
public var Description:String
// @DataMember
public var customerName:String
// @DataMember
public var addressLine1:String
// @DataMember
public var addressLine2:String
// @DataMember
public var city:String
// @DataMember
public var state:String
// @DataMember
public var zip:String
// @DataMember
public var country:String
// @DataMember
public var email:String
// @DataMember
public var telephoneNumber:String
// @DataMember
public var returnUrl:String
// @DataMember
public var cancelUrl:String
// @DataMember
public var establishData:String
// @DataMember
public var redirectUrl:String
// @DataMember
public var retryAttemptCount:Int
// @DataMember
public var signatureHashVersion:String
// @DataMember
public var deadlineHashDate:Date?
required public init(){}
}
// @DataContract
public class CreateACHToken : PaysecureResponseInternal
{
// @DataMember
public var achToken:String
// @DataMember
public var bankName:String
// @DataMember
public var accountNumberLast4:String
// @DataMember
public var achHash:String
// @DataMember
public var accountType:String
// @DataMember
public var accountName:String
// @DataMember
public var bankId:String
// @DataMember
public var accountStatus:String
// @DataMember
public var userInformation:UserInformation
// @DataMember
public var responseCode:String
// @DataMember
public var errorMessage:String
// @DataMember
public var errorCode:String
// @DataMember
public var extendedData:ACHExtendedDataResponse
required public init(){ super.init() }
private enum CodingKeys : String, CodingKey {
case achToken
case bankName
case accountNumberLast4
case achHash
case accountType
case accountName
case bankId
case accountStatus
case userInformation
case responseCode
case errorMessage
case errorCode
case extendedData
}
required public init(from decoder: Decoder) throws {
try super.init(from: decoder)
let container = try decoder.container(keyedBy: CodingKeys.self)
achToken = try container.decodeIfPresent(String.self, forKey: .achToken)
bankName = try container.decodeIfPresent(String.self, forKey: .bankName)
accountNumberLast4 = try container.decodeIfPresent(String.self, forKey: .accountNumberLast4)
achHash = try container.decodeIfPresent(String.self, forKey: .achHash)
accountType = try container.decodeIfPresent(String.self, forKey: .accountType)
accountName = try container.decodeIfPresent(String.self, forKey: .accountName)
bankId = try container.decodeIfPresent(String.self, forKey: .bankId)
accountStatus = try container.decodeIfPresent(String.self, forKey: .accountStatus)
userInformation = try container.decodeIfPresent(UserInformation.self, forKey: .userInformation)
responseCode = try container.decodeIfPresent(String.self, forKey: .responseCode)
errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
errorCode = try container.decodeIfPresent(String.self, forKey: .errorCode)
extendedData = try container.decodeIfPresent(ACHExtendedDataResponse.self, forKey: .extendedData)
}
public override func encode(to encoder: Encoder) throws {
try super.encode(to: encoder)
var container = encoder.container(keyedBy: CodingKeys.self)
if achToken != nil { try container.encode(achToken, forKey: .achToken) }
if bankName != nil { try container.encode(bankName, forKey: .bankName) }
if accountNumberLast4 != nil { try container.encode(accountNumberLast4, forKey: .accountNumberLast4) }
if achHash != nil { try container.encode(achHash, forKey: .achHash) }
if accountType != nil { try container.encode(accountType, forKey: .accountType) }
if accountName != nil { try container.encode(accountName, forKey: .accountName) }
if bankId != nil { try container.encode(bankId, forKey: .bankId) }
if accountStatus != nil { try container.encode(accountStatus, forKey: .accountStatus) }
if userInformation != nil { try container.encode(userInformation, forKey: .userInformation) }
if responseCode != nil { try container.encode(responseCode, forKey: .responseCode) }
if errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
if errorCode != nil { try container.encode(errorCode, forKey: .errorCode) }
if extendedData != nil { try container.encode(extendedData, forKey: .extendedData) }
}
}
// @DataContract
public class PaysecureResponseInternal : Codable
{
// @DataMember(EmitDefaultValue=false)
public var timestamps:RequestTimestamps
required public init(){}
}
// @DataContract
public class RequestTimestamps : Codable
{
// @DataMember(EmitDefaultValue=false)
public var appLayer:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var parentLookup:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var retryLookup:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var getCardData:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var cardTokenize:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var cardEncrypt:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var dbInsert:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var backendProcess:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var dbUpdate:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var parentUpdate:InOutTimes
// @DataMember(EmitDefaultValue=false)
public var network:InOutTimes
required public init(){}
}
// @DataContract
public class InOutTimes : Codable
{
required public init(){}
}
// @DataContract
public class UserInformation : Codable
{
// @DataMember
public var name:[String] = []
// @DataMember
public var phone:[String] = []
// @DataMember
public var email:[String] = []
// @DataMember
public var address:[AddressDetails] = []
required public init(){}
}
// @DataContract
public class AddressDetails : Codable
{
// @DataMember
public var address1:String
// @DataMember
public var address2:String
// @DataMember
public var city:String
// @DataMember
public var state:String
// @DataMember
public var zip:String
// @DataMember
public var country:String
required public init(){}
}
// @DataContract
public class ACHExtendedDataResponse : Codable
{
// @DataMember(EmitDefaultValue=false)
public var networkResponseCode:String
// @DataMember(EmitDefaultValue=false)
public var networkErrorCode:String
// @DataMember(EmitDefaultValue=false)
public var declineReferenceCode:String
// @DataMember(EmitDefaultValue=false)
public var networkTransactionId:String
required public init(){}
}
Swift CreateACHTokenRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /CreateACHToken HTTP/1.1
Host: api.paysecure.acculynk.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<CreateACHTokenRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
<Credentials>
<MerchantId>String</MerchantId>
<Password>String</Password>
<UserName>String</UserName>
<Version>String</Version>
</Credentials>
<ExtendedData>
<AddressLine1>String</AddressLine1>
<AddressLine2>String</AddressLine2>
<CancelUrl>String</CancelUrl>
<CashbackAmount>0</CashbackAmount>
<City>String</City>
<ConnectPaySubScriberId>String</ConnectPaySubScriberId>
<Country>String</Country>
<CurrencyCode>String</CurrencyCode>
<CustomerExternalId>String</CustomerExternalId>
<CustomerName>String</CustomerName>
<DeadlineHashDate>0001-01-01T00:00:00</DeadlineHashDate>
<Description>String</Description>
<DeviceFingerPrint>String</DeviceFingerPrint>
<Email>String</Email>
<EstablishData>String</EstablishData>
<MerchantSessionId>String</MerchantSessionId>
<OrganizationId>String</OrganizationId>
<PaymentType>String</PaymentType>
<RedirectUrl>String</RedirectUrl>
<RetryAttemptCount>0</RetryAttemptCount>
<ReturnUrl>String</ReturnUrl>
<SignatureHashVersion>String</SignatureHashVersion>
<State>String</State>
<TelephoneNumber>String</TelephoneNumber>
<VerifyCustomer>false</VerifyCustomer>
<Zip>String</Zip>
</ExtendedData>
<SessionId>String</SessionId>
</CreateACHTokenRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreateACHToken xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types"> <Timestamps> <AppLayer> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </AppLayer> <BackendProcess> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </BackendProcess> <CardEncrypt> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </CardEncrypt> <CardTokenize> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </CardTokenize> <DBInsert> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </DBInsert> <DBUpdate> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </DBUpdate> <GetCardData> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </GetCardData> <Network> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </Network> <ParentLookup> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </ParentLookup> <ParentUpdate> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </ParentUpdate> <RetryLookup> <InTime>0001-01-01T00:00:00</InTime> <OutTime>0001-01-01T00:00:00</OutTime> </RetryLookup> </Timestamps> <ACHHash>String</ACHHash> <ACHToken>String</ACHToken> <AccountName>String</AccountName> <AccountNumberLast4>String</AccountNumberLast4> <AccountStatus>String</AccountStatus> <AccountType>String</AccountType> <BankId>String</BankId> <BankName>String</BankName> <ErrorCode>String</ErrorCode> <ErrorMessage>String</ErrorMessage> <ExtendedData> <DeclineReferenceCode>String</DeclineReferenceCode> <NetworkErrorCode>String</NetworkErrorCode> <NetworkResponseCode>String</NetworkResponseCode> <NetworkTransactionId>String</NetworkTransactionId> </ExtendedData> <ResponseCode>String</ResponseCode> <UserInformation> <Address> <AddressDetails> <Address1>String</Address1> <Address2>String</Address2> <City>String</City> <Country>String</Country> <State>String</State> <Zip>String</Zip> </AddressDetails> </Address> <Email xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </Email> <Name xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </Name> <Phone xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:string>String</d3p1:string> </Phone> </UserInformation> </CreateACHToken>