Develop > Controller layer > Payments subsystem


Plug-in exception handling and transaction roll-back

If a payment transaction fails, and that failure results in a WebSphere Commerce transaction roll back, then the payment transaction data is not in the WebSphere Commerce database.

When transaction rolls back, there are two actions you can take. The transactionCompensationAction parameter in the PaymentMethodConfigurations.xml determines the action:

<PaymentMethodConfiguration 
                 name="CreditCardOnline"
                 paymentSystemName="Paymentech" 
                 systemEditable="true"
                 humanEditable="true"
                 refundAllowed="true"
                 minimumAmount="0"
                 maximumAmount="Unbounded"
                 priority="MEDIUM"
                 partiallyConsumable="true"
                 transactionCompensationAction="track"/>

reverse

The default value. Reverse the successful payment transaction.

track

Track the successful payment transaction. Write to the database after the transaction rolls back.

Consider the two following scenarios:


transactionCompensationAction set to reverse

A customer pays for an order using a gift card and Visa card. The gift card has higher priority than the Visa card.

The redemption against the gift card was successfully run and the third-party payment service provider tracked this transaction; however, WebSphere Commerce does not have information regarding this transaction since the transaction rolled back. The UndoPaymentActionsCmd runs the compensate payment or credit transactions for those successfully run transactions at the overall WebSphere Commerce transaction rolling back.

The corresponding implementation class runs reverseApproval transaction for a successful authorization transaction. For other transaction types, a tickler is created. A tickler is also created, if the reverseApproval fails. Manually process the reversed transaction.

UndoPaymentActionsCmd extension points:


transactionCompensationAction set to track

A customer pays for an order using a Mastercard card and a VISA card. VISA card has higher priority than the MasterCard.

Validation against VISA card succeeded. Payment Service Provider tracked this transaction. However, WebSphere Commerce does not have information regarding this transaction since the transaction rolled back. Sometimes, it is necessary that the payment data for successful transactions are recorded in the WebSphere Commerce database. The data in the WebSphere Commerce database is consistent with the data on the Payment Service Provider. Successful actions do not need to rerun. TrackPaymentActionsCmd retrieves all related payment data for successful payment transactions when the overall WebSphere Commerce transaction rolls back. The command also restores data to database when the overall transaction rolls back.

By default, an overall implementation is not provided in the implementation class, TrackPaymentActionsCmdImpl. The implementation class provides basic payment data retrieval and restoration logic implementation. For example, data is restored to these tables EDPPAYINST, PPCPAYINST, EDPATMPAY, PPCPAYMENT, PPCPAYTRAN.

TrackPaymentActionsCmd extension points:


Related tasks

Add a new payment or refund method

Customize the business flow for payment processing

Use other payment protocol data to find orders

Create a payment plug-in

Package a payment plug-in

Related reference

Payment plug-in specification