PaySecure Pinless Web Services 2023:07:03:07

<back to all web services

AchRefundRequest

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

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

    // @DataMember
    public var tranId:String

    // @DataMember
    public var amount:Int

    // @DataMember
    public var referenceKey:String

    // @DataMember
    public var merchantDetails:MerchantDescriptor

    // @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 avs:Avs

    // @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 MerchantDescriptor : MerchantDescriptorBase
{
    public var name:String
    public var address:String
    public var city:String
    public var state:String
    public var zip:String
    public var country:String
    public var customerServiceNumber:String
    public var mcc:String
    public var fnSnum:String
    public var email:String

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

    private enum CodingKeys : String, CodingKey {
        case name
        case address
        case city
        case state
        case zip
        case country
        case customerServiceNumber
        case mcc
        case fnSnum
        case email
    }

    required public init(from decoder: Decoder) throws {
        try super.init(from: decoder)
        let container = try decoder.container(keyedBy: CodingKeys.self)
        name = try container.decodeIfPresent(String.self, forKey: .name)
        address = try container.decodeIfPresent(String.self, forKey: .address)
        city = try container.decodeIfPresent(String.self, forKey: .city)
        state = try container.decodeIfPresent(String.self, forKey: .state)
        zip = try container.decodeIfPresent(String.self, forKey: .zip)
        country = try container.decodeIfPresent(String.self, forKey: .country)
        customerServiceNumber = try container.decodeIfPresent(String.self, forKey: .customerServiceNumber)
        mcc = try container.decodeIfPresent(String.self, forKey: .mcc)
        fnSnum = try container.decodeIfPresent(String.self, forKey: .fnSnum)
        email = try container.decodeIfPresent(String.self, forKey: .email)
    }

    public override func encode(to encoder: Encoder) throws {
        try super.encode(to: encoder)
        var container = encoder.container(keyedBy: CodingKeys.self)
        if name != nil { try container.encode(name, forKey: .name) }
        if address != nil { try container.encode(address, forKey: .address) }
        if city != nil { try container.encode(city, forKey: .city) }
        if state != nil { try container.encode(state, forKey: .state) }
        if zip != nil { try container.encode(zip, forKey: .zip) }
        if country != nil { try container.encode(country, forKey: .country) }
        if customerServiceNumber != nil { try container.encode(customerServiceNumber, forKey: .customerServiceNumber) }
        if mcc != nil { try container.encode(mcc, forKey: .mcc) }
        if fnSnum != nil { try container.encode(fnSnum, forKey: .fnSnum) }
        if email != nil { try container.encode(email, forKey: .email) }
    }
}

public class MerchantDescriptorBase : Codable
{
    public var dataElements:MerchantDataElements

    required public init(){}
}

public class MerchantDataElements : Codable
{
    public var refundSettlementTypeDetails:Int
    public var sendRecurringPOSEntryModeFeature:Bool
    public var useOrgPOSCode:Bool

    required public init(){}
}

public class Avs : Codable
{
    public var address:String
    public var city:String
    public var state:String
    public var zip:String
    public var country:String
    public var email:String
    public var ipAddress:String
    public var telephoneNumber:String
    public var telephoneType:TelephoneType
    public var deliveryMethod:Int
    public var firstName:String
    public var middleName:String
    public var lastName:String

    required public init(){}
}

public enum TelephoneType : String, Codable
{
    case D
    case H
    case N
    case W
}

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

    // @DataMember
    public var approvalCode:String

    // @DataMember
    public var responseCode:String

    // @DataMember
    public var network:String

    // @DataMember
    public var errorMessage:String

    // @DataMember
    public var errorCode:String

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

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

    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)
        errorMessage = try container.decodeIfPresent(String.self, forKey: .errorMessage)
        errorCode = try container.decodeIfPresent(String.self, forKey: .errorCode)
    }

    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 errorMessage != nil { try container.encode(errorMessage, forKey: .errorMessage) }
        if errorCode != nil { try container.encode(errorCode, forKey: .errorCode) }
    }
}

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

    // @DataMember(EmitDefaultValue=false)
    public var token:String

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

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

    private enum CodingKeys : String, CodingKey {
        case localDateTime
        case token
        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)
        token = try container.decodeIfPresent(String.self, forKey: .token)
        extendedData = try container.decodeIfPresent(ExtendedResponse.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 token != nil { try container.encode(token, forKey: .token) }
        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 ExtendedResponse : Codable
{
    // @DataMember(EmitDefaultValue=false)
    public var cardAccountUpdater:CardAccountUpdaterDescriptor

    // @DataMember(EmitDefaultValue=false)
    public var productId:String

    // @DataMember(EmitDefaultValue=false)
    public var networkResponseCode:String

    // @DataMember(EmitDefaultValue=false)
    public var networkTransactionId:String

    // @DataMember(EmitDefaultValue=false)
    public var chEmailAddrResult:String

    required public init(){}
}

public class CardAccountUpdaterDescriptor : Codable
{
    public var cardDataType:CardInfoType
    public var cardNumberInfo:String
    public var expiryDate:String
    public var status:String
    public var errorCode:String
    public var cardToken:String

    required public init(){}
}

public enum CardInfoType : String, Codable
{
    case CardNumber
    case Token
    case Track
    case EMV
    case Encrypted
    case DPAN
    case ApplePay
    case GooglePay
    case SamsungPay
    case CPToken
    case EncryptedEnhanced
    case EncryptedJWE
}


Swift AchRefundRequest DTOs

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

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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

POST /ACHRefund HTTP/1.1 
Host: api.paysecure.acculynk.net 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"Credentials":{"MerchantId":"String","UserName":"String","Password":"String","Version":"String"},"TranId":"String","Amount":0,"ReferenceKey":"String","MerchantDetails":{"Name":"String","Address":"String","City":"String","State":"String","Zip":"String","Country":"String","CustomerServiceNumber":"String","MCC":"String","FNSnum":"String","Email":"String","DataElements":{"RefundSettlementTypeDetails":0,"SendRecurringPOSEntryModeFeature":false,"UseOrgPOSCode":false}},"Custom1":"String","Custom2":"String","Custom3":"String","Custom4":"String","Custom5":"String","SignatureHash":"String","AVS":{"Address":"String","City":"String","State":"String","Zip":"String","Country":"String","Email":"String","IPAddress":"String","TelephoneNumber":"String","TelephoneType":"D","DeliveryMethod":0,"FirstName":"String","MiddleName":"String","LastName":"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":"\/Date(-62135596800000-0000)\/"}}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"TranId":"String","ApprovalCode":"String","ResponseCode":"String","Network":"String","ErrorMessage":"String","ErrorCode":"String","LocalDateTime":"String","Token":"String","ExtendedData":{"CardAccountUpdater":{"CardDataType":"CardNumber","CardNumberInfo":"String","ExpiryDate":"String","Status":"String","ErrorCode":"String","CardToken":"String"},"ProductId":"String","NetworkResponseCode":"String","NetworkTransactionId":"String","CHEmailAddrResult":"String"},"Timestamps":{"AppLayer":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"ParentLookup":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"RetryLookup":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"GetCardData":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"CardTokenize":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"CardEncrypt":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"DBInsert":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"BackendProcess":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"DBUpdate":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"ParentUpdate":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"},"Network":{"InTime":"\/Date(-62135596800000-0000)\/","OutTime":"\/Date(-62135596800000-0000)\/"}}}