public void BuildCreditCardDebitTests() { // Lifted from https://www.bluepay.com/developers/api-documentation/csharp/transactions/cancel-transaction/ const string accountId = "Merchant's Account ID Here"; const string secretKey = "Merchant's Secret Key Here"; const string mode = "TEST"; var payment = new BluePay ( accountId, secretKey, mode ); payment.SetCustomerInformation ( firstName: _firstName, lastName: _lastName, address1: _address1, address2: _address2, city: _city, state: _state, zip: _zip, country: _country, phone: _phone, email: _email ); payment.SetCCInformation ( ccNumber: _ccNumber, ccExpiration: _ccExpiration, cvv2: _cvv2 ); // Sale Amount: $3.00 payment.Sale(amount: "3.00"); var legacyPostData = payment.Process(); var bpFactory = new BluePayTransactionFactory(accountId, secretKey, mode); var threadSafeReplacement = bpFactory.BuildCreditCardDebit( _firstName, _lastName, _address1, _address2, _city, _state, _zip, _country, _phone, _email, _ccNumber, _ccExpiration, _cvv2, _amount); Assert.AreEqual(legacyPostData, threadSafeReplacement.PostData); }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; string rebillID = "Rebill ID Here"; BluePay rebillData = new BluePay ( accountID, secretKey, mode ); // Find the rebill by ID and cancel rebilling cycle rebillData.GetRebillStatus(rebillID); // Makes the API Request rebillData.Process(); // Reads the responses from BluePay Console.WriteLine("Rebill Status: " + rebillData.GetStatus()); Console.WriteLine("Rebill ID: " + rebillData.GetRebillID()); Console.WriteLine("Rebill Creation Date: " + rebillData.GetCreationDate()); Console.WriteLine("Rebill Next Date: " + rebillData.GetNextDate()); Console.WriteLine("Rebill Schedule Expression: " + rebillData.GetSchedExpr()); Console.WriteLine("Rebill Cycles Remaining: " + rebillData.GetCyclesRemain()); Console.WriteLine("Rebill Amount: " + rebillData.GetRebillAmount()); }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay report = new BluePay ( accountID, secretKey, mode ); // Set Single Transaction Query parameters report.GetSingleTransQuery ( transactionID: "Transaction ID Here", reportStartDate: "2015-01-01", // YYYY-MM-DD; required reportEndDate: "2015-05-30", // YYYY-MM-DD; required errors: "1" // Do not include errored transactions? Yes; optional ); // Makes the API request with BluePay report.Process(); // Reads the response from BluePay Console.Write(report.response); }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay report = new BluePay ( accountID, secretKey, mode ); report.GetTransactionReport ( reportStartDate: "2015-01-01", // YYYY-MM-DD reportEndDate: "2015-05-30", // YYYY-MM-DD subaccountsSearched: "1", // Also search subaccounts? Yes doNotEscape: "1", // Output response without commas? Yes excludeErrors: "1" // Do not include errored transactions? Yes ); // Makes the API request with BluePay report.Process(); // Reads the reportesponse from BluePay Console.Write(report.response); }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay payment = new BluePay ( accountID, secretKey, mode ); payment.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", email: "*****@*****.**" ); payment.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1215", cvv2: "123" ); // Sale Amount: $3.00 payment.Sale(amount: "3.00"); // Makes the API Request with BluePay payment.Process(); // If transaction was successful reads the responses from BluePay if (payment.IsSuccessfulTransaction()) { Console.WriteLine("Transaction Status: " + payment.GetStatus()); Console.WriteLine("Transaction ID: " + payment.GetTransID()); Console.WriteLine("Transaction Message: " + payment.GetMessage()); Console.WriteLine("AVS Response: " + payment.GetAVS()); Console.WriteLine("CVV2 Response: " + payment.GetCVV2()); Console.WriteLine("Masked Payment Account: " + payment.GetMaskedPaymentAccount()); Console.WriteLine("Card Type: " + payment.GetCardType()); Console.WriteLine("Authorization Code: " + payment.GetAuthCode()); } else { Console.WriteLine("Error: " + payment.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay payment = new BluePay ( accountID, secretKey, mode ); payment.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", email: "*****@*****.**" ); payment.SetACHInformation ( routingNum: "123123123", accountNum: "123456789", accountType: "C", docType: "WEB" ); // Sale Amount: $3.00 payment.Sale(amount: "3.00"); // Makes the API Request with BluePay payment.Process(); // If transaction was successful reads the responses from BluePay if (payment.IsSuccessfulTransaction()) { Console.WriteLine("Transaction ID: " + payment.GetTransID()); Console.WriteLine("Transaction Status: " + payment.GetStatus()); Console.WriteLine("Transaction Message: " + payment.GetMessage()); Console.WriteLine("Masked Payment Account: " + payment.GetMaskedPaymentAccount()); Console.WriteLine("Customer Bank Name: " + payment.GetBank()); } else { Console.WriteLine("Error: " + payment.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; string token = "Transaction ID Here"; BluePay payment = new BluePay ( accountID, secretKey, mode ); //payment.SetCustomerInformation //( // storedIndicator: "F", // storedType:"C", // storedId:"TESTID765456" //); // Set Sale Amount: $3.00. payment.Sale ( amount: "3.00", masterID: token // Transaction ID of a previous sale ); // Makes the API Request with BluePay payment.Process(); // If transaction was successful reads the responses from BluePay if (payment.IsSuccessfulTransaction()) { Console.WriteLine("Transaction Status: " + payment.GetStatus()); Console.WriteLine("Transaction ID: " + payment.GetTransID()); Console.WriteLine("Transaction Message: " + payment.GetMessage()); Console.WriteLine("AVS Response: " + payment.GetAVS()); Console.WriteLine("CVV2 Response: " + payment.GetCVV2()); Console.WriteLine("Masked Payment Account: " + payment.GetMaskedPaymentAccount()); Console.WriteLine("Card Type: " + payment.GetCardType()); Console.WriteLine("Authorization Code: " + payment.GetAuthCode()); //Console.WriteLine("Stored ID: " + payment.GetStoredId()); } else { Console.WriteLine("Error: " + payment.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay testURL = new BluePay ( accountID, secretKey, mode ); string generatedURL = testURL.GenerateURL ( merchantName: "Test Merchant", returnURL: "www.google.com", transactionType: "SALE", acceptDiscover: "Yes", acceptAmex: "Yes", amount: "99.99", protectAmount: "Yes", rebilling: "Yes", rebProtect: "Yes", rebAmount: "50", rebCycles: "12", rebStartDate: "1 MONTH", rebFrequency: "1 MONTH", customID1: "MyCustomID1.1234", protectCustomID1: "Yes", customID2: "MyCustomID2.12345678910", protectCustomID2: "Yes", paymentTemplate: "mobileform01", receiptTemplate: "defaultres2", receiptTempRemoteURL: "" ); Console.WriteLine("Hosted Payment Form URL: " + generatedURL); }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay rebill = new BluePay ( accountID, secretKey, mode ); rebill.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", email: "*****@*****.**" ); rebill.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1215", cvv2: "123" ); // Sets recurring payment rebill.SetRebillingInformation ( rebFirstDate: "2015-01-01", // Rebill Start Date: Jan. 1, 2015 rebExpr: "1 MONTH", // Rebill Frequency: 1 MONTH rebCycles: "12", // Rebill # of Cycles: 12 rebAmount: "15.00" // Rebill Amount: $15.00 ); // Sets a Card Authorization at $0.00 rebill.Auth(amount: "0.00"); // Makes the API Request rebill.Process(); // If transaction was successful reads the responses from BluePay if (rebill.IsSuccessfulTransaction()) { Console.WriteLine("Transaction ID: " + rebill.GetTransID()); Console.WriteLine("Rebill ID: " + rebill.GetRebillID()); Console.WriteLine("Transaction Status: " + rebill.GetStatus()); Console.WriteLine("Transaction Message: " + rebill.GetMessage()); Console.WriteLine("AVS Response: " + rebill.GetAVS()); Console.WriteLine("CVV2 Response: " + rebill.GetCVV2()); Console.WriteLine("Masked Payment Account: " + rebill.GetMaskedPaymentAccount()); Console.WriteLine("Card Type: " + rebill.GetCardType()); Console.WriteLine("Authorization Code: " + rebill.GetAuthCode()); } else { Console.WriteLine("Error: " + rebill.GetMessage()); } }
public void BuildAchDebitTests() { // Lifted from https://www.bluepay.com/developers/api-documentation/csharp/transactions/charge-customer/ const string accountId = "Merchant's Account ID Here"; const string secretKey = "Merchant's Secret Key Here"; const string mode = "TEST"; var payment = new BluePay ( accountId, secretKey, mode ); payment.SetCustomerInformation ( firstName: _firstName, lastName: _lastName, address1: _address1, address2: _address2, city: _city, state: _state, zip: _zip, country: _country, phone: _phone, email: _email ); const string routingNumber = "123123123"; const string accountNumber = "123456789"; const string accountType = "C"; const string docType = "WEB"; payment.SetACHInformation ( routingNum: routingNumber, accountNum: accountNumber, accountType: accountType, docType: docType ); payment.Sale(amount: "3.00"); var legacyPostData = payment.Process(); var bpFactory = new BluePayTransactionFactory(accountId, secretKey, mode); var threadSafeReplacement = bpFactory.BuildAchDebit( _firstName, _lastName, _address1, _address2, _city, _state, _zip, _country, _phone, _email, _amount, routingNumber, accountNumber); Assert.AreEqual(legacyPostData, threadSafeReplacement.PostData); }
public static void Main() { HttpListener listener = new HttpListener(); string secretKey = ""; string response = ""; try { // Listen for incoming data listener.Start(); } catch (HttpListenerException) { return; } while (listener.IsListening) { var context = listener.GetContext(); var body = new StreamReader(context.Request.InputStream).ReadToEnd(); byte[] b = Encoding.UTF8.GetBytes("ACK"); // Return HTTP Status of 200 to BluePay context.Response.StatusCode = 200; context.Response.KeepAlive = false; context.Response.ContentLength64 = b.Length; var output = context.Response.OutputStream; output.Write(b, 0, b.Length); // Get Reponse using (StreamReader reader = new StreamReader(output)) { response = reader.ReadToEnd(); } context.Response.Close(); } listener.Close(); NameValueCollection vals = HttpUtility.ParseQueryString(response); // Parse data into a NVP collection string transID = vals["trans_id"]; string transStatus = vals["trans_stats"]; string transType = vals["trans_type"]; string amount = vals["amount"]; string batchID = vals["batch_id"]; string batchStatus = vals["batch_status"]; string totalCount = vals["total_count"]; string totalAmount = vals["total_amount"]; string batchUploadID = vals["batch_upload_id"]; string rebillID = vals["rebill_id"]; string rebillAmount = vals["rebill_amount"]; string rebillStatus = vals["rebill_status"]; // calculate the expected BP_STAMP string bpStamp = BluePay.CalcTransNotifyTPS(secretKey, vals["trans_id"], vals["trans_stats"], vals["trans_type"], vals["amount"], vals["batch_id"], vals["batch_status"], vals["total_count"], vals["total_amount"], vals["batch_upload_id"], vals["rebill_id"], vals["rebill_amount"], vals["rebill_status"]); // Output data if the expected BP_STAMP matches the actual BP_STAMP if (bpStamp == vals["BP_STAMP"]) { Console.Write("Transaction ID: " + transID); Console.Write("Transaction Status: " + transStatus); Console.Write("Transaction Type: " + transType); Console.Write("Transaction Amount: " + amount); Console.Write("Rebill ID: " + rebillID); Console.Write("Rebill Amount: " + rebillAmount); Console.Write("Rebill Status: " + rebillStatus); } else { Console.Write("ERROR IN RECEIVING DATA FROM BLUEPAY"); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay tps = new BluePay ( accountID, secretKey, mode ); HttpListener listener = new HttpListener(); string response = ""; try { // Listen for incoming data listener.Start(); } catch (HttpListenerException) { return; } while (listener.IsListening) { var context = listener.GetContext(); var body = new StreamReader(context.Request.InputStream).ReadToEnd(); byte[] b = Encoding.UTF8.GetBytes("ACK"); // Return HTTP Status of 200 to BluePay context.Response.StatusCode = 200; context.Response.KeepAlive = false; context.Response.ContentLength64 = b.Length; var output = context.Response.OutputStream; output.Write(b, 0, b.Length); // Get Reponse using (StreamReader reader = new StreamReader(output)) { response = reader.ReadToEnd(); } context.Response.Close(); } listener.Close(); NameValueCollection vals = HttpUtility.ParseQueryString(response); // Parse data into a NVP collection string transID = vals["trans_id"]; string transStatus = vals["trans_stats"]; string transType = vals["trans_type"]; string amount = vals["amount"]; string rebillID = vals["rebill_id"]; string rebillAmount = vals["rebill_amount"]; string rebillStatus = vals["rebill_status"]; string tpsHashType = vals["TPS_HASH_TYPE"]; string bpStamp = vals["BP_STAMP"]; string bpStampDef = vals["BP_STAMP_DEF"]; // calculate the expected BP_STAMP string bpStampString = ""; string[] defSeparator = new string[] { " " }; string[] bpStampFields = bpStampDef.Split(defSeparator, StringSplitOptions.RemoveEmptyEntries); foreach (string field in bpStampFields) { bpStampString += vals[field]; } string expectedStamp = tps.GenerateTPS(bpStampString, tpsHashType); // Output data if the expected BP_STAMP matches the actual BP_STAMP if (expectedStamp == bpStamp) { Console.Write("Transaction ID: " + transID); Console.Write("Transaction Status: " + transStatus); Console.Write("Transaction Type: " + transType); Console.Write("Transaction Amount: " + amount); Console.Write("Rebill ID: " + rebillID); Console.Write("Rebill Amount: " + rebillAmount); Console.Write("Rebill Status: " + rebillStatus); } else { Console.Write("ERROR IN RECEIVING DATA FROM BLUEPAY"); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; string prefix = "Merchant's Target URI Prefix Here" // Set the listener URI (and port if necessary) HttpListener listener = new HttpListener(); listener.Prefixes.Add(prefix); try { // Listen for incoming data listener.Start(); } catch (HttpListenerException) { return; } while (listener.IsListening) { var context = listener.GetContext(); NameValueCollection responsePairs = context.Request.QueryString; string msg; if (responsePairs["BP_STAMP"] != null) // Check whether BP_STAMP is provided { BluePay bp = new BluePay ( accountID, secretKey, mode ); string bpStampString = ""; string[] defSeparator = new string[] { " " }; string[] bpStampFields = responsePairs["BP_STAMP_DEF"].Split(defSeparator, StringSplitOptions.RemoveEmptyEntries); // Split BP_STAMP_DEF on whitespace foreach (string field in bpStampFields) { bpStampString += responsePairs[field]; // Concatenate values used to calculate expected BP_STAMP } string expectedStamp = bp.GenerateTPS(bpStampString, responsePairs["TPS_HASH_TYPE"]); // Calculate expected BP_STAMP using hash function specified in response if (expectedStamp == responsePairs["BP_STAMP"]) // Compare expected BP_STAMP with received BP_STAMP { // Validate BP_STAMP and reads the response results msg = "VALID BP_STAMP: TRUE\n"; foreach (string key in responsePairs) { msg += (key + ": " + responsePairs[key] + "\n"); } } else { msg = "ERROR: BP_STAMP VALUES DO NOT MATCH\n"; } } else { msg = "ERROR: BP_STAMP NOT FOUND. CHECK MESSAGE & RESPONSEVERSION"; } context.Response.ContentLength64 = Encoding.UTF8.GetByteCount(msg); context.Response.StatusCode = 200; using (Stream stream = context.Response.OutputStream) { using (StreamWriter writer = new StreamWriter(stream)) { writer.Write(msg); } } } listener.Close(); }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay payment = new BluePay ( accountID, secretKey, mode ); payment.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", email: "*****@*****.**" ); payment.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1225", cvv2: "123" ); // Optional fields users can set payment.SetCustomID1("12345"); // Custom ID1: 12345 payment.SetCustomID2("09866"); // Custom ID2: 09866 payment.SetInvoiceID("500000"); // Invoice ID: 50000 payment.SetOrderID("10023145"); // Order ID: 10023145 payment.SetAmountTip("6.00"); // Tip Amount: $6.00 payment.SetAmountTax("3.50"); // Tax Amount: $3.50 payment.SetAmountFood("3.11"); // Food Amount: $3.11 payment.SetAmountMisc("5.00"); // Miscellaneous Amount: $5.00 payment.SetMemo("Enter any comments about the transaction here."); // Comments // Set Sale amount payment.Sale("15.00"); // Makes the API Request with BluePay payment.Process(); // If transaction was successful reads the responses from BluePay if (payment.IsSuccessfulTransaction()) { Console.WriteLine("Transaction Status: " + payment.GetStatus()); Console.WriteLine("Transaction ID: " + payment.GetTransID()); Console.WriteLine("Transaction Message: " + payment.GetMessage()); Console.WriteLine("AVS Response: " + payment.GetAVS()); Console.WriteLine("CVV2 Response: " + payment.GetCVV2()); Console.WriteLine("Masked Payment Account: " + payment.GetMaskedPaymentAccount()); Console.WriteLine("Card Type: " + payment.GetCardType()); Console.WriteLine("Authorization Code: " + payment.GetAuthCode()); } else { Console.WriteLine("Error: " + payment.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay payment = new BluePay ( accountID, secretKey, mode ); payment.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", //storedIndicator: "F", //storedType:"C", //storedId:"TESTID765456", email: "*****@*****.**" ); payment.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1225", cvv2: "123" ); // Set Level 2 Information payment.SetInvoiceID("123456789"); payment.SetAmountTax("0.91"); // Set Level 3 line item information. Repeat for each item up to 99. payment.AddLineItem ( quantity: "1", // The number of units of item. Max: 5 digits unitCost: "3.00", // The cost per unit of item. Max: 9 digits decimal descriptor: "test1", //Description of the item purchased. Max: 26 character commodityCode: "123412341234", // Commodity Codes can be found at http://www.census.gov/svsd/www/cfsdat/2002data/cfs021200.pdf. Max: 12 characters productCode: "432143214321", // Merchant-defined code for the product or service being purchased. Max: 12 characters measureUnits: "EA", // The unit of measure of the item purchase. Normally EA. Max: 3 characters taxRate: "7%", // Tax rate for the item. Max: 4 digits taxAmount: "0.21", // Tax amount for the item. unit_cost * quantity * tax_rate = tax_amount. Max: 9 digits. itemDiscount: "0.00", // The amount of any discounts on the item. Max: 12 digits. lineItemTotal: "3.21" // The total amount for the item including taxes and discounts. ); payment.AddLineItem ( quantity: "2", unitCost: "5.00", descriptor: "test2", commodityCode: "123412341234", productCode: "098709870987", measureUnits: "EA", taxRate: "7%", taxAmount: "0.70", itemDiscount: "0.00", lineItemTotal: "10.70" ); // Sale Amount: $13.91 payment.Sale(amount: "13.91"); // Makes the API Request with BluePay payment.Process(); // If transaction was successful reads the responses from BluePay if (payment.IsSuccessfulTransaction()) { Console.WriteLine("Transaction Status: " + payment.GetStatus()); Console.WriteLine("Transaction ID: " + payment.GetTransID()); Console.WriteLine("Transaction Message: " + payment.GetMessage()); Console.WriteLine("AVS Response: " + payment.GetAVS()); Console.WriteLine("CVV2 Response: " + payment.GetCVV2()); Console.WriteLine("Masked Payment Account: " + payment.GetMaskedPaymentAccount()); Console.WriteLine("Card Type: " + payment.GetCardType()); Console.WriteLine("Authorization Code: " + payment.GetAuthCode()); //Console.WriteLine("Stored ID: " + payment.GetStoredId()); } else { Console.WriteLine("Error: " + payment.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay rebill = new BluePay ( accountID, secretKey, mode ); rebill.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", email: "*****@*****.**" ); rebill.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1215", cvv2: "123" ); // Set recurring payment rebill.SetRebillingInformation ( rebFirstDate: "2015-01-01", // Rebill Start Date: Jan. 1, 2015 rebExpr: "1 MONTH", // Rebill Frequency: 1 MONTH rebCycles: "12", // Rebill # of Cycles: 12 rebAmount: "15.00" // Rebill Amount: $15.00 ); // Set a Card Authorization at $0.00 rebill.Auth(amount: "0.00"); // Makes the API Request rebill.Process(); // If transaction was approved.. if (rebill.IsSuccessfulTransaction()) { BluePay rebillStatus = new BluePay ( accountID, secretKey, mode ); // Find the rebill by ID and get rebill status rebillStatus.GetRebillStatus(rebill.GetRebillID()); // Makes the API Request rebillStatus.Process(); // Reads the responses from BluePay Console.WriteLine("Rebill Status: " + rebillStatus.GetStatus()); Console.WriteLine("Rebill ID: " + rebillStatus.GetRebillID()); Console.WriteLine("Rebill Creation Date: " + rebillStatus.GetCreationDate()); Console.WriteLine("Rebill Next Date: " + rebillStatus.GetNextDate()); Console.WriteLine("Rebill Last Date: " + rebillStatus.GetLastDate()); Console.WriteLine("Rebill Schedule Expression: " + rebillStatus.GetSchedExpr()); Console.WriteLine("Rebill Cycles Remaining: " + rebillStatus.GetCyclesRemain()); Console.WriteLine("Rebill Amount: " + rebillStatus.GetRebillAmount()); Console.WriteLine("Rebill Next Amount: " + rebillStatus.GetNextAmount()); } else { Console.WriteLine(rebill.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay token = new BluePay ( accountID, secretKey, mode ); token.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", //storedIndicator: "F", //storedType:"C", //storedId:"TESTID765456", email: "*****@*****.**" ); token.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1225", cvv2: "123" ); // Card Authorization Amount: $0.00 token.Auth( amount: "0.00", newCustomerToken: "029384230984" // "true" generates random string. Other values will be used literally ); // Makes the API Request with BluePay token.Process(); // Try again if we accidentally create a non-unique token if (token.GetMessage().Contains("Customer%20Tokens%20must%20be%20unique")) { token.Auth( amount: "0.00", newCustomerToken: "true" ); token.Process(); } // If transaction was successful reads the responses from BluePay if (token.IsSuccessfulTransaction()) { BluePay payment = new BluePay ( accountID, secretKey, mode ); Console.WriteLine(token.GetCustomerToken()); payment.Sale( amount: "3.99", customerToken: token.GetCustomerToken() ); payment.Process(); if (payment.IsSuccessfulTransaction()) { Console.WriteLine("Transaction Status: " + payment.GetStatus()); Console.WriteLine("Transaction ID: " + payment.GetTransID()); Console.WriteLine("Transaction Message: " + payment.GetMessage()); Console.WriteLine("AVS Response: " + payment.GetAVS()); Console.WriteLine("CVV2 Response: " + payment.GetCVV2()); Console.WriteLine("Masked Payment Account: " + payment.GetMaskedPaymentAccount()); Console.WriteLine("Card Type: " + payment.GetCardType()); Console.WriteLine("Authorization Code: " + payment.GetAuthCode()); Console.WriteLine("Customer Token: " + payment.GetCustomerToken()); //Console.WriteLine("Stored ID: " + payment.GetStoredId()); } else { Console.WriteLine("Error: " + payment.GetMessage()); } } else { Console.WriteLine("Error: " + token.GetMessage()); } }
public static void Main() { string accountID = "Merchant's Account ID Here"; string secretKey = "Merchant's Secret Key Here"; string mode = "TEST"; BluePay rebill = new BluePay ( accountID, secretKey, mode ); rebill.SetCustomerInformation ( firstName: "Bob", lastName: "Tester", address1: "1234 Test St.", address2: "Apt #500", city: "Testville", state: "IL", zip: "54321", country: "USA", phone: "123-123-12345", email: "*****@*****.**" ); rebill.SetCCInformation ( ccNumber: "4111111111111111", ccExpiration: "1225", cvv2: "123" ); // Set recurring payment rebill.SetRebillingInformation ( rebFirstDate: "2015-01-01", // Rebill Start Date: Jan. 1, 2015 rebExpr: "1 MONTH", // Rebill Frequency: 1 MONTH rebCycles: "12", // Rebill # of Cycles: 12 rebAmount: "15.00" // Rebill Amount: $15.00 ); // Sets a Card Authorization at $0.00 rebill.Auth(amount: "0.00"); // Makes the API Request rebill.Process(); // If transaction was approved.. if (rebill.IsSuccessfulTransaction()) { BluePay paymentInformationUpdate = new BluePay ( accountID, secretKey, mode ); // Sets an updated credit card expiration date paymentInformationUpdate.SetCCInformation ( ccExpiration: "1229" ); // Stores new card expiration date paymentInformationUpdate.Auth ( amount: "0.00", masterID: rebill.GetRebillID() // the id of the rebill to update ); // Makes the API Request to update the payment information paymentInformationUpdate.Process(); // Creates a request to update the rebill BluePay rebillUpdate = new BluePay ( accountID, secretKey, mode ); // Updates the Rebill rebillUpdate.UpdateRebillingInformation ( rebillID: rebill.GetRebillID(), // The ID of the rebill to be updated. templateID: paymentInformationUpdate.GetTransID(), // Updates the payment information portion of the rebilling cycle with the new card expiration date entered above rebNextDate: "2015-03-01", // Rebill Start Date: March 1, 2015 rebExpr: "1 MONTH", // Rebill Frequency: 1 MONTH rebCycles: "8", // Rebill // of Cycles: 8 rebAmount: "5.15", // Rebill Amount: $5.15 rebNextAmount: "1.50" // Rebill Next Amount: $1.50 ); // Makes the API Request to update the rebill rebillUpdate.Process(); // Reads the responses from BluePay Console.WriteLine("Rebill Status: " + rebillUpdate.GetStatus()); Console.WriteLine("Rebill ID: " + rebillUpdate.GetRebillID()); Console.WriteLine("Rebill Creation Date: " + rebillUpdate.GetCreationDate()); Console.WriteLine("Rebill Next Date: " + rebillUpdate.GetNextDate()); Console.WriteLine("Rebill Schedule Expression: " + rebillUpdate.GetSchedExpr()); Console.WriteLine("Rebill Cycles Remaining: " + rebillUpdate.GetCyclesRemain()); Console.WriteLine("Rebill Amount: " + rebillUpdate.GetRebillAmount()); } else { Console.WriteLine(rebill.GetMessage()); } }