Kentico CMS 7.0 E-commerce Guide

Payment results

Payment results

Previous topic Next topic Mail us feedback on this topic!  

Payment results

Previous topic Next topic JavaScript is required for the print function Mail us feedback on this topic!  

Payment results are stored in xml format, which is represented by the CMS.Ecommerce.PaymentResultInfo object. Each payment result xml node is equal to a single payment result item, which is represented by the CMS.Ecommerce.PaymentResultItemInfo object.

 

Base payment result items are:

 

Payment date - the date and time when the payment result was last updated.

Payment method - indicates the payment method which was used for payment.

Payment is completed - indicates whether payment is already completed.

Payment status - indicates the status of the payment, e.g. Completed, Failed, etc. (your custom status).

Payment transaction ID - a unique identifier for a completed payment generated by the payment gateway.

Payment description - describes the payment result in more details.

 

Payment result item properties are:

 

Name - a unique identifier of the item.

Header - a friendly name of the item visible to the user (simple text or localizable string).

Text - an outer representation of the item value visible to the user (simple text or localizable string).

Value - an inner representation of the item value used by developers.

 

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

 

<result>

 <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" />

</result>

 

The following example shows an order payment result which is visible to the user in CMS Desk:

 

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

 

InfoBox_Note

 

Please note

 

The order payment result remains empty until it is updated by the payment gateway processor.

 

You do not need to specify both item value and item text if they are identical because the payment result rendering method can manage this and renders payment result as follows: try to render item text, if not found, try to render item value.

 

 

How to customize payment results

 

You can use PaymentResultInfo properties to get or set a specified item text or value:

 

PaymentDate

PaymentMethodID

PaymentMethodName

PaymentIsCompleted

PaymentStatusName

PaymentStatusCode

PaymentTransactionID

 

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

 

The following example shows how to get and set a custom payment result item while payment processing by your custom payment gateway provider:
 

[C#]

 

using CMS.Ecommerce;

 

// Set authorization code

PaymentResultItemInfo item = new PaymentResultItemInfo();

item.Header = "{$AuthorizeNet.AuthorizationCode$}";

item.Name = "authorizationcode";

item.Value = "00000";

this.PaymentResult.SetPaymentResultItemInfo(item);

 

[C#]

 

using CMS.Ecommerce;

 

// Get authorization code

PaymentResultItemInfo item = this.PaymentResult.GetPaymentResultItemInfo("authorizationcode");