Confirmation Page for Pre-Authorized transaction

As a merchant, you have to provide your own web page to invoke the web service <PreAuthorizedPaymentAccept> to accept your pre-authorized payments.

 

Pre-Authorized Transaction Summary
Transaction ID TransactionId not found!
Transaction Amount 0 oz
Transaction Pre-Authorized by the customer? False
Payment Accepted by merchant (you)? False
Process the transaction / accept payment
by invoking the web service
<PreAuthorizedPaymentAccept>

Press [Accept Payment] button to collect your gold payment.
If the button is disabled, it means one of the following:
1) The payment was not approved by your customer
2) The payment was already accepted by the merchant (you)

 

Source Code Sample #1

The following is a code snipet to accept the payment of a pre-authorized transaction:

 

System.Net.WebClient client = new System.Net.WebClient(); string response = client.UploadString("http://demo.igolder.com/api.ashx", @"<PreAuthorizedPaymentAccept> <SubAccountId></SubAccountId> <SecurityTokenId></SecurityTokenId> <TransactionId></TransactionId> </PreAuthorizedPaymentAccept>");

 

Source Code Sample #2 in C#

The following sample code sends a confirmation email to the customer with a registration key.  If an error occurred, the error message is displayed to the user and a link is displayed to redirect the customer to purchase the product.

 

