Bluefin .NET API allow to process different payment tenders: credit, debit cards, ACH, EFT or electronic checks, Electronic Benefit Transfer cards, Gift or stored value cards. Card information can be manually entered (keyed) or can be pasted from special devices - card swipers.
C# code snippets below illustrate use of Bluefin .NET API base operations for keyed card transactions for single account partner.
Instantiate appropriate request, fill it with customer data and call one of the Bluefin.Web.Client BluefinGateway methods. In ISV environment in order to instantiate requests utilize constructor with the instance of Bluefin.Data BluefinAccount.
![]() |
---|
If response failed, response.ErrorCode property brings numeric code of the error and response.ErrorMessage property explains the error reason |
In order to run credit card sale
Instantiate card transaction request Bluefin.Web.Client CardTransactionRequest, fill it with data and pass it to BluefinGateway.Transcation.Sale() method.
Upon return always check to see, if the transaction operation was successful
Assert.IsTrue(response.Success(), "Response.Success()");
Use properties of the response to obtain all transaction details. For example,
logString = ToLogString((Response)response, separator) + separator + "TransactionID : " + response.TransactionID + separator + "TenderType : " + response.TenderType + separator + "TransactionTimeStamp: " + response.TransactionTimestamp + separator + "AuthorizationCode : " + response.AuthorizationCode + separator + "AuthorizationMessage: " + response.AuthorizationMessage + separator + "Amount : " + (response.Amount == null ? "Not Set" : response.Amount.ToString()) + separator + "AVSResponse : " + response.AVSResponse + separator + "LastFour : " + response.LastFour + separator + "Description : " + response.Description + separator + "Approved : " + response.Approved + separator + "Keyed : " + response.Keyed + separator + "Swiped : " + response.Swiped + separator + "Person : " + ToLogString(response.Person, separator) + separator + "CardExpiration : " + response.CardExpiration + separator + "CardBrand : " + response.CardBrand + separator + "CVVResponse : " + response.CVVResponse ;
In order to authorize (holds) the funds on the card
Instantiate card transaction request Bluefin.Web.Client CardTransactionRequest, fill it with data and pass it to BluefinGateway.Transcation.Authorize() method.
CardTransactionRequest ctr = new CardTransactionRequest(); ctr.Amount = 176.58; ctr.Description = "Test transaction"; ctr.CardNumber = "4444333322221111"; ctr.CardExpiration = "0315"; ctr.CardVerification = "315"; CardTransactionResponse response = BluefinPaymentGateway.Transaction.Authorize(ctr);
Upon return always check to see, if the transaction operation was successful
Use properties of the response to obtain all transaction details. For example,
if (!response.Success()) return ToLogString((Response)response, separator); return ToLogString((TransactionResponse)response, separator) + separator + "CardExpiration : " + response.CardExpiration + separator + "CardBrand : " + response.CardBrand + separator + "CVVResponse : " + response.CVVResponse ;
Post Capture request
if transaction was authorized successfully. It will flag the transaction for settlement at the next settlement time. In order to do that instantiate capture transaction request Bluefin.Web.Client CaptureTransactionRequest with authorized transaction id and pass it to BluefinGateway.Transcation.Capture() method.
CaptureTransactionRequest request = new CaptureTransactionRequest(authorizedTransactionID); // Please notice, that Capture() returns: // instance of TransactionResponse, if tr.TenderType == null or // instance of CardTransactionResponse, if tr.TenderType == TenderType.CARD or // instance of CheckTransactionResponse, if tr.TenderType == TenderType.ACH TransactionResponse response = BluefinGateway.Transaction.Capture(request);
Upon return always check to see, if the transaction operation was successful
Use properties of the response to obtain all transaction details. For example,
// Cast returned object, if desired if (response.TenderType == TenderType.CARD) { Console.WriteLine("Card Response ..." + LogHelper.ToLogString((CardTransactionResponse)response, "\n\t")); } else if (response.TenderType == TenderType.ACH) { Console.WriteLine("Check Response ..." + LogHelper.ToLogString((CheckTransactionResponse)response, "\n\t")); } else { Console.WriteLine("No tender Response ..." + LogHelper.ToLogString(response, "\n\t")); }