Billhighway Cloud API

<back to all web services

ChargeTokenRq

The following routes are available for this service:
POST/integrations/api/{tokenType}/charge/token
import 'package:servicestack/servicestack.dart';

class ChargeTokenOptions implements IConvertible
{
    int? Usages;
    int? Duration;

    ChargeTokenOptions({this.Usages,this.Duration});
    ChargeTokenOptions.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Usages': Usages,
        'Duration': Duration
    };

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

class AttributeItem implements IConvertible
{
    String? Name;
    String? Value;

    AttributeItem({this.Name,this.Value});
    AttributeItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Name': Name,
        'Value': Value
    };

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

class CreditCardBillingAddressItem implements IConvertible
{
    String? Address1;
    String? Address2;
    String? City;
    String? PostalCode;
    String? Region;
    String? Country;
    List<AttributeItem>? Attributes;

    CreditCardBillingAddressItem({this.Address1,this.Address2,this.City,this.PostalCode,this.Region,this.Country,this.Attributes});
    CreditCardBillingAddressItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Address1 = json['Address1'];
        Address2 = json['Address2'];
        City = json['City'];
        PostalCode = json['PostalCode'];
        Region = json['Region'];
        Country = json['Country'];
        Attributes = JsonConverters.fromJson(json['Attributes'],'List<AttributeItem>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Address1': Address1,
        'Address2': Address2,
        'City': City,
        'PostalCode': PostalCode,
        'Region': Region,
        'Country': Country,
        'Attributes': JsonConverters.toJson(Attributes,'List<AttributeItem>',context!)
    };

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

class CreditCardChargeItem implements IConvertible
{
    String? NameOnCard;
    int? ExpMonth;
    int? ExpYear;
    String? CardNumber;
    String? Cvv;
    CreditCardBillingAddressItem? Address;

    CreditCardChargeItem({this.NameOnCard,this.ExpMonth,this.ExpYear,this.CardNumber,this.Cvv,this.Address});
    CreditCardChargeItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        NameOnCard = json['NameOnCard'];
        ExpMonth = json['ExpMonth'];
        ExpYear = json['ExpYear'];
        CardNumber = json['CardNumber'];
        Cvv = json['Cvv'];
        Address = JsonConverters.fromJson(json['Address'],'CreditCardBillingAddressItem',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'NameOnCard': NameOnCard,
        'ExpMonth': ExpMonth,
        'ExpYear': ExpYear,
        'CardNumber': CardNumber,
        'Cvv': Cvv,
        'Address': JsonConverters.toJson(Address,'CreditCardBillingAddressItem',context!)
    };

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

class AchChargeItem implements IConvertible
{
    String? AccountNumber;
    String? RoutingNumber;
    String? AccountType;
    String? AccountHolderName;

    AchChargeItem({this.AccountNumber,this.RoutingNumber,this.AccountType,this.AccountHolderName});
    AchChargeItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        AccountNumber = json['AccountNumber'];
        RoutingNumber = json['RoutingNumber'];
        AccountType = json['AccountType'];
        AccountHolderName = json['AccountHolderName'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'AccountNumber': AccountNumber,
        'RoutingNumber': RoutingNumber,
        'AccountType': AccountType,
        'AccountHolderName': AccountHolderName
    };

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

class ReferenceIdTypedAssociationItem implements IConvertible
{
    String? Value;
    String? Type;

    ReferenceIdTypedAssociationItem({this.Value,this.Type});
    ReferenceIdTypedAssociationItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'Value': Value,
        'Type': Type
    };

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

abstract class ChargeTokenRqBase implements IChapterAuthorizationRequest, IApiResultErrorService
{
    String? tokenType;
    int? Amount;
    String? Description;
    ChargeTokenOptions? Options;
    CreditCardChargeItem? CardInfo;
    AchChargeItem? AchInfo;
    List<ReferenceIdTypedAssociationItem>? ReferenceIds;

    ChargeTokenRqBase({this.tokenType,this.Amount,this.Description,this.Options,this.CardInfo,this.AchInfo,this.ReferenceIds});
    ChargeTokenRqBase.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        tokenType = json['tokenType'];
        Amount = json['Amount'];
        Description = json['Description'];
        Options = JsonConverters.fromJson(json['Options'],'ChargeTokenOptions',context!);
        CardInfo = JsonConverters.fromJson(json['CardInfo'],'CreditCardChargeItem',context!);
        AchInfo = JsonConverters.fromJson(json['AchInfo'],'AchChargeItem',context!);
        ReferenceIds = JsonConverters.fromJson(json['ReferenceIds'],'List<ReferenceIdTypedAssociationItem>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'tokenType': tokenType,
        'Amount': Amount,
        'Description': Description,
        'Options': JsonConverters.toJson(Options,'ChargeTokenOptions',context!),
        'CardInfo': JsonConverters.toJson(CardInfo,'CreditCardChargeItem',context!),
        'AchInfo': JsonConverters.toJson(AchInfo,'AchChargeItem',context!),
        'ReferenceIds': JsonConverters.toJson(ReferenceIds,'List<ReferenceIdTypedAssociationItem>',context!)
    };

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

class CreditCardChargeVerificationResult implements IConvertible
{
    bool? NetworkVerificationAttempted;
    String? CvvVerificationResult;
    String? AddressVerificationResult;
    String? PostalCodeVerificationResult;

