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 'package:servicestack/servicestack.dart';

class ApiDtoBase implements IConvertible
{
    String? ApiKey;
    int? StoreId;
    int? ChainId;

    ApiDtoBase({this.ApiKey,this.StoreId,this.ChainId});
    ApiDtoBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ApiKey = json['ApiKey'];
        StoreId = json['StoreId'];
        ChainId = json['ChainId'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ApiKey': ApiKey,
        'StoreId': StoreId,
        'ChainId': ChainId
    };

    getTypeName() => "ApiDtoBase";
    TypeContext? context = _ctx;
}

// @DataContract
enum AcctType
{
    Uninitialized,
    Visa,
    MC,
    Disc,
    Amex,
    Diners,
    JCB,
    enRoute,
    PayPal,
    BillMe,
    PC,
    PS,
    BC,
    BS,
    Becs,
    Bacs,
    Maestro,
    Solo,
    VisaElectron,
    CIBC,
    RoyalBankCa,
    TDCaTrust,
    Scotia,
    BMO,
    HSBCCa,
    UnionPay,
    InterPayment,
    Laser,
    UnknownCredit,
    TransArmor,
    Factor4,
    XPass,
    ConnectedAccount,
    Error,
}

class AddPaymentProfileRequest extends ApiDtoBase implements IConvertible
{
    int? UserId;
    String? AcctToken;
    String? Last4;
    int? ExpMonth;
    int? ExpYear;
    AcctType? AcctType;
    int? BnkRoute;
    String? FirstName;
    String? MiddleName;
    String? LastName;
    String? Address1;
    String? Address2;
    String? City;
    String? State;
    String? PostalCode;
    String? CountryCode;
    String? Urbanization;
    bool? DoNotUpdatePaymentTypePreference;
    bool? IsTemp;

    AddPaymentProfileRequest({this.UserId,this.AcctToken,this.Last4,this.ExpMonth,this.ExpYear,this.AcctType,this.BnkRoute,this.FirstName,this.MiddleName,this.LastName,this.Address1,this.Address2,this.City,this.State,this.PostalCode,this.CountryCode,this.Urbanization,this.DoNotUpdatePaymentTypePreference,this.IsTemp});
    AddPaymentProfileRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        UserId = json['UserId'];
        AcctToken = json['AcctToken'];
        Last4 = json['Last4'];
        ExpMonth = json['ExpMonth'];
        ExpYear = json['ExpYear'];
        AcctType = JsonConverters.fromJson(json['AcctType'],'AcctType',context!);
        BnkRoute = json['BnkRoute'];
        FirstName = json['FirstName'];
        MiddleName = json['MiddleName'];
        LastName = json['LastName'];
        Address1 = json['Address1'];
        Address2 = json['Address2'];
        City = json['City'];
        State = json['State'];
        PostalCode = json['PostalCode'];
        CountryCode = json['CountryCode'];
        Urbanization = json['Urbanization'];
        DoNotUpdatePaymentTypePreference = json['DoNotUpdatePaymentTypePreference'];
        IsTemp = json['IsTemp'];
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'UserId': UserId,
        'AcctToken': AcctToken,
        'Last4': Last4,
        'ExpMonth': ExpMonth,
        'ExpYear': ExpYear,
        'AcctType': JsonConverters.toJson(AcctType,'AcctType',context!),
        'BnkRoute': BnkRoute,
        'FirstName': FirstName,
        'MiddleName': MiddleName,
        'LastName': LastName,
        'Address1': Address1,
        'Address2': Address2,
        'City': City,
        'State': State,
        'PostalCode': PostalCode,
        'CountryCode': CountryCode,
        'Urbanization': Urbanization,
        'DoNotUpdatePaymentTypePreference': DoNotUpdatePaymentTypePreference,
        'IsTemp': IsTemp
    });

    getTypeName() => "AddPaymentProfileRequest";
    TypeContext? context = _ctx;
}

enum RestrictedResourceType
{
    Store,
    Chain,
    User,
    Undefined,
}

// @ApiResponse(Description="", ResponseType=typeof(AddPaymentProfileResponse), StatusCode=200)
class AddPaymentAccount extends AddPaymentProfileRequest implements IRestrictedApiRequest, IConvertible
{
    /**
    * Api Authentication Key
    */
    // @ApiMember(Description="Api Authentication Key", IsRequired=true, ParameterType="query")
    String? ApiKey;

    /**
    * Id of the store for the user
    */
    // @ApiMember(Description="Id of the store for the user", IsRequired=true, ParameterType="query")
    int? StoreId;

    /**
    * Member Id of the user to update their Payment Profile
    */
    // @ApiMember(Description="Member Id of the user to update their Payment Profile", IsRequired=true, ParameterType="path")
    int? MemberId;

    /**
    * The AcctToken provided by creating a Payment Profile with the Vault Api
    */
    // @ApiMember(Description="The AcctToken provided by creating a Payment Profile with the Vault Api", IsRequired=true)
    String? AcctToken;

    /**
    * Last 4 digits of the Payment Profile
    */
    // @ApiMember(Description="Last 4 digits of the Payment Profile")
    String? Last4;

