DEVELOPER

Payanywhere Android SDK Specification

Version 6.8.0

Payanywhere Android SDK

Refund

post /refund

This function processes a refund for a transaction that has been settled. Credit card and cash sales can be refunded. Credit sale unique IDs start with "ccs_". Cash sale unique IDs start with "cas_".

Request

To refund a transaction, add the following code:

private static final String REFUND_URL = "payanywhere://refund/"; 
private static final int REFUND_VOID_REQUEST_CODE = 456;
protected String mTransactionActionUniqueId = "ccs_1234567";
protected String mRefundAmount = "25.00";
protect long receiptId = 317748502;
Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(REFUND_URL +  "?transactionUniqueId=" + mTransactionActionUniqueId + "&receiptId=" + receiptId +"&refundAmount=" + mRefundAmount));
startActivityForResult(intent, REFUND_VOID_REQUEST_CODE);

Response

To receive the activity result:

public static final String EXTRA_TRANSACTION_ACTION = "transactionAction";

private static final String EXTRA_TRANSACTION_RESULT = "transactionResult";
public static final String EXTRA_TRANSACTION_STATUS_MESSAGE = "transactionStatusMessage";

private static final String EXTRA_TRANSACTION_UNIQUE_ID = "transactionUniqueId";



@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	if(requestCode == REFUND_VOID_REQUEST_CODE){
    	if(resultCode == RESULT_OK){
        	Log.d(TAG,"result ok");
 			showTransactionActionResponses(data);
 		} else if(resultCode == RESULT_CANCELED){
        Log.d(TAG,"result cancelled");
 		showTransactionActionResponses(data);
 		}	
  }
}


private void showTransactionActionResponses(Intent data){
     if(data != null){
         String transactionAction = data.getStringExtra(EXTRA_TRANSACTION_ACTION);
         String transactionResult = data.getStringExtra(EXTRA_TRANSACTION_RESULT);
         String transactionStatusMessage = data.getStringExtra(EXTRA_TRANSACTION_STATUS_MESSAGE);
         String transactionUniqueId = data.getStringExtra(EXTRA_TRANSACTION_UNIQUE_ID);
     }
 }

Void

post /void

This function processes a void for a transaction that has not been settled. Credit card sales can be voided but cash sales cannot. Credit sale unique IDs start with "ccs_". If the application tries to send a void request to the SDK for a cash sale, an error message will be thrown. Cash sale unique IDs start with "cas_".

Request

To void a transaction, add the following code:

private static final String VOID_URL = "payanywhere://void/";

private static final int REFUND_VOID_REQUEST_CODE = 456;
protected String mTransactionActionUniqueId = "ccs_1234567";
protect long receiptId = 317748502;
Intent intent = new Intent(Intent.ACTION_VIEW , Uri.parse(VOID_URL +  "?transactionUniqueId=" + mTransactionActionUniqueId + "&receiptId=" + receiptId ));
startActivityForResult(intent, REFUND_VOID_REQUEST_CODE)

Duplicate Transaction Handling

In the event that the same credit card is run for the same amount in a 30 minute timeframe, the server will return a flag indicating it is a duplicate. For this scenario the following steps will occur.

  1. All SDK responses will contain an extra with the key duplicate that will be set to either true or false depending on the response from the server.
  2. A dialog will be presented indicating that a duplicate transaction was detected and the user will have the option to select Void or Continue.
  3. In the case of selecting Void:
    • A Void will be processed.
    • The SDK response will add the extras that begin with duplicateVoid which will contain the transaction response for the Void transaction.
    • The SDK response will also contain the extras for the original transaction that was Voided in the normal SDK response extras.
  4. In the case of selecting Continue, the SDK response will contain the normal extras.

Response

To receive the activity result:

public static final String EXTRA_TRANSACTION_ACTION = "transactionAction";

private static final String EXTRA_TRANSACTION_RESULT = "transactionResult";
public static final String EXTRA_TRANSACTION_STATUS_MESSAGE = "transactionStatusMessage";

private static final String EXTRA_TRANSACTION_UNIQUE_ID = "transactionUniqueId";



@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	if(requestCode == REFUND_VOID_REQUEST_CODE){
    	if(resultCode == RESULT_OK){
        	Log.d(TAG,"result ok");
 			showTransactionActionResponses(data);
 		} else if(resultCode == RESULT_CANCELED){
        Log.d(TAG,"result cancelled");
 		showTransactionActionResponses(data);
 		}	
  }
}


private void showTransactionActionResponses(Intent data){
     if(data != null){
         String transactionAction = data.getStringExtra(EXTRA_TRANSACTION_ACTION);
         String transactionResult = data.getStringExtra(EXTRA_TRANSACTION_RESULT);
         String transactionStatusMessage = data.getStringExtra(EXTRA_TRANSACTION_STATUS_MESSAGE);
         String transactionUniqueId = data.getStringExtra(EXTRA_TRANSACTION_UNIQUE_ID);
     }
 }
©2025 North is a registered DBA of NorthAB, LLC. All rights reserved. North is a registered ISO of BMO Harris Bank N.A., Chicago, IL, Citizens Bank N.A., Providence, RI, The Bancorp Bank, Philadelphia, PA, FFB Bank, Fresno, CA, Wells Fargo Bank, N.A., Concord, CA, and PNC Bank, N.A.