PaySecure Pinless Web Services 2023:07:03:07

<back to all web services

CreateCardTokenRequest

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

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

    // @DataMember
    public var sessionId:String

    // @DataMember
    public var verifyCard:Bool

    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 CreateCardToken : PaysecureResponseInternal
{
    // @DataMember
    public var cardToken:String

    // @DataMember
    public var cardZip:String

    // @DataMember
    public var cardLast4:String

    // @DataMember
    public var cardExpiration:String

    // @DataMember
    public var cvn:String

    // @DataMember
    public var avs:String

    // @DataMember
    public var binResults:BINResults

    // @DataMember
    public var responseCode:String

    // @DataMember
    public var errorMessage:String

    // @DataMember
    public var errorCode:String

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

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

    private enum CodingKeys : String, CodingKey {
        case cardToken
        case cardZip
        case cardLast4
        case cardExpiration
        case cvn
        case avs
        case binResults
        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)
        cardToken = try container.decodeIfPresent(String.self, forKey: .cardToken)
        cardZip = try container.decodeIfPresent(String.self, forKey: .cardZip)
        cardLast4 = try container.decodeIfPresent(String.self, forKey: .cardLast4)
        cardExpiration = try container.decodeIfPresent(String.self, forKey: .cardExpiration)
        cvn = try container.decodeIfPresent(String.self, forKey: .cvn)
        avs = try container.decodeIfPresent(String.self, forKey: .avs)
        binResults = try container.decodeIfPresent(BINResults.self, forKey: .binResults)
        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(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 cardToken != nil { try container.encode(cardToken, forKey: .cardToken) }
        if cardZip != nil { try container.encode(cardZip, forKey: .cardZip) }
        if cardLast4 != nil { try container.encode(cardLast4, forKey: .cardLast4) }
        if cardExpiration != nil { try container.encode(cardExpiration, forKey: .cardExpiration) }
        if cvn != nil { try container.encode(cvn, forKey: .cvn) }
        if avs != nil { try container.encode(avs, forKey: .avs) }
        if binResults != nil { try container.encode(binResults, forKey: .binResults) }
        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(){}
}

public class BINResults : Codable
{
    public var bin:String
    public var network:String
    public var internetPinDebit:Bool
    public var ecomEBTCash:Bool
    public var ecomEBTSNAP:Bool
    public var posFlag:Bool
    public var pinlessEcommerce:Bool
    public var pinlessBillPay:Bool
    public var onDemandPaymentCredit:Bool
    public var onDemandPaymentDebit:Bool
    public var pinlessA2ACredit:Bool
    public var pinlessA2ADebit:Bool
    public var pinlessPrePaidLoad:Bool
    public var dualMessage:Bool
    public var recurring:Bool
    public var cardVerify:Bool
    public var regulatedFlag:Bool
    public var otp:Bool
    public var posPinlessDualMessage:Bool
    public var fastFunds:String
    public var regulatedWithFraud:Bool
    public var countryCode:String
    public var cardType:String
    public var cardProduct:String
    public var cardDesignation:String
    public var cardSubCategory:String
    public var incrementalAuth:Bool

    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 CreateCardTokenRequest DTOs

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

HTTP + XML

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

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

<CreateCardTokenRequest 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>
  <SessionId>String</SessionId>
  <VerifyCard>false</VerifyCard>
</CreateCardTokenRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<CreateCardToken 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>
  <AVS>String</AVS>
  <BINResults>
    <BIN>String</BIN>
    <CardDesignation>String</CardDesignation>
    <CardProduct>String</CardProduct>
    <CardSubCategory>String</CardSubCategory>
    <CardType>String</CardType>
    <CardVerify>false</CardVerify>
    <CountryCode>String</CountryCode>
    <DualMessage>false</DualMessage>
    <EcomEBTCash>false</EcomEBTCash>
    <EcomEBTSNAP>false</EcomEBTSNAP>
    <FastFunds>String</FastFunds>
    <IncrementalAuth>false</IncrementalAuth>
    <InternetPinDebit>false</InternetPinDebit>
    <Network>String</Network>
    <OTP>false</OTP>
    <OnDemandPaymentCredit>false</OnDemandPaymentCredit>
    <OnDemandPaymentDebit>false</OnDemandPaymentDebit>
    <POSFlag>false</POSFlag>
    <POSPinlessDualMessage>false</POSPinlessDualMessage>
    <PinlessA2ACredit>false</PinlessA2ACredit>
    <PinlessA2ADebit>false</PinlessA2ADebit>
    <PinlessBillPay>false</PinlessBillPay>
    <PinlessEcommerce>false</PinlessEcommerce>
    <PinlessPrePaidLoad>false</PinlessPrePaidLoad>
    <Recurring>false</Recurring>
    <RegulatedFlag>false</RegulatedFlag>
    <RegulatedWithFraud>false</RegulatedWithFraud>
  </BINResults>
  <CVN>String</CVN>
  <CardExpiration>String</CardExpiration>
  <CardLast4>String</CardLast4>
  <CardToken>String</CardToken>
  <CardZip>String</CardZip>
  <ErrorCode>String</ErrorCode>
  <ErrorMessage>String</ErrorMessage>
  <ExtendedData>
    <CHEmailAddrResult>String</CHEmailAddrResult>
    <CardAccountUpdater>
      <CardDataType>CardNumber</CardDataType>
      <CardNumberInfo>String</CardNumberInfo>
      <CardToken>String</CardToken>
      <ErrorCode>String</ErrorCode>
      <ExpiryDate>String</ExpiryDate>
      <Status>String</Status>
    </CardAccountUpdater>
    <NetworkResponseCode>String</NetworkResponseCode>
    <NetworkTransactionId>String</NetworkTransactionId>
    <ProductId>String</ProductId>
  </ExtendedData>
  <ResponseCode>String</ResponseCode>
</CreateCardToken>