    CreditCardChargeVerificationResult({this.NetworkVerificationAttempted,this.CvvVerificationResult,this.AddressVerificationResult,this.PostalCodeVerificationResult});
    CreditCardChargeVerificationResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        NetworkVerificationAttempted = json['NetworkVerificationAttempted'];
        CvvVerificationResult = json['CvvVerificationResult'];
        AddressVerificationResult = json['AddressVerificationResult'];
        PostalCodeVerificationResult = json['PostalCodeVerificationResult'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'NetworkVerificationAttempted': NetworkVerificationAttempted,
        'CvvVerificationResult': CvvVerificationResult,
        'AddressVerificationResult': AddressVerificationResult,
        'PostalCodeVerificationResult': PostalCodeVerificationResult
    };

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

class CreditCardChargeDetails implements IConvertible
{
    String? CardType;
    int? ExpMonth;
    int? ExpYear;
    String? Last4;
    CreditCardBillingAddressItem? Address;
    CreditCardChargeVerificationResult? VerificationResult;

    CreditCardChargeDetails({this.CardType,this.ExpMonth,this.ExpYear,this.Last4,this.Address,this.VerificationResult});
    CreditCardChargeDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CardType = json['CardType'];
        ExpMonth = json['ExpMonth'];
        ExpYear = json['ExpYear'];
        Last4 = json['Last4'];
        Address = JsonConverters.fromJson(json['Address'],'CreditCardBillingAddressItem',context!);
        VerificationResult = JsonConverters.fromJson(json['VerificationResult'],'CreditCardChargeVerificationResult',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CardType': CardType,
        'ExpMonth': ExpMonth,
        'ExpYear': ExpYear,
        'Last4': Last4,
        'Address': JsonConverters.toJson(Address,'CreditCardBillingAddressItem',context!),
        'VerificationResult': JsonConverters.toJson(VerificationResult,'CreditCardChargeVerificationResult',context!)
    };

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

class AchChargeVerificationResult implements IConvertible
{
    bool? NetworkVerificationAttempted;
    String? Result;

    AchChargeVerificationResult({this.NetworkVerificationAttempted,this.Result});
    AchChargeVerificationResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

    Map<String, dynamic> toJson() => {
        'NetworkVerificationAttempted': NetworkVerificationAttempted,
        'Result': Result
    };

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

class AchChargeDetails implements IConvertible
{
    String? AccountType;
    String? RoutingNumber;
    String? AccountNumberLast4;
    String? BankName;
    AchChargeVerificationResult? VerificationResult;

    AchChargeDetails({this.AccountType,this.RoutingNumber,this.AccountNumberLast4,this.BankName,this.VerificationResult});
    AchChargeDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        AccountType = json['AccountType'];
        RoutingNumber = json['RoutingNumber'];
        AccountNumberLast4 = json['AccountNumberLast4'];
        BankName = json['BankName'];
        VerificationResult = JsonConverters.fromJson(json['VerificationResult'],'AchChargeVerificationResult',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'AccountType': AccountType,
        'RoutingNumber': RoutingNumber,
        'AccountNumberLast4': AccountNumberLast4,
        'BankName': BankName,
        'VerificationResult': JsonConverters.toJson(VerificationResult,'AchChargeVerificationResult',context!)
    };

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

class ChargeTokenRs implements IConvertible
{
    String? Token;
    int? OrganizationId;
    int? ChapterId;
    int? Amount;
    String? TokenType;
    String? Description;
    DateTime? ExpiresOn;
    String? Currency;
    int? Usages;
    CreditCardChargeDetails? CardDetails;
    AchChargeDetails? AchDetails;

