| POST | /integrations/api/v2/{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 CreditCardChargeDetailsV2 implements IConvertible
{
String? CardType;
int? ExpMonth;
int? ExpYear;
String? Last4;
CreditCardBillingAddressItem? Address;
CreditCardChargeDetailsV2({this.CardType,this.ExpMonth,this.ExpYear,this.Last4,this.Address});
CreditCardChargeDetailsV2.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!);
return this;
}
Map<String, dynamic> toJson() => {
'CardType': CardType,
'ExpMonth': ExpMonth,
'ExpYear': ExpYear,
'Last4': Last4,
'Address': JsonConverters.toJson(Address,'CreditCardBillingAddressItem',context!)
};
getTypeName() => "CreditCardChargeDetailsV2";
TypeContext? context = _ctx;
}
class AchChargeDetailsV2 implements IConvertible
{
String? AccountType;
String? RoutingNumber;
String? AccountNumberLast4;
String? BankName;
AchChargeDetailsV2({this.AccountType,this.RoutingNumber,this.AccountNumberLast4,this.BankName});
AchChargeDetailsV2.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
AccountType = json['AccountType'];
RoutingNumber = json['RoutingNumber'];
AccountNumberLast4 = json['AccountNumberLast4'];
BankName = json['BankName'];
return this;
}
Map<String, dynamic> toJson() => {
'AccountType': AccountType,
'RoutingNumber': RoutingNumber,
'AccountNumberLast4': AccountNumberLast4,
'BankName': BankName
};
getTypeName() => "AchChargeDetailsV2";
TypeContext? context = _ctx;
}
class ChargeTokenV2Rs implements IConvertible
{
String? Token;
int? Amount;
String? TokenType;
String? Description;
DateTime? ExpiresOn;
String? Currency;
int? Usages;
CreditCardChargeDetailsV2? CardDetails;
AchChargeDetailsV2? AchDetails;
ChargeTokenV2Rs({this.Token,this.Amount,this.TokenType,this.Description,this.ExpiresOn,this.Currency,this.Usages,this.CardDetails,this.AchDetails});
ChargeTokenV2Rs.fromJson(Map<String, dynamic> json) { fromMap(json); }
fromMap(Map<String, dynamic> json) {
Token = json['Token'];
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'],'CreditCardChargeDetailsV2',context!);
AchDetails = JsonConverters.fromJson(json['AchDetails'],'AchChargeDetailsV2',context!);
return this;
}
Map<String, dynamic> toJson() => {
'Token': Token,
'Amount': Amount,
'TokenType': TokenType,
'Description': Description,
'ExpiresOn': JsonConverters.toJson(ExpiresOn,'DateTime',context!),
'Currency': Currency,
'Usages': Usages,
'CardDetails': JsonConverters.toJson(CardDetails,'CreditCardChargeDetailsV2',context!),
'AchDetails': JsonConverters.toJson(AchDetails,'AchChargeDetailsV2',context!)
};
getTypeName() => "ChargeTokenV2Rs";
TypeContext? context = _ctx;
}
class ChargeTokenV2Rq extends ChargeTokenRqBase implements IConvertible
{
ChargeTokenV2Rq();
ChargeTokenV2Rq.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() => "ChargeTokenV2Rq";
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>[]),
'CreditCardChargeDetailsV2': TypeInfo(TypeOf.Class, create:() => CreditCardChargeDetailsV2()),
'AchChargeDetailsV2': TypeInfo(TypeOf.Class, create:() => AchChargeDetailsV2()),
'ChargeTokenV2Rs': TypeInfo(TypeOf.Class, create:() => ChargeTokenV2Rs()),
'ChargeTokenV2Rq': TypeInfo(TypeOf.Class, create:() => ChargeTokenV2Rq()),
});
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /integrations/api/v2/{tokenType}/charge/token HTTP/1.1
Host: devapi.billhighway.com
Accept: text/csv
Content-Type: text/csv
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: text/csv
Content-Length: length
{"Token":"String","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"}]}},"AchDetails":{"AccountType":"String","RoutingNumber":"String","AccountNumberLast4":"String","BankName":"String"}}