Pre-Authorization
Pre-authorization allows you to lock funds on the customer’s card without capturing them immediately. This is useful for scenarios like hotel check-ins, equipment rentals, or service bookings where the final charge is confirmed later.
Start a Pre-Authorization
To initiate a pre-authorization, launch the PreAuthorizationActivity with the required intent extras:
public void onPreAuthBtnClick(View view) {
...
Intent intent = new Intent(this, PreAuthorizationActivity.class);
intent.putExtra(MyPos.INTENT_EXTRA_AMOUNT , amount);
intent.putExtra(MyPos.INTENT_EXTRA_ORDER_ID , "12345678");
startActivityForResult(intent, MyPos.REQUEST_CODE_PRE_AUTHORIZATION);
...
}
Handle the Result
After the pre-authorization is attempted, capture the result in your onActivityResult() method:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if( resultCode == RESULT_OK && requestCode == MyPos.REQUEST_CODE_PRE_AUTHORIZATION ) {
int status = data.getIntExtra(MyPos.INTENT_EXTRA_STATUS, MyPos.STATUS_INTERNAL_API_ERROR);
if( status == MyPos.STATUS_SUCCESS) {
...
}
}
What’s Next?
After a successful pre-authorization, you can:
- Complete (capture) the pre-authorized amount at a later time.
- Cancel the pre-authorization if the transaction doesn’t go through.
These follow-up steps are typically done via additional SDK calls or backend APIs.