Payment results

The system stores payment results in XML format, which represents the CMS.Ecommerce.PaymentResultInfo object. Each payment result XML node is equal to a single payment result item, which represents the CMS.Ecommerce.PaymentResultItemInfo object.

Base payment result items include:

  • Payment date - specifies the date and time when the payment result was last updated.
  • Payment method - indicates the payment method that was used for payment.
  • Payment is completed - indicates whether the payment is already completed.
  • Payment status - indicates the status of the payment, e.g. Completed, Failed, etc. (your custom status).
  • Payment transaction ID - represents a unique identifier for a completed payment generated by a payment gateway.
  • Payment description - describes the payment result in more details.

Payment result item properties include:

  • Name - represents a unique identifier of the payment result item.
  • Header - represents the name of the payment result item visible to the users (simple text or localizable string).
  • Text - determines the outer representation of the payment result item value visible to the users (simple text or localizable string).
  • Value - determines the inner representation of the payment result item value used by developers.

Example - Order payment result XML definition

The following example shows an XML definition of an order payment result extended by the authorizationcode item used by Authorize.NET:

    <item name="date" header="{$PaymentGateway.Result.Date$}" value="1/27/2008 5:01:41 PM" />
    <item name="method" header="{$PaymentGateway.Result.PaymentMethod$}" text="Credit card" value="230" />
    <item name="completed" header="{$PaymentGateway.Result.IsCompleted$}" value="1" text="{$PaymentGateway.Result.PaymentCompleted$}" />
    <item name="status" header="{$PaymentGateway.Result.Status$}" text="{$PaymentGateway.Result.Status.Completed$}" value="completed" />
    <item name="transactionid" header="{$PaymentGateway.Result.TransactionID$}" value="0" />
    <item name="description" header="{$PaymentGateway.Result.Description$}" />
    <item name="authorizationcode" header="{$AuthorizeNet.AuthorizationCode$}" value="000000" />

Example - Order payment result available in the Orders application

The following example shows a payment result visible to your on-line store administrators in the Orders application while editing a selected order on the Billing tab:

Date: 1/27/2008 5:01:41 PM
Method: Credit card
Is completed: YES
Status: Completed
Transaction ID: 0
Authorization code: 000000

The payment result is unavailable (N/A) until the payment gateway processor updates it.

You needn’t specify both item value and item text if they are identical. This is because the method rendering the payment result can manage this. The method renders the result as follows:

  1. Try to render item text.
  2. If not found, try to render item value.

Customizing payment results

You can use the PaymentResultInfo properties to get and set the item text or item value:

  • PaymentDate
  • PaymentMethodID
  • PaymentMethodName
  • PaymentIsCompleted
  • PaymentStatusName
  • PaymentStatusCode
  • PaymentTransactionID

You need to use the GetPaymentResultItemInfo(string itemName)* and SetPaymentResultItemInfo(PaymentResultItemInfo itemObj*) public methods to get and set your custom payment result items.

The following examples demonstrate how you can get and set a custom payment result item while having the payment processed by your custom payment gateway provider.

Example - Setting authorization code

using CMS.Ecommerce;


// Sets the authorization code
PaymentResultItemInfo item = new PaymentResultItemInfo();
item.Header = "{$AuthorizeNet.AuthorizationCode$}";
item.Name = "authorizationcode";
item.Value = "00000";

Example - Getting authorization code

using CMS.Ecommerce;


// Gets the authorization code
PaymentResultItemInfo item = this.PaymentResult.GetPaymentResultItemInfo("authorizationcode");