WCPayments plug-in financial transactions

Payment plug-ins can perform payment actions differently. This section describes how theWCPayments plug-in handles financial transactions (payment actions) and queries by its APIs. This information might be useful to plug-in writers who are modeling plug-ins after theWCPayments plug-in.

The following table lists the financial transaction APIs supported by theWCPayments plug-in:

Financial transaction API Description
checkPaymentInstruction The plug-in checks that all of the required parameters for the specified payment instruction are present. If all are not present, the plug-in throws an exception.
validatePaymentInstruction This action is not supported by theWCPayments plug-in because there is no corresponding function in WebSphere Commerce Payments. The exception PluginFunctionNotSupportedException will be thrown for this transaction.
approve This action causes WebSphere Commerce Payments to determine if the buyer should be allowed to make the purchase and reserves the funds. This action maps to the APPROVE command in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.
approveAndDeposit This action causes WebSphere Commerce Payments to allocate and transfer funds in a single transaction (known as a "sale" transaction in some cases). This action maps to the APPROVE command with the DEPOSITFLAG turned on in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.
deposit This action causes WebSphere Commerce Payments to transfer the allocated funds on the approve either partially or completely from the buyer to the seller. This action maps to the DEPOSIT command in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.
Note: Some payment cassettes might not support multiple deposits against a single payment. The cassettes provided with WebSphere Commerce Payments all support multiple deposits.
credit

This action causes WebSphere Commerce Payments to transfer funds from the seller to the buyer. This action maps to the REFUND command in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.

The WCPayments plug-in supports both dependent and independent credits. If a cassette supports only dependent credit transactions, a failure will occur and an exception will be thrown by the plug-in. The following payment cassettes support dependent and independent credits: OfflineCard, CustomOffline, Paymentech, VisaNet. The Cassette for BankServACH does not support either dependent or independent credits.

For more information about dependent and independent credits, see the Payment plug-in specification.

reverseApproval This action causes WebSphere Commerce Payments to cancel the allocation of funds on a payment that was already approved. This action maps to the APPROVEREVERSAL command in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.
reverseDeposit This action causes WebSphere Commerce Payments to cancel the transfer of funds in a deposit transaction. This action maps to the DEPOSITREVERSAL command in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.
reverseCredit This action causes WebSphere Commerce Payments to cancel the transfer of funds from a seller to a buyer in a credit transaction. This action maps to the REFUNDREVERSAL command in WebSphere Commerce Payments. If the transaction fails, the plug-in throws an exception.

The credit to which a reverseCredit transaction is issued against can be a dependent credit or independent credit.

The following table lists the payment query APIs support by the WCPayments plug-in:

Payment query API Description
getAvailableBalance Not supported
getPayment This query refreshes the current attributes of the Payment against WebSphere Commerce Payments. This action maps to the QUERYPAYMENTS command in WebSphere Commerce Payments.
getCredit This query refreshes the current attributes of the Credit against WebSphere Commerce Payments. This action maps to the QUERYCREDITS command in WebSphere Commerce Payments.
getMessage This query gets the translated error messages for a generated error code.