PaySecure Pinless Web Services 2023:07:03:07

<back to all web services

TokenizeCardRequest

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

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

    // @DataMember
    public var keyId:String

    // @DataMember
    public var encryptedCardNumber:String

    // @DataMember
    public var expiration:String

    // @DataMember
    public var encryptedCVN:String

    // @DataMember
    public var avs:Avs

    // @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(){}
}

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

    // @DataMember
    public var cardHash:String

    // @DataMember
    public var cardLast4:String

    // @DataMember
    public var cardBIN:String

    // @DataMember
    public var cardExpiration:String

    // @DataMember
    public var responseCode:String

    // @DataMember
    public var errorMessage:String

    // @DataMember
    public var errorCode:String

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

    private enum CodingKeys : String, CodingKey {
        case cardToken
        case cardHash
        case cardLast4
        case cardBIN
        case cardExpiration
        case responseCode
        case errorMessage
        case errorCode
    }

    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)
        cardHash = try container.decodeIfPresent(String.self, forKey: .cardHash)
        cardLast4 = try container.decodeIfPresent(String.self, forKey: .cardLast4)
        cardBIN = try container.decodeIfPresent(String.self, forKey: .cardBIN)
        cardExpiration = try container.decodeIfPresent(String.self, forKey: .cardExpiration)
        responseCode = try container.decodeIfPresent(String.self, forKey: .responseCode)
        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 cardToken != nil { try container.encode(cardToken, forKey: .cardToken) }
        if cardHash != nil { try container.encode(cardHash, forKey: .cardHash) }
        if cardLast4 != nil { try container.encode(cardLast4, forKey: .cardLast4) }
        if cardBIN != nil { try container.encode(cardBIN, forKey: .cardBIN) }
        if cardExpiration != nil { try container.encode(cardExpiration, forKey: .cardExpiration) }
        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) }
    }
}

// @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(){}
}


Swift TokenizeCardRequest 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 /TokenizeCard 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
	},
	KeyId: String,
	EncryptedCardNumber: String,
	Expiration: String,
	EncryptedCVN: 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
	},
	VerifyCard: False
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	CardToken: String,
	CardHash: String,
	CardLast4: String,
	CardBIN: String,
	CardExpiration: String,
	ResponseCode: String,
	ErrorMessage: String,
	ErrorCode: 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
		}
	}
}