PaySecure Pinless Web Services 2023:07:03:07

<back to all web services

AchAuthorizeDebitRequest

The following routes are available for this service:
POST/ACHDebit
import Foundation
import ServiceStack

// @DataContract
public class AchAuthorizeDebitRequest : Codable
{
    // @DataMember
    public var credentials:RequestorCredentials

    // @DataMember
    public var achToken:ACHTokenDescriptor

    // @DataMember
    public var amount:Int

    // @DataMember
    public var referenceKey:String

    // @DataMember
    public var custom1:String

    // @DataMember
    public var custom2:String

    // @DataMember
    public var custom3:String

    // @DataMember
    public var custom4:String

    // @DataMember
    public var custom5:String

    // @DataMember
    public var signatureHash:String

    // @DataMember
    public var currencyCode: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(){}
}

public class ACHTokenDescriptor : Codable
{
    public var achTokenType:ACHType
    public var achTokenData:String

    required public init(){}
}

public enum ACHType : String, Codable
{
    case Token
    case CPToken
}

// @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 AchAuthorizeDebit : AchPaysecureVersion
{
    // @DataMember
    public var tranId:String

    // @DataMember
    public var approvalCode:String

    // @DataMember
    public var responseCode:String

    // @DataMember
    public var network:String

    // @DataMember
    public var approvedAmount:Int

    // @DataMember
    public var errorMessage:String

    // @DataMember
    public var errorCode:String

    // @DataMember(EmitDefaultValue=false)
    public var achProviderDetails:AchProviderResponse

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case tranId
        case approvalCode
        case responseCode
        case network
        case approvedAmount
        case errorMessage
        case errorCode
        case achProviderDetails
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        tranId = try container.decodeIfPresent(String.self, forKey: .tranId)
        approvalCode = try container.decodeIfPresent(String.self, forKey: .approvalCode)
        responseCode = try container.decodeIfPresent(String.self, forKey: .responseCode)
        network = try container.decodeIfPresent(String.self, forKey: .network)
        approvedAmount = try container.decodeIfPresent(Int.self, forKey: .approvedAmount)
        errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
        errorCode = try container.decodeIfPresent(String.self, forKey: .errorCode)
        achProviderDetails = try container.decodeIfPresent(AchProviderResponse.self, forKey: .achProviderDetails)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if tranId != nil { try container.encode(tranId, forKey: .tranId) }
        if approvalCode != nil { try container.encode(approvalCode, forKey: .approvalCode) }
        if responseCode != nil { try container.encode(responseCode, forKey: .responseCode) }
        if network != nil { try container.encode(network, forKey: .network) }
        if approvedAmount != nil { try container.encode(approvedAmount, forKey: .approvedAmount) }
        if errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
        if errorCode != nil { try container.encode(errorCode, forKey: .errorCode) }
        if achProviderDetails != nil { try container.encode(achProviderDetails, forKey: .achProviderDetails) }
    }
}

// @DataContract
public class AchPaysecureVersion : PaysecureResponseInternal
{
    // @DataMember(EmitDefaultValue=false)
    public var localDateTime:String

    // @DataMember(EmitDefaultValue=false)
    public var extendedData:ACHExtendedDataResponse

    required public init(){ super.init() }

    private enum CodingKeys : String, CodingKey {
        case localDateTime
        case extendedData
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        localDateTime = try container.decodeIfPresent(String.self, forKey: .localDateTime)
        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 localDateTime != nil { try container.encode(localDateTime, forKey: .localDateTime) }
        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 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(){}
}

// @DataContract
public class AchProviderResponse : Codable
{
    // @DataMember
    public var networkResponseCode:String

    // @DataMember
    public var transactionStatusCode:Int

    required public init(){}
}


Swift AchAuthorizeDebitRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /ACHDebit HTTP/1.1 
Host: api.paysecure.acculynk.net 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	Credentials: 
	{
		MerchantId: String,
		UserName: String,
		Password: String,
		Version: String
	},
	ACHToken: 
	{
		ACHTokenType: Token,
		ACHTokenData: String
	},
	Amount: 0,
	ReferenceKey: String,
	Custom1: String,
	Custom2: String,
	Custom3: String,
	Custom4: String,
	Custom5: String,
	SignatureHash: String,
	CurrencyCode: String,
	ExtendedData: 
	{
		CashbackAmount: 0,
		ConnectPaySubScriberId: String,
		OrganizationId: String,
		DeviceFingerPrint: String,
		MerchantSessionId: String,
		CurrencyCode: String,
		PaymentType: String,
		VerifyCustomer: False,
		CustomerExternalId: String,
		Description: String,
		CustomerName: String,
		AddressLine1: String,
		AddressLine2: String,
		City: String,
		State: String,
		Zip: String,
		Country: String,
		Email: String,
		TelephoneNumber: String,
		ReturnUrl: String,
		CancelUrl: String,
		EstablishData: String,
		RedirectUrl: String,
		RetryAttemptCount: 0,
		SignatureHashVersion: String,
		DeadlineHashDate: 0001-01-01
	}
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	TranId: String,
	ApprovalCode: String,
	ResponseCode: String,
	Network: String,
	ApprovedAmount: 0,
	ErrorMessage: String,
	ErrorCode: String,
	AchProviderDetails: 
	{
		NetworkResponseCode: String,
		TransactionStatusCode: 0
	},
	LocalDateTime: String,
	ExtendedData: 
	{
		NetworkResponseCode: String,
		NetworkErrorCode: String,
		DeclineReferenceCode: String,
		NetworkTransactionId: String
	},
	Timestamps: 
	{
		AppLayer: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		ParentLookup: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		RetryLookup: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		GetCardData: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		CardTokenize: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		CardEncrypt: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		DBInsert: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		BackendProcess: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		DBUpdate: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		ParentUpdate: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		},
		Network: 
		{
			InTime: 0001-01-01,
			OutTime: 0001-01-01
		}
	}
}