CancelPayment

The CancelPayment-CUWO is responsible for reverting any authorization or capture a AuthorizeOrCapturePayment- or CapturePayment-CUWO may have performed before failing (or on failure on the enforePOS side after successful CUWO execution).

As it cannot be guaranteed that the cancelation can be performed, the CUWO may return payment processing data as part of a failure result. That data will be stored as part of the payment request (which will be marked as failed) on the enfore side, so that the payment request on the enfore side and the transaction on the external side can be manually reconciled.

This type of CUWO is invoked when:

  • An AuthorizeOrCapturePayment-CUWO failed (to ensure that the potentially authorized/captured amount is released/reverted)
  • A CapturePayment-CUWO failed (to ensure that the authorized and potentially captured amount is released/reverted)
  • An AuthorizeOrCapturePayment-CUWO returned with "success" but the subsequent processing of the payment request was canceled or failed on the enforePOS side.

Workflow parameters

The CancelPayment-CUWO will receive a CancelPaymentWorkflowParameters structure as input.

The structure is defined as:

/**
 * The parameter/input structure for a "cancel payment" workflow.
 */
class CancelPaymentWorkflowParameters extends WorkflowParameters {
    readonly "@type" : string = "n4.cuwo.workflows.paymentsandpayouts.cancelpayment.CancelPaymentWorkflowParameters";

    /**
     * The ID of the payment request whose payment is to be canceled.
     */
    public paymentRequestID : string;

    /**
     * The payment reference of the payment to cancel as provided
     * by the AuthorizeOrCapturePayment workflow.
     */
    public paymentReference? : string;

    /**
     * The payment processing data of the payment to cancel as
     * provided by the AuthorizeOrCapturePayment workflow.
     */
    public paymentProcessingData? : string;
}

Success result

On success, the CancelPayment-CUWO is expected to pass a CancelPaymentWorkflowResult structure to terminateSuccess.

The structure is defined as:

/**
 * The result/output structure for a successful "cancel payment" workflow.
 */
class CancelPaymentWorkflowResult extends WorkflowResult {
    readonly "@type" : string = "n4.cuwo.workflows.paymentsandpayouts.cancelpayment.CancelPaymentWorkflowResult";

    /**
     * Optional update for the payment processing data of the payment.
     * 
     * When provided, replaces the previously stored payment processing
     * data. When not provided, a previously stored payment processing
     * data stays unchanged.
     */
    public paymentProcessingData? : string;
}

Failure result

On failure, the CancelPayment-CUWO is expected to pass a CancelPaymentWorkflowFailure structure to terminateFailure.

The structure is defined as:

/**
 * The result/output structure for a failed "cancel payment" workflow.
 */
class CancelPaymentWorkflowFailure extends WorkflowFailure {
    readonly "@type" : string = "n4.cuwo.workflows.paymentsandpayouts.cancelpayment.CancelPaymentWorkflowFailure";

    /**
     * The reason for the failure.
     */
    public failureReason : CancelPaymentWorkflowFailureReason;

    /**
     * A failure code specific to the payment method.
     * 
     * The enfore platform simply stores that code and displays it to the user but does
     * not understand it or base any processing on it.
     * 
     * This enables storing a short error identifier from an external system in a way
     * that allows it to be shown in the enforePOS sales/payment history UI.
     */
    public failureCode? : string;

    /**
     * Optional update for the payment processing data of the payment.
     *
     * When provided, replaces the previously stored payment processing
     * data. When not provided, a previously stored payment processing
     * data stays unchanged.
     */
    public paymentProcessingData? : string;
}

Cancelation result

The CancelPayment workflow does not support cancelation.