ClubReady Api

<back to all web services

AddPaymentAccount

The following routes are available for this service:
POST/sales/member/{MemberId}/payment/profileAdd Payment Profile for a Member
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 ApiDtoBase:
    api_key: Optional[str] = None
    store_id: Optional[int] = None
    chain_id: Optional[int] = None


class AcctType(IntEnum):
    UNINITIALIZED = 0
    VISA = 1
    MC = 2
    DISC = 3
    AMEX = 4
    DINERS = 5
    JCB = 6
    EN_ROUTE = 7
    PAY_PAL = 8
    BILL_ME = 9
    PC = 11
    PS = 12
    BC = 13
    BS = 14
    BECS = 15
    BACS = 16
    MAESTRO = 20
    SOLO = 21
    VISA_ELECTRON = 22
    CIBC = 23
    ROYAL_BANK_CA = 24
    TD_CA_TRUST = 25
    SCOTIA = 26
    BMO = 27
    HSBC_CA = 28
    UNION_PAY = 29
    INTER_PAYMENT = 30
    LASER = 31
    UNKNOWN_CREDIT = 40
    TRANS_ARMOR = 41
    FACTOR4 = 42
    X_PASS = 43
    CONNECTED_ACCOUNT = 44
    UNKNOWN_BANK = 45
    ERROR = -1


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddPaymentProfileRequest(ApiDtoBase):
    user_id: int = 0
    acct_token: Optional[str] = None
    last4: Optional[str] = None
    exp_month: Optional[int] = None
    exp_year: Optional[int] = None
    acct_type: Optional[AcctType] = None
    bnk_route: Optional[int] = None
    first_name: Optional[str] = None
    middle_name: Optional[str] = None
    last_name: Optional[str] = None
    address1: Optional[str] = None
    address2: Optional[str] = None
    city: Optional[str] = None
    state: Optional[str] = None
    postal_code: Optional[str] = None
    country_code: Optional[str] = None
    urbanization: Optional[str] = None
    do_not_update_payment_type_preference: bool = False
    is_temp: bool = False


class RestrictedResourceType(str, Enum):
    STORE = 'Store'
    CHAIN = 'Chain'
    USER = 'User'
    UNDEFINED = 'Undefined'


# @ApiResponse(Description="", ResponseType=typeof(AddPaymentProfileResponse), StatusCode=200)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddPaymentAccount(AddPaymentProfileRequest, IRestrictedApiRequest):
    # @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
    api_key: Optional[str] = None
    """
    Api Authentication Key
    """


    # @ApiMember(Description="Id of the store for the user", IsRequired=true, ParameterType="query")
    store_id: Optional[int] = None
    """
    Id of the store for the user
    """


    # @ApiMember(Description="Member Id of the user to update their Payment Profile", IsRequired=true, ParameterType="path")
    member_id: int = 0
    """
    Member Id of the user to update their Payment Profile
    """


    # @ApiMember(Description="The AcctToken provided by creating a Payment Profile with the Vault Api", IsRequired=true)
    acct_token: Optional[str] = None
    """
    The AcctToken provided by creating a Payment Profile with the Vault Api
    """


    # @ApiMember(Description="Last 4 digits of the Payment Profile")
    last4: Optional[str] = None
    """
    Last 4 digits of the Payment Profile
    """


    # @ApiMember(Description="2 digit expiration month  \n**Required for Credit Card**")
    exp_month: Optional[int] = None
    """
    2 digit expiration month  **Required for Credit Card**
    """


    # @ApiMember(Description="2 digit expiration year  \n**Required for Credit Card**")
    exp_year: Optional[int] = None
    """
    2 digit expiration year  **Required for Credit Card**
    """


    # @ApiMember(Description="\r\nThe Account Type of the Payment Profile  \r\n**Required when adding Gift Card**\r\n\r\n<details>\r\n<summary>Common Values</summary>\r\n<table>\r\n    <thead>\r\n        <tr><th>Text</th><th>Numerical</th><th>Account Type</th></tr>\r\n    </thead>\r\n    <tbody>\r\n        <tr><td>VISA</td><td>1</td><td>Visa</td></tr>\r\n        <tr><td>MC</td><td>2</td><td>MasterCard</td></tr>\r\n        <tr><td>Disc</td><td>3</td><td>Discover</td></tr>\r\n        <tr><td>Amex</td><td>4</td><td>American Express</td></tr>\r\n        <tr><td>PC</td><td>11</td><td>Personal Checking</td></tr>\r\n        <tr><td>PS</td><td>12</td><td>Personal Savings</td></tr>\r\n        <tr><td>BC</td><td>13</td><td>Business Checking</td></tr>\r\n        <tr><td>Factor4</td><td>42</td><td>Factor4 Gift Card</td></tr>\r\n    </tbody>\r\n</table>\r\n<p>You may use the Text or the Numerical value.</p>\r\n</details>")
    acct_type: Optional[AcctType] = None
    """
    The Account Type of the Payment Profile  **Required when adding Gift Card**<details><summary>Common Values</summary><table>    <thead>        <tr><th>Text</th><th>Numerical</th><th>Account Type</th></tr>    </thead>    <tbody>        <tr><td>VISA</td><td>1</td><td>Visa</td></tr>        <tr><td>MC</td><td>2</td><td>MasterCard</td></tr>        <tr><td>Disc</td><td>3</td><td>Discover</td></tr>        <tr><td>Amex</td><td>4</td><td>American Express</td></tr>        <tr><td>PC</td><td>11</td><td>Personal Checking</td></tr>        <tr><td>PS</td><td>12</td><td>Personal Savings</td></tr>        <tr><td>BC</td><td>13</td><td>Business Checking</td></tr>        <tr><td>Factor4</td><td>42</td><td>Factor4 Gift Card</td></tr>    </tbody></table><p>You may use the Text or the Numerical value.</p></details>
    """


    # @ApiMember(Description="Bank Routing Number  \n**Required for Bank Accounts**")
    bnk_route: Optional[int] = None
    """
    Bank Routing Number  **Required for Bank Accounts**
    """


    # @ApiMember(Description="Set to `true` to not set the user's Payment Type Preference when adding an on-file profile")
    do_not_update_payment_type_preference: bool = False
    """
    Set to `true` to not set the user's Payment Type Preference when adding an on-file profile
    """


    # @ApiMember(Description="Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)")
    is_temp: bool = False
    """
    Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)
    """


    restricted_id: Optional[int] = None
    restricted_resource_type: Optional[RestrictedResourceType] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddPaymentProfileResponse:
    success: Optional[str] = None
    message: Optional[str] = None

Python AddPaymentAccount 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 /sales/member/{MemberId}/payment/profile HTTP/1.1 
Host: clubready.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ApiKey: String,
	StoreId: 0,
	MemberId: 0,
	AcctToken: String,
	AuthToken: String,
	Last4: String,
	ExpMonth: 0,
	ExpYear: 0,
	AcctType: Uninitialized,
	CardType: 0,
	BnkRoute: 0,
	DoNotUpdatePaymentTypePreference: False,
	IsTemp: False,
	RestrictedId: 0,
	RestrictedResourceType: Chain,
	UserId: 0,
	FirstName: String,
	MiddleName: String,
	LastName: String,
	Address1: String,
	Address2: String,
	City: String,
	State: String,
	PostalCode: String,
	CountryCode: String,
	Urbanization: String,
	ChainId: 0
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Success: String,
	Message: String
}