Payment Results
Payment result is stored in xml format which is represented by the object CMS.Ecommerce.PaymentResultInfo. Each payment result xml node is equal to the single payment result item which is represented by the object CMS.Ecommerce.PaymentResultItemInfo.
Base payment result items are:
- | Payment date – Date and time when the payment result was last updated. |
- | Payment method – Payment method which was used for payment. |
- | Payment is completed – Yes/No. Indicates whether payment was already completed. |
- | Payment status – Completed/Failed/(your custom status). Status of the payment. |
- | Payment transaction ID – Completed payment unique identifier generated by the payment gateway. |
- | Payment description – Describes payment result in more details. |
Payment result item properties are:
- | Name: Unique identifier of the item. |
- | Header: Friendly name of the item visible to user (simple text or localizable string). |
- | Text: Outer representation of the item value visible to user (simple text or localizable string). |
- | Value: Inner representation of the item value used by developers. |
Following example shows xml definition of the 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 order payment result which is visible to the user in CMSDesk:
Date: 1/27/2008 5:01:41 PM
Method: Credit card
Is completed: YES
Status: Completed
Transaction ID: 0
Authorization code: 000000
Please note:
o | The order payment result remains empty until it is updated by the payment gateway processor. |
o | You don’t need to specify both item value and item text if they are identical because 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 result
You can use PaymentResultInfo properties to get or set specified item text or value:
- | PaymentDate |
- | PaymentMethodID |
- | PaymentMethodName |
- | PaymentIsCompleted |
- | PaymentStatusName |
- | PaymentStatusCode |
- | PaymentTransactionID |
You will need to use public methods GetPaymentResultItemInfo(string itemName) and
SetPaymentResultItemInfo(PaymentResultItemInfo itemObj) to get and set your custom payment result items.
The following example shows how to get and set 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"); |
Page url: http://devnet.kentico.com/docs/ecommerceguide/index.html?payment_results.htm