using System; using System.Xml; public partial class Confirmation : System.Web.UI.Page { public const string iGolderServer = "http://demo.igolder.com"; // Use "https://www.igolder.com" for live transfers private string strSubAccountId = "5e83571e68d04c90acdf3251245ab453"; // Enter your SubAccountId here private string strSecurityTokenId = "08aefdc7c72c41352319575ab36e26c6"; // Enter your SecurityTokenId here protected void Page_Load(object sender, EventArgs e) { // Get the TransactionId from the URL. The TransactionId is automatically appended by iGolder to the return URL (UrlReturn). string strTransactionId = Request.QueryString["TransactionId"]; // If you have a database, you may use the TransactionId and fetch the customer information. // In our case, we stored the customer information (name and email) in the query string of the URL. string strName = Request.QueryString["Name"]; string strEmail = Request.QueryString["Email"]; Response.Write(string.Format("Dear {0}, <br />", strName)); // Call the web service <PreAuthorizedPaymentAccept> to accept the pre-authorized payment and collect the gold. // This web service will transfer the gold from the customer's account into your account. // You may optionally include the <AmountGold></AmountGold> to specify how much gold you wish to // transfer to your account. The gold amount must be equal or less than the requested amount // when you invoked the web service <PreAuthorizedPayment>. System.Net.WebClient client = new System.Net.WebClient(); string strXmlResponse = client.UploadString(iGolderServer + "/api.ashx", string.Format( @"<PreAuthorizedPaymentAccept> <SubAccountId>{0}</SubAccountId> <SecurityTokenId>{1}</SecurityTokenId> <TransactionId>{2}</TransactionId> </PreAuthorizedPaymentAccept>", strSubAccountId, strSecurityTokenId, strTransactionId)); // If the transfer was successful, there should be a node named <AmountGold> to confirm the gold transfer XmlDocument xmlResponse = new XmlDocument(); try { xmlResponse.LoadXml(strXmlResponse); XmlNode xmlNodeAmountGold = xmlResponse.SelectSingleNode("//AmountGold"); if (xmlNodeAmountGold != null) { string strAmountGold = xmlNodeAmountGold.InnerText; // The amount is in grams of gold // The payment is complete and you collected gold from your customer. // It is now your turn to deliver the product or service to your customer. // In this demo sample, we write a "Thank You" message to the customer and send him/her an email with the product registration key Response.Write("Thank you for purchasing product XYZ. An email message was sent to you with your registration key."); string strRegistrationKey = "123-456-789"; string strEmailSubject = string.Format("{0}, thank you for purchasing product XYZ - Your registration key is {1}", strName, strRegistrationKey); string strEmailBody = string.Format( @"Dear {0}, Thank you for purchasing product XYZ for {1} grams of gold. To install product XYZ, click on the link http://www.MyWebsite.com/InstallProductXYZ.exe and enter your registration key {2}.", strName, strAmountGold, strRegistrationKey); // Send the email to the customer. System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient("localhost"); smtp.Send("sales@MyWebsite.com", strEmail, strEmailSubject, strEmailBody); // For debugging purpose, display the whole XML response from ther server Response.Write(string.Format("<br /><br /><br /><hr />XML response from iGolder server:<br /><pre>{0}</pre>", System.Web.HttpUtility.HtmlEncode(strXmlResponse))); // For your records, you may wish to know when the gold payment will clear from Safetransit XmlNode xmlNodeDateSafetransitUntil = xmlResponse.SelectSingleNode("//DateSafetransitUntil"); if (xmlNodeDateSafetransitUntil != null) { string strDateSafetransitUntil = xmlNodeDateSafetransitUntil.InnerText; DateTime dateSafetransitUntil = DateTime.Parse(strDateSafetransitUntil); TimeSpan timeSafetransitRemaining = dateSafetransitUntil.Subtract(DateTime.UtcNow); Response.Write(string.Format("<br />DateSafetransitUntil: {0}, the payment of {1} grams of gold will clear in {2} hours", strDateSafetransitUntil, strAmountGold, timeSafetransitRemaining.TotalHours.ToString("N1"))); } return; } // if string strErrorDescription = null; string strUrlAction = null; // Action URL to fix the error string strHtmlUrlHelp = null; // HTML code containing the hyperlink to the technical documentation of the error // The pre-approved payment was not successful. In this case, we have to fetch the error code. XmlNode xmlNodeError = xmlResponse.SelectSingleNode("//Error"); if (xmlNodeError != null) { // There are four different nodes (see https://www.iGolder.com/developer/API-error-codes/#XML for documentation) XmlNode xmlNodeErrorCode = xmlNodeError.SelectSingleNode("ErrorCode"); // Just in case you need the numeric error code XmlNode xmlNodeErrorName = xmlNodeError.SelectSingleNode("ErrorName"); XmlNode xmlNodeErrorDescription = xmlNodeError.SelectSingleNode("ErrorDescription"); if (xmlNodeErrorName != null && xmlNodeErrorDescription != null) { strErrorDescription = xmlNodeErrorDescription.InnerText; string strErrorName = xmlNodeErrorName.InnerText; switch (strErrorName) { case "ErrTransactionNotApproved": // The customer rejected the transaction. To accept the transaction, click on the button "I authorize this payment" on the iGolder website. break; case "ErrTransactionAlreadyProcessed": // The merchant already processed your transaction and accepted your payment. This message is a protection so you are not billed twice for the same transaction. break; default: strErrorDescription = null; // Empty the error description and display strXmlResponse break; } // switch } // if XmlNode xmlNodeUrlAction = xmlNodeError.SelectSingleNode("UrlAction"); if (xmlNodeUrlAction != null) strUrlAction = xmlNodeUrlAction.InnerText; XmlNode xmlNodeUrlHelp = xmlNodeError.SelectSingleNode("UrlHelp"); if (xmlNodeUrlHelp != null) strHtmlUrlHelp = string.Format("<br />View Technical Documentation UrlHelp: <a href='{0}' target='_blank'>{0}</a>", xmlNodeUrlHelp.InnerText); } // if // We were unable to fetch the error description, so dump the whole XML response for debugging purpose if (strErrorDescription == null || strErrorDescription == "") strErrorDescription = System.Web.HttpUtility.HtmlEncode(strXmlResponse); // If there is no hyperlink supplied in the error, redirect the customer to the "Buy" page if (strUrlAction == null || strUrlAction == "") strUrlAction = "https://www.MyWebsite.com/buy/"; Response.Write(string.Format("Your iGolder payment could not be completed. Please try again at <a href='{0}'>{0}</a>" + "<br /><br />The server iGolder.com returned the following error:<br /><pre>{1}</pre>", strUrlAction, strErrorDescription)); // For debugging purpose, display the whole XML response from ther server Response.Write(string.Format("<br /><br /><br /><hr />XML response from iGolder server:<br /><pre>{0}</pre>{1}", System.Web.HttpUtility.HtmlEncode(strXmlResponse), strHtmlUrlHelp)); } catch (System.Xml.XmlException ex) { // We were unable to parse string strXmlResponse Response.Write(string.Format("Invalid XML response ({0}) from iGolder: {1}", ex.Message, System.Web.HttpUtility.HtmlEncode(strXmlResponse))); } } }

 

Download Automation Test Tool

You are welcome to download our Automation Test Tool which can invoke the web service <PreAuthorizedPaymentAccept> and display the values returned by the server iGolder.com.

 

Since August 1st, 2013 iGolder is no longer accepting new accounts and balances can only be redeemed. During the past years, we have been recommending Bitcoin more than our own payment system. We believe in physical gold ownership, and developed iGolder as a mechanism for people to acquire physical gold by trading with one another.

Since iGolder has a central point of failure (our server may be raided by thugs wearing some kind of uniform), we feet it is safer for us to cease operations. The iGolder experiment has been personally rewarding as we met many gold enthusiasts and also learned about Bitcoin in the process. For those who have no idea what Bitcoin is, we recommend doing your own research. Bitcoin is far superior to iGolder in every way, both in privacy and security as our server is always vulnerable to confiscation. Bitcoin is a communication protocol with a built-in "escrow service" capable of protecting both the buyer and the seller, rendering our Safetransit completely redundant. To learn more about the Bitcoin protocol and its feature, please watch "http://www.youtube.com/watch?v=mD4L7xDNCmA (Bitcoin 2012 London: Mike Hearn).

For those having gold in their iGolder account, we will ship the physical metal to anyone having more than 1 ounce of gold, assuming the owner is willing to assume the shipping costs. For smaller quantities, we offer to settle in Bitcoin, however we will also settle with any other reasonable payment system. We will give everyone at least two full years (until 2016) to contact us to claim their gold. After that period, any unclaimed gold will go to fund an economic development project in Honduras helping local people to become entrepreneurs.

We sincerely wish you the best in life and hope to keep in contact with you.

Yours in liberty,
The iGolder Team.


Update 2014: Since we announced we no longer accept gold transfers, we have received countless emails asking to keep the free gold charts and the PGP encryption tools. We plan to keep running the domain iGolder.com for both the gold charts and the encryption tools. Better, we are developing state of the art open-source software for a secure decentralized social network with a built-in wallet. We will announce when we have a product ready for use. Stay tuned!