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 .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 /CreateCardToken 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
	},
	SessionId: String,
	VerifyCard: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	CardToken: String,
	CardZip: String,
	CardLast4: String,
	CardExpiration: String,
	CVN: String,
	AVS: String,
	BINResults: 
	{
		BIN: String,
		Network: String,
		InternetPinDebit: False,
		EcomEBTCash: False,
		EcomEBTSNAP: False,
		POSFlag: False,
		PinlessEcommerce: False,
		PinlessBillPay: False,
		OnDemandPaymentCredit: False,
		OnDemandPaymentDebit: False,
		PinlessA2ACredit: False,
		PinlessA2ADebit: False,
		PinlessPrePaidLoad: False,
		DualMessage: False,
		Recurring: False,
		CardVerify: False,
		RegulatedFlag: False,
		OTP: False,
		POSPinlessDualMessage: False,
		FastFunds: String,
		RegulatedWithFraud: False,
		CountryCode: String,
		CardType: String,
		CardProduct: String,
		CardDesignation: String,
		CardSubCategory: String,
		IncrementalAuth: False
	},
	ResponseCode: String,
	ErrorMessage: String,
	ErrorCode: 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: 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
		}
	}
}