    ChargeTokenRs({this.Token,this.OrganizationId,this.ChapterId,this.Amount,this.TokenType,this.Description,this.ExpiresOn,this.Currency,this.Usages,this.CardDetails,this.AchDetails});
    ChargeTokenRs.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Token = json['Token'];
        OrganizationId = json['OrganizationId'];
        ChapterId = json['ChapterId'];
        Amount = json['Amount'];
        TokenType = json['TokenType'];
        Description = json['Description'];
        ExpiresOn = JsonConverters.fromJson(json['ExpiresOn'],'DateTime',context!);
        Currency = json['Currency'];
        Usages = json['Usages'];
        CardDetails = JsonConverters.fromJson(json['CardDetails'],'CreditCardChargeDetails',context!);
        AchDetails = JsonConverters.fromJson(json['AchDetails'],'AchChargeDetails',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'Token': Token,
        'OrganizationId': OrganizationId,
        'ChapterId': ChapterId,
        'Amount': Amount,
        'TokenType': TokenType,
        'Description': Description,
        'ExpiresOn': JsonConverters.toJson(ExpiresOn,'DateTime',context!),
        'Currency': Currency,
        'Usages': Usages,
        'CardDetails': JsonConverters.toJson(CardDetails,'CreditCardChargeDetails',context!),
        'AchDetails': JsonConverters.toJson(AchDetails,'AchChargeDetails',context!)
    };

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

class ChargeTokenRq extends ChargeTokenRqBase implements IConvertible
{
    ChargeTokenRq();
    ChargeTokenRq.fromJson(Map<String, dynamic> json) : super.fromJson(json);
    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson();
    getTypeName() => "ChargeTokenRq";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'devapi.billhighway.com', types: <String, TypeInfo> {
    'ChargeTokenOptions': TypeInfo(TypeOf.Class, create:() => ChargeTokenOptions()),
    'AttributeItem': TypeInfo(TypeOf.Class, create:() => AttributeItem()),
    'CreditCardBillingAddressItem': TypeInfo(TypeOf.Class, create:() => CreditCardBillingAddressItem()),
    'List<AttributeItem>': TypeInfo(TypeOf.Class, create:() => <AttributeItem>[]),
    'CreditCardChargeItem': TypeInfo(TypeOf.Class, create:() => CreditCardChargeItem()),
    'AchChargeItem': TypeInfo(TypeOf.Class, create:() => AchChargeItem()),
    'ReferenceIdTypedAssociationItem': TypeInfo(TypeOf.Class, create:() => ReferenceIdTypedAssociationItem()),
    'ChargeTokenRqBase': TypeInfo(TypeOf.AbstractClass),
    'List<ReferenceIdTypedAssociationItem>': TypeInfo(TypeOf.Class, create:() => <ReferenceIdTypedAssociationItem>[]),
    'CreditCardChargeVerificationResult': TypeInfo(TypeOf.Class, create:() => CreditCardChargeVerificationResult()),
    'CreditCardChargeDetails': TypeInfo(TypeOf.Class, create:() => CreditCardChargeDetails()),
    'AchChargeVerificationResult': TypeInfo(TypeOf.Class, create:() => AchChargeVerificationResult()),
    'AchChargeDetails': TypeInfo(TypeOf.Class, create:() => AchChargeDetails()),
    'ChargeTokenRs': TypeInfo(TypeOf.Class, create:() => ChargeTokenRs()),
    'ChargeTokenRq': TypeInfo(TypeOf.Class, create:() => ChargeTokenRq()),
});

Dart ChargeTokenRq DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /integrations/api/{tokenType}/charge/token HTTP/1.1 
Host: devapi.billhighway.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"tokenType":"String","Amount":0,"Description":"String","Options":{"Usages":0,"Duration":0},"CardInfo":{"NameOnCard":"String","ExpMonth":0,"ExpYear":0,"CardNumber":"String","Cvv":"String","Address":{"Address1":"String","Address2":"String","City":"String","PostalCode":"String","Region":"String","Country":"String","Attributes":[{"Name":"String","Value":"String"}]}},"AchInfo":{"AccountNumber":"String","RoutingNumber":"String","AccountType":"String","AccountHolderName":"String"},"ReferenceIds":[{"Value":"String","Type":"String"}]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"Token":"String","OrganizationId":0,"ChapterId":0,"Amount":0,"TokenType":"String","Description":"String","ExpiresOn":"0001-01-01T00:00:00.0000000","Currency":"String","Usages":0,"CardDetails":{"CardType":"String","ExpMonth":0,"ExpYear":0,"Last4":"String","Address":{"Address1":"String","Address2":"String","City":"String","PostalCode":"String","Region":"String","Country":"String","Attributes":[{"Name":"String","Value":"String"}]},"VerificationResult":{"NetworkVerificationAttempted":false,"CvvVerificationResult":"String","AddressVerificationResult":"String","PostalCodeVerificationResult":"String"}},"AchDetails":{"AccountType":"String","RoutingNumber":"String","AccountNumberLast4":"String","BankName":"String","VerificationResult":{"NetworkVerificationAttempted":false,"Result":"String"}}}