Billhighway Cloud API

<back to all web services

CreateCardRef

The following routes are available for this service:
POST/api/creditcard/createcardrefCreates, records and returns a 'cardRef'Creates, records and returns a 'reference' to a credit card. This so called 'cardRef' can then be usedas an alternative value to pass to other credit card transactions such as Verfy or Sale potentially improving securityby not passing card numbers.
import 'package:servicestack/servicestack.dart';

class CreditCardCloudServiceResponse implements IHaveErrorField, IConvertible
{
    bool? IsDuplicate;
    bool? IsSuccessful;
    String? ErrorCode;
    String? Message;
    int? GatewayId;
    String? ConfirmationNumber;
    String? NetworkTransactionId;
    bool? IsError;

    CreditCardCloudServiceResponse({this.IsDuplicate,this.IsSuccessful,this.ErrorCode,this.Message,this.GatewayId,this.ConfirmationNumber,this.NetworkTransactionId,this.IsError});
    CreditCardCloudServiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        IsDuplicate = json['IsDuplicate'];
        IsSuccessful = json['IsSuccessful'];
        ErrorCode = json['ErrorCode'];
        Message = json['Message'];
        GatewayId = json['GatewayId'];
        ConfirmationNumber = json['ConfirmationNumber'];
        NetworkTransactionId = json['NetworkTransactionId'];
        IsError = json['IsError'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'IsDuplicate': IsDuplicate,
        'IsSuccessful': IsSuccessful,
        'ErrorCode': ErrorCode,
        'Message': Message,
        'GatewayId': GatewayId,
        'ConfirmationNumber': ConfirmationNumber,
        'NetworkTransactionId': NetworkTransactionId,
        'IsError': IsError
    };

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

class CreditCardType
{
    static const CreditCardType AmericanExpress = const CreditCardType._(0);
    static const CreditCardType Discover = const CreditCardType._(1);
    static const CreditCardType MasterCard = const CreditCardType._(2);
    static const CreditCardType Visa = const CreditCardType._(3);
    static const CreditCardType DinersClub = const CreditCardType._(4);
    static const CreditCardType DinersCartBlanche = const CreditCardType._(5);
    static const CreditCardType Unknown = const CreditCardType._(6);

    final int _value;
    const CreditCardType._(this._value);
    int get value => _value;
    static List<CreditCardType> get values => const [AmericanExpress,Discover,MasterCard,Visa,DinersClub,DinersCartBlanche,Unknown];
}

class CreateCardRefResponse extends CreditCardCloudServiceResponse implements IConvertible
{
    String? CardRef;
    CreditCardType? CardType;

    CreateCardRefResponse({this.CardRef,this.CardType});
    CreateCardRefResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        super.fromMap(json);
        CardRef = json['CardRef'];
        CardType = JsonConverters.fromJson(json['CardType'],'CreditCardType',context!);
        return this;
    }

    Map<String, dynamic> toJson() => super.toJson()..addAll({
        'CardRef': CardRef,
        'CardType': JsonConverters.toJson(CardType,'CreditCardType',context!)
    });

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

class CreateCardRef extends CreateCardRef implements IConvertible
{
    CreateCardRef();
    CreateCardRef.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() => "CreateCardRef";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'devapi.billhighway.com', types: <String, TypeInfo> {
    'CreditCardCloudServiceResponse': TypeInfo(TypeOf.Class, create:() => CreditCardCloudServiceResponse()),
    'CreditCardType': TypeInfo(TypeOf.Enum, enumValues:CreditCardType.values),
    'CreateCardRefResponse': TypeInfo(TypeOf.Class, create:() => CreateCardRefResponse()),
    'CreateCardRef': TypeInfo(TypeOf.Class, create:() => CreateCardRef()),
});

Dart CreateCardRef 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 /api/creditcard/createcardref HTTP/1.1 
Host: devapi.billhighway.com 
Accept: application/json
Content-Type: application/json
Content-Length: length

{"UserId":0,"GroupId":0,"Location":"String","CurrencyCode":"String","CardType":0,"NameOnCard":"String","CardNumber":"String","ExpirationMonth":0,"ExpirationYear":0,"ValidationNum":"String"}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"CardRef":"String","CardType":0,"IsDuplicate":false,"IsSuccessful":false,"ErrorCode":"String","Message":"String","GatewayId":0,"ConfirmationNumber":"String","NetworkTransactionId":"String","IsError":true}