    /**
    * 2 digit expiration month  **Required for Credit Card**
    */
    // @ApiMember(Description="2 digit expiration month  \n**Required for Credit Card**")
    int? ExpMonth;

    /**
    * 2 digit expiration year  **Required for Credit Card**
    */
    // @ApiMember(Description="2 digit expiration year  \n**Required for Credit Card**")
    int? ExpYear;

    /**
    * 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="\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>")
    AcctType? AcctType;

    /**
    * Bank Routing Number  **Required for Bank Accounts**
    */
    // @ApiMember(Description="Bank Routing Number  \n**Required for Bank Accounts**")
    int? BnkRoute;

    /**
    * Set to `true` to not set the user's Payment Type Preference when adding an on-file profile
    */
    // @ApiMember(Description="Set to `true` to not set the user's Payment Type Preference when adding an on-file profile")
    bool? DoNotUpdatePaymentTypePreference;

    /**
    * Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)
    */
    // @ApiMember(Description="Whether the Payment Profile is Temporary (One time transactions and Gift Cards are IsTemp = `true`)")
    bool? IsTemp;

    int? RestrictedId;
    RestrictedResourceType? RestrictedResourceType;

    AddPaymentAccount({this.ApiKey,this.StoreId,this.MemberId,this.AcctToken,this.Last4,this.ExpMonth,this.ExpYear,this.AcctType,this.BnkRoute,this.DoNotUpdatePaymentTypePreference,this.IsTemp,this.RestrictedId,this.RestrictedResourceType});
    AddPaymentAccount.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        ApiKey = json['ApiKey'];
        StoreId = json['StoreId'];
        MemberId = json['MemberId'];
        AcctToken = json['AcctToken'];
        Last4 = json['Last4'];
        ExpMonth = json['ExpMonth'];
        ExpYear = json['ExpYear'];
        AcctType = JsonConverters.fromJson(json['AcctType'],'AcctType',context!);
        BnkRoute = json['BnkRoute'];
        DoNotUpdatePaymentTypePreference = json['DoNotUpdatePaymentTypePreference'];
        IsTemp = json['IsTemp'];
        RestrictedId = json['RestrictedId'];
        RestrictedResourceType = JsonConverters.fromJson(json['RestrictedResourceType'],'RestrictedResourceType',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'ApiKey': ApiKey,
        'StoreId': StoreId,
        'MemberId': MemberId,
        'AcctToken': AcctToken,
        'Last4': Last4,
        'ExpMonth': ExpMonth,
        'ExpYear': ExpYear,
        'AcctType': JsonConverters.toJson(AcctType,'AcctType',context!),
        'BnkRoute': BnkRoute,
        'DoNotUpdatePaymentTypePreference': DoNotUpdatePaymentTypePreference,
        'IsTemp': IsTemp,
        'RestrictedId': RestrictedId,
        'RestrictedResourceType': JsonConverters.toJson(RestrictedResourceType,'RestrictedResourceType',context!)
    });

    getTypeName() => "AddPaymentAccount";
    TypeContext? context = _ctx;
}

class AddPaymentProfileResponse implements IConvertible
{
    String? Success;
    String? Message;

    AddPaymentProfileResponse({this.Success,this.Message});
    AddPaymentProfileResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Success = json['Success'];
        Message = json['Message'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Success': Success,
        'Message': Message
    };

    getTypeName() => "AddPaymentProfileResponse";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'www.clubready.com', types: <String, TypeInfo> {
    'ApiDtoBase': TypeInfo(TypeOf.Class, create:() => ApiDtoBase()),
    'AcctType': TypeInfo(TypeOf.Enum, enumValues:AcctType.values),
    'AddPaymentProfileRequest': TypeInfo(TypeOf.Class, create:() => AddPaymentProfileRequest()),
    'RestrictedResourceType': TypeInfo(TypeOf.Enum, enumValues:RestrictedResourceType.values),
    'AddPaymentAccount': TypeInfo(TypeOf.Class, create:() => AddPaymentAccount()),
    'AddPaymentProfileResponse': TypeInfo(TypeOf.Class, create:() => AddPaymentProfileResponse()),
});

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

<AddPaymentAccount xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Model">
  <ApiKey xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ApiKey>
  <ChainId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ChainId>
  <StoreId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StoreId>
  <AcctToken xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</AcctToken>
  <AcctType xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">Uninitialized</AcctType>
  <Address1 xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Address1>
  <Address2 xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Address2>
  <BnkRoute xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</BnkRoute>
  <City xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</City>
  <CountryCode xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</CountryCode>
  <DoNotUpdatePaymentTypePreference xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</DoNotUpdatePaymentTypePreference>
  <ExpMonth xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ExpMonth>
  <ExpYear xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ExpYear>
  <FirstName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</FirstName>
  <IsTemp xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</IsTemp>
  <Last4 xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Last4>
  <LastName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</LastName>
  <MiddleName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</MiddleName>
  <PostalCode xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</PostalCode>
  <State xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</State>
  <Urbanization xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Urbanization>
  <UserId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</UserId>
  <AuthToken>String</AuthToken>
  <CardType>0</CardType>
  <MemberId>0</MemberId>
</AddPaymentAccount>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<AddPaymentProfileResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">
  <Message>String</Message>
  <Success>String</Success>
</AddPaymentProfileResponse>