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 datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InOutTimes:
    pass


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RequestTimestamps:
    app_layer: Optional[InOutTimes] = None
    parent_lookup: Optional[InOutTimes] = None
    retry_lookup: Optional[InOutTimes] = None
    get_card_data: Optional[InOutTimes] = None
    card_tokenize: Optional[InOutTimes] = None
    card_encrypt: Optional[InOutTimes] = None
    db_insert: Optional[InOutTimes] = None
    backend_process: Optional[InOutTimes] = None
    db_update: Optional[InOutTimes] = None
    parent_update: Optional[InOutTimes] = None
    network: Optional[InOutTimes] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaysecureResponseInternal:
    timestamps: Optional[RequestTimestamps] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TokenizeCard(PaysecureResponseInternal):
    card_token: Optional[str] = None
    card_hash: Optional[str] = None
    card_last4: Optional[str] = None
    card_b_i_n: Optional[str] = None
    card_expiration: Optional[str] = None
    response_code: Optional[str] = None
    error_message: Optional[str] = None
    error_code: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RequestorCredentials:
    # @Required()
    merchant_id: Optional[str] = None

    # @Required()
    user_name: Optional[str] = None

    # @Required()
    password: Optional[str] = None

    # @Required()
    version: Optional[str] = None


class TelephoneType(str, Enum):
    D = 'D'
    H = 'H'
    N = 'N'
    W = 'W'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Avs:
    address: Optional[str] = None
    city: Optional[str] = None
    state: Optional[str] = None
    zip: Optional[str] = None
    country: Optional[str] = None
    email: Optional[str] = None
    ip_address: Optional[str] = None
    telephone_number: Optional[str] = None
    telephone_type: Optional[TelephoneType] = None
    delivery_method: int = 0
    first_name: Optional[str] = None
    middle_name: Optional[str] = None
    last_name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class TokenizeCardRequest:
    credentials: Optional[RequestorCredentials] = None
    key_id: Optional[str] = None
    encrypted_card_number: Optional[str] = None
    expiration: Optional[str] = None
    encrypted_c_v_n: Optional[str] = None
    avs: Optional[Avs] = None
    verify_card: bool = False

Python TokenizeCardRequest 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 /TokenizeCard HTTP/1.1 
Host: api.paysecure.acculynk.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<TokenizeCardRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.servicestack.net/types">
  <AVS>
    <Address>String</Address>
    <City>String</City>
    <Country>String</Country>
    <DeliveryMethod>0</DeliveryMethod>
    <Email>String</Email>
    <FirstName>String</FirstName>
    <IPAddress>String</IPAddress>
    <LastName>String</LastName>
    <MiddleName>String</MiddleName>
    <State>String</State>
    <TelephoneNumber>String</TelephoneNumber>
    <TelephoneType>D</TelephoneType>
    <Zip>String</Zip>
  </AVS>
  <Credentials>
    <MerchantId>String</MerchantId>
    <Password>String</Password>
    <UserName>String</UserName>
    <Version>String</Version>
  </Credentials>
  <EncryptedCVN>String</EncryptedCVN>
  <EncryptedCardNumber>String</EncryptedCardNumber>
  <Expiration>String</Expiration>
  <KeyId>String</KeyId>
  <VerifyCard>false</VerifyCard>
</TokenizeCardRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<TokenizeCard 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>
  <CardBIN>String</CardBIN>
  <CardExpiration>String</CardExpiration>
  <CardHash>String</CardHash>
  <CardLast4>String</CardLast4>
  <CardToken>String</CardToken>
  <ErrorCode>String</ErrorCode>
  <ErrorMessage>String</ErrorMessage>
  <ResponseCode>String</ResponseCode>
</TokenizeCard>