Pre-Authorization Cancellation

If a pre-authorization is no longer needed, you can cancel it to release the locked funds back to the customer’s account.

Initiate Cancellation

To cancel a previously initiated pre-authorization, launch the PreAuthCompleteOrCancelActivity with the appropriate parameters:

public void onPreAuthCancelBtnClick(View view) {
...
  Intent intent = new Intent(this, PreAuthCompleteOrCancelActivity.class);
  intent.putExtra(MyPos.INTENT_EXTRA_ORDER_ID, orderId);
  intent.putExtra(MyPos.INTENT_EXTRA_IS_PRE_AUTH_CANCELLATION, true);
  startActivityForResult(intent, MyPos.REQUEST_CODE_PRE_AUTHORIZATION_CANCEL);
...
}

Important: The orderId must match the one used during the original pre-authorization request.

Handle the Cancellation Result

To handle the outcome of the cancellation, override onActivityResult() in your activity:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if( resultCode == RESULT_OK  && requestCode == MyPos.REQUEST_CODE_PRE_AUTHORIZATION_CANCEL ) {
      int status = data.getIntExtra(MyPos.INTENT_EXTRA_STATUS, MyPos.STATUS_INTERNAL_API_ERROR);

      if( status == MyPos.STATUS_SUCCESS) {
        ...
      }
}

When to Use Cancellation Use cancellation in situations such as:

  • Booking or reservation was canceled before fulfillment
  • You don’t need to charge the customer after evaluating the request
  • Customer changes payment method before completion