ProtectPay – Void a Transaction

You can void a credit or debit card transaction, which has been authorized but has not yet been sent to settlement. Use the ProtectPay® method VoidPaymentV2.

Transaction History ID and Transaction ID
All of the ProtectPay processing API methods, and all of the ProtectPay Payer Management Interfaces, including the Hosted Payments Page described in this website's recommended flow return two separate transaction identifiers. Understanding the purpose for, and use of each of these is important when processing Void transactions.
  • TransactionHistoryId is a unique value assigned by ProtectPay® and is the primary identifier that you should use when processing voids, refunds, or capture requests. It is the ProtectPay API's primary transaction identifier.
  • TransactionId is a value assigned by the gateway to which ProtectPay sends a transaction request. One of the key competitive advantages that ProtectPay® offers over most tokenization solutions is that it can process transactions against several credit card processing gateways. While TransactionHistoryId is the primary identifier for ProtectPay® transactions, you should also save TransactionId so that, if you ever need to look up a transaction on your credit card gateway, you can easily find the one you are looking for.
How to call this method?

HTTP URL(s)
HTTP Verb PUT
HTTP Header Authorization
Example Request

Example Response

{
 "OriginalTransactionId":"1",
 "TransactionHistoryId":0,
 "MerchantProfileId":null,
 "Comment1":null,
 "Comment2":null
}
{
 "Transaction":
 {
"AVSCode":"NotPresent",
"AuthorizationCode":null,
"CurrencyConversionRate":1.0,
"CurrencyConvertedAmount":100,
"CurrencyConvertedCurrencyCode":"USD",
"ResultCode":
{
"ResultValue":"SUCCESS",
"ResultCode":"00","ResultMessage":""
},
"TransactionHistoryId":"0",
"TransactionId":"1",
"TransactionResult":"Success",
"CVVResponseCode":"NotPresent",
"GrossAmt":null,
"NetAmt":null,
"PerTransFee":null,
"Rate":null,
"GrossAmtLessNetAmt":null
 },
 "RequestResult":
 {
"ResultValue":"SUCCESS",
"ResultCode":"00",
"ResultMessage":""
 }
}
Implementation Details
Request Submission

namespace ProtectPayApi_VoidTransaction
{
using System;
using System.Text;

using RestSharp;

/*
ProPay provides the following code “AS IS.”
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/
public class VoidTransactionProgram
{
public static void Main(string[] args)
{
var voidTransactionResponse = VoidTransaction();
}

private static VoidPaymentResponse VoidTransaction()
{
var baseUrl = "https://xmltestapi.propay.com/ProtectPay";
var request = BuildVoidRequest();
var restRequest = CreateRestRequest("/VoidedTransactions/", RestSharp.Method.PUT);
restRequest.AddBody(request);
return Execute<VoidPaymentResponse>(restRequest, baseUrl);
}

private static VoidPaymentRequest BuildVoidRequest()
{
return new VoidPaymentRequest
{
OriginalTransactionId = "1",
Comment1 = "Comment 1",
Comment2 = "Comment 2",
};
}

/// <summary>
/// Request factory to ensure API key is always first parameter added.
/// </summary>
/// <param name="resource">The resource name.</param>
/// <param name="method">The HTTP method.</param>
/// <returns>Returns a new <see cref="RestRequest"/>.</returns>
private static RestRequest CreateRestRequest(string resource, Method method)
{
var restRequest = new RestRequest { Resource = resource, Method = method, RequestFormat = DataFormat.Json, };
var credentials = GetCredentials();
restRequest.AddHeader("accept", "application/json");
restRequest.AddHeader("Authorization", credentials);

return restRequest;
}

private static string GetCredentials()
{
var billerAccountId = "5114248593164903"; // biller account id
var authToken = "9d506d3e-b5f7-4474-adb1-76423e113c85"; // authentication token of biller

var encodedCredentials = Convert.ToBase64String(Encoding.Default.GetBytes(billerAccountId + ":" + authToken));

var credentials = string.Format("Basic {0}", encodedCredentials);
return credentials;
}

/// <summary>
/// Executes a particular http request to a resource.
/// </summary>
/// <typeparam name="T">The response type.</typeparam>
/// <param name="request">The REST request.</param>
/// <param name="baseUrl">The base URL.</param>
/// <returns>Returns a response of the type parameter.</returns>
private static T Execute<T>(IRestRequest request, string baseUrl) where T : class, new()
{
var client = new RestClient(baseUrl);
var response = client.Execute<T>(request);

if (response.ErrorException != null)
{
Console.WriteLine(
"Error: Exception: {0}, Headers: {1}, Content: {2}, Status Code: {3}",
response.ErrorException,
response.Headers,
response.Content,
response.StatusCode);
}

return response.Data;
}

/// <summary>
/// Request information for a call to the "VoidPayment" method.
/// </summary>
public class VoidPaymentRequest
{
/// <summary>
/// Optional comment 1.
/// </summary>
public string Comment1 { get; set; }

/// <summary>
/// Optional comment 2.
/// </summary>
public string Comment2 { get; set; }

/// <summary>
/// Optional value to designate the merchant profile id that should be used to process this void.
/// </summary>
public string MerchantProfileId { get; set; }

/// <summary>
/// Optional value to designate the transaction id passed back from the gateway. 
/// NOTE: If this value is populated (not null and length > 0) it will always be used before the TransactionHistoryId.
/// </summary>
public string OriginalTransactionId { get; set; }

/// <summary>
/// Optional value to designate the transaction history id passed back from ProtectPay. 
/// NOTE: This will NOT be used if the OriginalTransactionId is present (not null and length > 0).
/// </summary>
public long TransactionHistoryId { get; set; }
}

/// <summary>
/// The value returned from a call to the "VoidPayment" method.
/// </summary>
public class VoidPaymentResponse
{
/// <summary>
/// The transaction information.
/// </summary>
public TransactionInformation Transaction { get; set; }

/// <summary>
/// Represents the result of the current transaction attempt.
/// </summary>
public Result RequestResult { get; set; }
}

/// <summary>
/// Transaction information from a attempt at processing a payment method in the ProPay system.
/// </summary>
public class TransactionInformation
{
/// <summary>
/// Gets or sets transaction history id in the ProPay system.
/// </summary>
public string TransactionHistoryId { get; set; }

/// <summary>
/// Gets or sets authorization code from the system of record.
/// </summary>
public string AuthorizationCode { get; set; }

/// <summary>
/// Gets or sets address verification system (AVS) code.
/// </summary>
/// <remarks>
/// Only present if billing information is present on a payment method and
/// system of record supports AVS.
/// </remarks>
public string AVSCode { get; set; }

/// <summary>
/// Gets or sets the amount in the settled currency.
/// </summary>
public int CurrencyConvertedAmount { get; set; }

/// <summary>
/// Gets or sets the settled currency code.
/// </summary>
public string CurrencyConvertedCurrencyCode { get; set; }

/// <summary>
/// Gets or sets the conversion rate from the requested currency to the settled currency.
/// </summary>
public decimal CurrencyConversionRate { get; set; }

/// <summary>
/// Gets or sets gross amount in the settled currency.
/// </summary>
public virtual int? GrossAmt { get; set; }

/// <summary>
/// Gets or sets gross amount less net amount in the settled currency.
/// </summary>
public virtual int? GrossAmtLessNetAmt { get; set; }

/// <summary>
/// Gets or sets net amount in the settled currency.
/// </summary>
public virtual int? NetAmt { get; set; }

/// <summary>
/// Gets or sets per transaction fee in the settled currency.
/// </summary>
public virtual int? PerTransFee { get; set; }

/// <summary>
/// Gets or sets rate percentage.
/// </summary>
public virtual decimal? Rate { get; set; }

/// <summary>
/// Gets or sets specific result information from the transaction.
/// </summary>
public Result ResultCode { get; set; }

/// <summary>
/// Gets or sets transaction ID from the system of record.
/// </summary>
public string TransactionId { get; set; }

/// <summary>
/// <c>Gets or sets result</c> of the transaction.
/// </summary>
public string TransactionResult { get; set; }
}

/// <summary>
/// The result of the call.
/// </summary>
public class Result
{
/// <summary>
/// The result of the transaction
/// </summary>
/// <remarks>
/// Will always be SUCCESS or FAILURE
/// </remarks>
public string ResultValue { get; set; }

/// <summary>
/// The result code of the transaction
/// </summary>
/// <remarks>
/// Will be a two-digit string with only numbers. Allows "00" as a response.
/// </remarks>
public string ResultCode { get; set; }

/// <summary>
/// The english-text message of what went wrong (if anything)
/// </summary>
/// <remarks>
/// The documenation show the empty string being returned in the success cases.
/// </remarks>
public string ResultMessage { get; set; }
}
}
}

Response Handling

Request Submission

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/
<?php
class ProtectPayApi
{

/* change this to the production url for going live after testing https://api.propay.com */
private $_apiBaseUrl = 'https://xmltestapi.propay.com';

/* credentials that would normally be set from database values or a config value */
private $_billerId;
private $_authToken;

/* for processing a payment method transaction void */
private $_paymentMethodTransactionVoidData;
private $_paymentMethodTransactionVoidInfo;

/**
* @param string $billerId
* @return $this
*/
public function setBillerId($billerId) {
$this->_billerId = $billerId;
return $this;
}

/**
* @param string $authToken
* @return $this
*/
public function setAuthToken($authToken) {
$this->_authToken = $authToken;
return $this;
}

/**
* @return string
*/
private function _getAuth() {
return $this->_billerId . ':' . $this->_authToken;
}

/**
* @return $this
* success result is something like
* {"Transaction":{"AVSCode":"NotPresent","AuthorizationCode":null,"CurrencyConversionRate":1.0,"CurrencyConvertedAmount":0,"CurrencyConvertedCurrencyCode":"Unsupported","ResultCode":{"ResultValue":"SUCCESS","ResultCode":"00","ResultMessage":""},"TransactionHistoryId":"0","TransactionId":"603","TransactionResult":"Success","CVVResponseCode":"NotPresent","GrossAmt":null,"NetAmt":null,"PerTransFee":null,"Rate":null,"GrossAmtLessNetAmt":null},"RequestResult":{"ResultValue":"SUCCESS","ResultCode":"00","ResultMessage":""}}
*/
public function processPaymentMethodTransactionVoid() {
$data_string = json_encode($this->_paymentMethodTransactionVoidData);

$ch = curl_init($this->_apiBaseUrl . '/ProtectPay/VoidedTransactions');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_getAuth());
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)
));

$this->_paymentMethodTransactionVoidInfo = curl_exec($ch);
return $this;
}

/**
* @param array $paymentMethodTransactionVoidData
* @return $this
*/
public function setPaymentMethodTransactionVoidData($paymentMethodTransactionVoidData) {
$this->_paymentMethodTransactionVoidData = $paymentMethodTransactionVoidData;
return $this;
}

/**
* @return mixed
*/
public function getPaymentMethodTransactionVoidInfo() {
return $this->_paymentMethodTransactionVoidInfo;
}
}

$data = [
"OriginalTransactionId" => "2",
"TransactionHistoryId" => 0,
"MerchantProfileId" => null,
"Comment1" => "Void Comment 1",
"Comment2" => "Void Comment 2"
];

// Void a transaction
$protectPayAPI = new ProtectPayApi();
$result = $protectPayAPI->setBillerId('9999986379225246')
->setAuthToken('16dfe8d7-889b-4380-925f-9c2c6ea4d930')
->setPaymentMethodTransactionVoidData($data)
->processPaymentMethodTransactionVoid()
->getPaymentMethodTransactionVoidInfo();

Response Handling

Request Submission

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

import java.io.IOException;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.ObjectMapper;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;

public class VoidTransactionSample {
 /**
* This URL would normally come from some configuration file or database.
*/
 String baseUrl = "https://xmltestapi.propay.com/protectpay";

 public static void main(String[] args) {
configureObjectMapper();

VoidTransactionSample program = new VoidTransactionSample();

VoidTransactionResponse response = program.voidTransaction();

Result requestResult = response.RequestResult;

System.out.println("Result: " + requestResult.ResultValue);
System.out.println("Result code: " + requestResult.ResultCode);
System.out.println("Result message: " + requestResult.ResultMessage);

Transaction transactionDetail = response.Transaction;
if (transactionDetail != null) {
Result transactionResult = transactionDetail.ResultCode;
System.out.println("Transaction Result: " + transactionResult.ResultValue);
System.out.println("Transaction Result code: " + transactionResult.ResultCode);

System.out.println("Transaction History Id: " + transactionDetail.TransactionHistoryId);
System.out.println("Authorization Code: " + transactionDetail.AuthorizationCode);
System.out.println("AVS Code: " + transactionDetail.AvsCode);
System.out.println("Currency Converted Amount: " + transactionDetail.CurrencyConvertedAmount);
System.out.println(
"Currency Converted Currency Code: " + transactionDetail.CurrencyConvertedCurrencyCode);
System.out.println("Currency Conversion Rate: " + transactionDetail.CurrencyConversionRate);
System.out.println("Gross Amount: " + transactionDetail.GrossAmount);
System.out.println("Gross Amount Less Net Amount: " + transactionDetail.GrossAmountLessNetAmount);
System.out.println("Net Amount: " + transactionDetail.NetAmount);
System.out.println("Per Transaction Fee: " + transactionDetail.PerTransactionFee);
System.out.println("Rate: " + transactionDetail.Rate);
System.out.println("Transaction Id: " + transactionDetail.TransactionId);
System.out.println("Transaction Result: " + transactionDetail.TransactionResult);
}
 }

 /**
* Creates a payment method.
*
* @return The payment method response.
*/
 private VoidTransactionResponse voidTransaction() {

VoidTransactionRequest voidRequest = this.buildRequest();

HttpRequestWithBody request = this.createRequest(baseUrl + "/VoidedTransactions/");

request.body(voidRequest);

return this.executeRequest(request, VoidTransactionResponse.class);
 }

 /**
* Gets the authentication token. This would normally be in a configuration
* file or database.
*
* @return The authentication token.
*/
 private String getAuthToken() {
return "EFA7EEDD-065C-4361-AC24-E13BCC4EF520";
 }

 /**
* Gets the biller's id. This would normally be in a configuration file or
* database.
*
* @return
*/
 private String getBillerId() {
return "9876543210987654";
 }

 /**
* Gets the transaction history id.
*
* This would normally be in a database or generated as a result of an
* earlier call, see ProtectPay API Manual sections "PaymentMethodId
* Processing Authorization Methods" or "PaymentMethodId Processing Capture
* Methods".
*/
 private String getTransactionHistoryId() {
return "135792468";
 }

 /**
* Create the request instance. This ensures that the authentication header
* is attached to each request.
*
* @param resourceUrl
* The URL of the REST resource.
* @return The GetRequest instance.
*/
 private HttpRequestWithBody createRequest(String resourceUrl) {
String authToken = this.getAuthToken();
String billerId = this.getBillerId();

HttpRequestWithBody restRequest = Unirest.put(resourceUrl).basicAuth(billerId, authToken)
.header("accept", "application/json").header("Content-Type", "application/json");

return restRequest;
 }

 /**
* Builds the request data.
*
* @returns The request data.
*/
 private VoidTransactionRequest buildRequest() {
String transactionHistoryId = this.getTransactionHistoryId();
// int merchantProfileId = this.getMerchantProfile();

VoidTransactionRequest voidRequest = new VoidTransactionRequest();
voidRequest.TransactionHistoryId = transactionHistoryId;
voidRequest.Comment1 = "Product back ordered";
voidRequest.Comment2 = "Customer good will";

return voidRequest;
 }

 /**
* Execute a REST request.
*
* @param request
* The request to perform.
* @param responseClass
* The type instance of the return type.
* @return An instance of type T or null if there was an error.
*/
 private <T> T executeRequest(HttpRequest request, Class<T> responseClass) {
try {
HttpResponse<T> response = request.asObject(responseClass);
if (response.getStatus() != 200) { // HTTP OK response code
System.out.println(response.getStatusText());
return null;
}

return response.getBody();
} catch (UnirestException e) {
e.printStackTrace();
}

return null;
 }

 /**
* Configures the mapping between JSON and Classes.
*
* This is boilerplate Unirest & Jackson configuration. It should only need
* to be done once in a full solution.
*/
 private static void configureObjectMapper() {
Unirest.setObjectMapper(new ObjectMapper() {
private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper();

public <T> T readValue(String value, Class<T> valueType) {
try {
return jacksonObjectMapper.readValue(value, valueType);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public String writeValue(Object value) {
try {
return jacksonObjectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
});
 }
}


// -------------------------------------------------------------------------------------------- //
// Object files

// VoidTransactionRequest.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

/**
 * A request to void a transaction.
 *
 */
public class VoidTransactionRequest {
 /**
* The transaction history id in the ProPay system.
*/
 public String TransactionHistoryId;

 /**
* The id of the merchant processing profile to use.
*
* Important if the account has multiple processing gateways, e.g. for
* different countries.
*
*/
 public int MerchantProfileId;

 /**
* Optional comment 1.
*/
 public String Comment1;

 /**
* Optional comment 2
*/
 public String Comment2;
}

// -------------------------------------------------------------------------------------------- //
// Result.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

/**
 * The result of the call.
 */
public class Result {
 /**
* The result of the transaction
*
* Will always be SUCCESS or FAILURE
*/
 public String ResultValue;

 /**
* The result code of the transaction
*
*
* Will be a two-digit string with only numbers. Allows "00" as a response.
*/
 public String ResultCode;

 /**
* The English-text message of what went wrong (if anything)
*
*
* The documentation shows the empty string being returned in the success
* cases.
*/
 public String ResultMessage;
}

// -------------------------------------------------------------------------------------------- //
// Transaction.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

import java.math.BigDecimal;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Transaction details.
 *
 */
public class Transaction {
 /**
* The transaction history id in the ProPay system.
*/
 public String TransactionHistoryId;

 /**
* The transaction authorization code from the issuing bank.
*/
 public String AuthorizationCode;

 /**
* The address verification system (AVS) code.
*
* Only present if billing information is present on payment method, or in
* the request.
*/
 @JsonProperty("AVSCode")
 public String AvsCode;

 /**
* The card verification value (CVV) response code.
*/
 @JsonProperty("CVVResponseCode")
 public String CvvResponseCode;

 /**
* The amount in the settled currency.
*/
 public int CurrencyConvertedAmount;

 /**
* The settled currency code.
*/
 public String CurrencyConvertedCurrencyCode;

 /**
* The conversion rate from the requested currency to the settled currency.
* e.g. USD to USD = 1, JPY to USD = 0.0090 (as of 5/17/2017)
*/
 public BigDecimal CurrencyConversionRate;

 /**
* The gross amount in the settled currency.
*/
 @JsonProperty("GrossAmt")
 public Integer GrossAmount;

 /**
* The gross amount less net amount in the settled currency.
*/
 @JsonProperty("GrossAmtLessNetAmt")
 public Integer GrossAmountLessNetAmount;

 /**
* The net amount in the settled currency.
*/
 @JsonProperty("NetAmt")
 public Integer NetAmount;

 /**
* The per transaction fee in the settled currency.
*/
 @JsonProperty("PerTransFee")
 public Integer PerTransactionFee;

 /**
* The percentage fee, if any.
*/
 public BigDecimal Rate;

 /**
* Result information from the transaction.
*/
 public Result ResultCode;

 /**
* The transaction number assigned by the processor.
*/
 public String TransactionId;

 /**
* The transaction result as reported by the processor.
*/
 public String TransactionResult;
}


// -------------------------------------------------------------------------------------------- //
// VoidTransactionResponse.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

/**
 * The value returned from call to void a transaction.
 *
 */
public class VoidTransactionResponse {
 /**
* The transaction details
*/
 public Transaction Transaction;

 /**
* The result of the request.
*/
 public Result RequestResult;
}

Response Handling

The following sample uses the Unirest and Jackson libraries.

You can add them to your project using:

Apache Maven
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8.1</version>
</dependency>


Gradle/Grails
compile 'com.mashape.unirest:unirest-java:1.4.9'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.8.1'

Request Submission

Response Handling

Request Values

Request Element

Type

Max

Required

Notes

AuthenticationToken

String

100

Authorization

Valid value is a GUID. Value supplied by ProPay. Used to access the API

BillerAccountId

String

16

Authorization

Value supplied by ProPay. Used to identify the correct collection of tokens.

Comment1

String

128

Optional

 

Comment2

String

128

Optional

 

MerchantProfileId

Int(64)

Signed Int(64)

Required

Used to specify which processor and merchant account to process the transaction against.

originalTransactionID

Int(64)

Signed Int(64)

Optional**

Identifier for the transaction to capture.

This value would have been returned by AuthorizePaymentMethodTransaction.

**This is the Gateway’s identifier.

TransactionHistoryId

String

-

Optional**

Identifier for the transaction to capture.

This value would have been returned by AuthorizePaymentMethodTransaction.

**This ProtectPay’s identifier.

**Either the originalTransactionID or the TransactionHistoryId is required. If both are sent, the originalTransactionID is disregarded and the TransactionHistoryId is used.

Response Values

Response Element

Type

Notes

RequestResult.ResultValue

String

The ProtectPay API Method Response Value; SUCCESS indicates the method completed; FAILURE indicates the method call failed and the reason is indicated in the ResultCode and ResultMessage

RequestResult.ResultCode

String

The ProtectPay API Method Response Code. See ProtectPay Appendix A for possible returned values

RequestResult.ResultMessage

String

The ProtectPay API Method Response Message. See ProtectPay Appendix A for possible returned Messages

AuthorizationCode

String

Will return null as it is not applicable for Voids

AVSCode

String

Will return as Not Present as it is not applicable for Voids

CurrencyConversionRate

Decimal

The rate for currency conversion used for multi-currency transactions

CurrencyConvertedAmount

Integer

Gross converted amount of transaction in the number of [currency] without decimals for multi-currency transactions

CurrencyConvertedCurrencyCode

String

The currency the transaction was converted to for multi-currency transactions

CVVResponseCode

String

Will not Return as it is not applicable for Voids

GrossAmt

Integer

Gross amount of transaction of pennies in USD, or the number of [currency] without decimals.

GrossAmtLessNetAmt

Integer

Total amount of fees charged; *ProPay Gateway Only

NetAmt

Integer

Net amount of transaction after fees charged; *ProPay Gateway Only

PerTransFee

Integer

Per transaction fee; *ProPay Gateway Only

Rate

Decimal

Percentage fee; *ProPay Gateway Only

Transaction.ResultCode.ResultValue

String

The result value of the transaction request as reported by the ProtectPay. SUCCESS or FAILURE

Transaction.ResultCode.ResultCode

String

The result code of the transaction request as reported by ProtectPay. See ProtectPay Appendix A for possible returned values

Transaction.ResultCode.ResultMessage

String

The result message of the transaction request as reported by ProtectPay. See ProtectPay Appendix A for possible returned values

TransactionHistoryId

String

Unique transaction number assigned by ProtectPay.

TransactionId

String

Transaction number assigned by processor (Gateway)

TransactionResult

String

Transaction result as reported by processor (Gateway)

How to call this method?

Example Request

Example Response

Implementation Details
Request Submission

Response Handling

Request Submission

Response Handling

Request Submission

Response Handling

Request Submission

Response Handling

Request Values
Response Values
How to call this method?

{SOAP Action}     VoidPaymentV2
{URL}                   https://xmltestapi.propay.com/protectpay/sps.svc
Example Request

Example Response

{
"OriginalTransactionId":"2",
"TransactionHistoryId":0,
"MerchantProfileId":null,
"Comment1":"Void Comment 1",
"Comment2":"Void Comment 2"
}
{
"Transaction":{
"AVSCode":"NotPresent",
"AuthorizationCode":null,
"CurrencyConversionRate":1.0,
"CurrencyConvertedAmount":100,
"CurrencyConvertedCurrencyCode":"USD",
"ResultCode":{
"ResultValue":"SUCCESS",
"ResultCode":"00",
"ResultMessage":""
},
"TransactionHistoryId":"0",
"TransactionId":"3",
"TransactionResult":"Success",
"CVVResponseCode":"NotPresent"
},
"RequestResult":{
"ResultValue":"SUCCESS",
"ResultCode":"00",
"ResultMessage":""
}
}
Implementation Details
Request Submission

namespace ProtectPayApi_VoidTransaction
{
using System;
using System.Text;

using RestSharp;

/*
ProPay provides the following code “AS IS.”
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/
public class VoidTransactionProgram
{
public static void Main(string[] args)
{
var voidTransactionResponse = VoidTransaction();
}

private static VoidPaymentResponse VoidTransaction()
{
var baseUrl = "https://xmltestapi.propay.com/ProtectPay";
var request = BuildVoidRequest();
var restRequest = CreateRestRequest("/VoidedTransactions/", RestSharp.Method.PUT);
restRequest.AddBody(request);
return Execute<VoidPaymentResponse>(restRequest, baseUrl);
}

private static VoidPaymentRequest BuildVoidRequest()
{
return new VoidPaymentRequest
{
OriginalTransactionId = "1",
Comment1 = "Comment 1",
Comment2 = "Comment 2",
};
}

/// <summary>
/// Request factory to ensure API key is always first parameter added.
/// </summary>
/// <param name="resource">The resource name.</param>
/// <param name="method">The HTTP method.</param>
/// <returns>Returns a new <see cref="RestRequest"/>.</returns>
private static RestRequest CreateRestRequest(string resource, Method method)
{
var restRequest = new RestRequest { Resource = resource, Method = method, RequestFormat = DataFormat.Json, };
var credentials = GetCredentials();
restRequest.AddHeader("accept", "application/json");
restRequest.AddHeader("Authorization", credentials);

return restRequest;
}

private static string GetCredentials()
{
var billerAccountId = "5114248593164903"; // biller account id
var authToken = "9d506d3e-b5f7-4474-adb1-76423e113c85"; // authentication token of biller

var encodedCredentials = Convert.ToBase64String(Encoding.Default.GetBytes(billerAccountId + ":" + authToken));

var credentials = string.Format("Basic {0}", encodedCredentials);
return credentials;
}

/// <summary>
/// Executes a particular http request to a resource.
/// </summary>
/// <typeparam name="T">The response type.</typeparam>
/// <param name="request">The REST request.</param>
/// <param name="baseUrl">The base URL.</param>
/// <returns>Returns a response of the type parameter.</returns>
private static T Execute<T>(IRestRequest request, string baseUrl) where T : class, new()
{
var client = new RestClient(baseUrl);
var response = client.Execute<T>(request);

if (response.ErrorException != null)
{
Console.WriteLine(
"Error: Exception: {0}, Headers: {1}, Content: {2}, Status Code: {3}",
response.ErrorException,
response.Headers,
response.Content,
response.StatusCode);
}

return response.Data;
}

/// <summary>
/// Request information for a call to the "VoidPayment" method.
/// </summary>
public class VoidPaymentRequest
{
/// <summary>
/// Optional comment 1.
/// </summary>
public string Comment1 { get; set; }

/// <summary>
/// Optional comment 2.
/// </summary>
public string Comment2 { get; set; }

/// <summary>
/// Optional value to designate the merchant profile id that should be used to process this void.
/// </summary>
public string MerchantProfileId { get; set; }

/// <summary>
/// Optional value to designate the transaction id passed back from the gateway. 
/// NOTE: If this value is populated (not null and length > 0) it will always be used before the TransactionHistoryId.
/// </summary>
public string OriginalTransactionId { get; set; }

/// <summary>
/// Optional value to designate the transaction history id passed back from ProtectPay. 
/// NOTE: This will NOT be used if the OriginalTransactionId is present (not null and length > 0).
/// </summary>
public long TransactionHistoryId { get; set; }
}

/// <summary>
/// The value returned from a call to the "VoidPayment" method.
/// </summary>
public class VoidPaymentResponse
{
/// <summary>
/// The transaction information.
/// </summary>
public TransactionInformation Transaction { get; set; }

/// <summary>
/// Represents the result of the current transaction attempt.
/// </summary>
public Result RequestResult { get; set; }
}

/// <summary>
/// Transaction information from a attempt at processing a payment method in the ProPay system.
/// </summary>
public class TransactionInformation
{
/// <summary>
/// Gets or sets transaction history id in the ProPay system.
/// </summary>
public string TransactionHistoryId { get; set; }

/// <summary>
/// Gets or sets authorization code from the system of record.
/// </summary>
public string AuthorizationCode { get; set; }

/// <summary>
/// Gets or sets address verification system (AVS) code.
/// </summary>
/// <remarks>
/// Only present if billing information is present on a payment method and
/// system of record supports AVS.
/// </remarks>
public string AVSCode { get; set; }

/// <summary>
/// Gets or sets the amount in the settled currency.
/// </summary>
public int CurrencyConvertedAmount { get; set; }

/// <summary>
/// Gets or sets the settled currency code.
/// </summary>
public string CurrencyConvertedCurrencyCode { get; set; }

/// <summary>
/// Gets or sets the conversion rate from the requested currency to the settled currency.
/// </summary>
public decimal CurrencyConversionRate { get; set; }

/// <summary>
/// Gets or sets gross amount in the settled currency.
/// </summary>
public virtual int? GrossAmt { get; set; }

/// <summary>
/// Gets or sets gross amount less net amount in the settled currency.
/// </summary>
public virtual int? GrossAmtLessNetAmt { get; set; }

/// <summary>
/// Gets or sets net amount in the settled currency.
/// </summary>
public virtual int? NetAmt { get; set; }

/// <summary>
/// Gets or sets per transaction fee in the settled currency.
/// </summary>
public virtual int? PerTransFee { get; set; }

/// <summary>
/// Gets or sets rate percentage.
/// </summary>
public virtual decimal? Rate { get; set; }

/// <summary>
/// Gets or sets specific result information from the transaction.
/// </summary>
public Result ResultCode { get; set; }

/// <summary>
/// Gets or sets transaction ID from the system of record.
/// </summary>
public string TransactionId { get; set; }

/// <summary>
/// <c>Gets or sets result</c> of the transaction.
/// </summary>
public string TransactionResult { get; set; }
}

/// <summary>
/// The result of the call.
/// </summary>
public class Result
{
/// <summary>
/// The result of the transaction
/// </summary>
/// <remarks>
/// Will always be SUCCESS or FAILURE
/// </remarks>
public string ResultValue { get; set; }

/// <summary>
/// The result code of the transaction
/// </summary>
/// <remarks>
/// Will be a two-digit string with only numbers. Allows "00" as a response.
/// </remarks>
public string ResultCode { get; set; }

/// <summary>
/// The english-text message of what went wrong (if anything)
/// </summary>
/// <remarks>
/// The documenation show the empty string being returned in the success cases.
/// </remarks>
public string ResultMessage { get; set; }
}
}
}

Response Handling

Request Submission

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/
<?php
class ProtectPayApi
{

/* change this to the production url for going live after testing https://api.propay.com */
private $_apiBaseUrl = 'https://xmltestapi.propay.com';

/* credentials that would normally be set from database values or a config value */
private $_billerId;
private $_authToken;

/* for processing a payment method transaction void */
private $_paymentMethodTransactionVoidData;
private $_paymentMethodTransactionVoidInfo;

/**
* @param string $billerId
* @return $this
*/
public function setBillerId($billerId) {
$this->_billerId = $billerId;
return $this;
}

/**
* @param string $authToken
* @return $this
*/
public function setAuthToken($authToken) {
$this->_authToken = $authToken;
return $this;
}

/**
* @return string
*/
private function _getAuth() {
return $this->_billerId . ':' . $this->_authToken;
}

/**
* @return $this
* success result is something like
* {"Transaction":{"AVSCode":"NotPresent","AuthorizationCode":null,"CurrencyConversionRate":1.0,"CurrencyConvertedAmount":0,"CurrencyConvertedCurrencyCode":"Unsupported","ResultCode":{"ResultValue":"SUCCESS","ResultCode":"00","ResultMessage":""},"TransactionHistoryId":"0","TransactionId":"603","TransactionResult":"Success","CVVResponseCode":"NotPresent","GrossAmt":null,"NetAmt":null,"PerTransFee":null,"Rate":null,"GrossAmtLessNetAmt":null},"RequestResult":{"ResultValue":"SUCCESS","ResultCode":"00","ResultMessage":""}}
*/
public function processPaymentMethodTransactionVoid() {
$data_string = json_encode($this->_paymentMethodTransactionVoidData);

$ch = curl_init($this->_apiBaseUrl . '/ProtectPay/VoidedTransactions');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT");
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $this->_getAuth());
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)
));

$this->_paymentMethodTransactionVoidInfo = curl_exec($ch);
return $this;
}

/**
* @param array $paymentMethodTransactionVoidData
* @return $this
*/
public function setPaymentMethodTransactionVoidData($paymentMethodTransactionVoidData) {
$this->_paymentMethodTransactionVoidData = $paymentMethodTransactionVoidData;
return $this;
}

/**
* @return mixed
*/
public function getPaymentMethodTransactionVoidInfo() {
return $this->_paymentMethodTransactionVoidInfo;
}
}

$data = [
"OriginalTransactionId" => "2",
"TransactionHistoryId" => 0,
"MerchantProfileId" => null,
"Comment1" => "Void Comment 1",
"Comment2" => "Void Comment 2"
];

// Void a transaction
$protectPayAPI = new ProtectPayApi();
$result = $protectPayAPI->setBillerId('9999986379225246')
->setAuthToken('16dfe8d7-889b-4380-925f-9c2c6ea4d930')
->setPaymentMethodTransactionVoidData($data)
->processPaymentMethodTransactionVoid()
->getPaymentMethodTransactionVoidInfo();

Response Handling

Request Submission

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

import java.io.IOException;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.ObjectMapper;
import com.mashape.unirest.http.Unirest;
import com.mashape.unirest.http.exceptions.UnirestException;
import com.mashape.unirest.request.HttpRequest;
import com.mashape.unirest.request.HttpRequestWithBody;

public class VoidTransactionSample {
 /**
* This URL would normally come from some configuration file or database.
*/
 String baseUrl = "https://xmltestapi.propay.com/protectpay";

 public static void main(String[] args) {
configureObjectMapper();

VoidTransactionSample program = new VoidTransactionSample();

VoidTransactionResponse response = program.voidTransaction();

Result requestResult = response.RequestResult;

System.out.println("Result: " + requestResult.ResultValue);
System.out.println("Result code: " + requestResult.ResultCode);
System.out.println("Result message: " + requestResult.ResultMessage);

Transaction transactionDetail = response.Transaction;
if (transactionDetail != null) {
Result transactionResult = transactionDetail.ResultCode;
System.out.println("Transaction Result: " + transactionResult.ResultValue);
System.out.println("Transaction Result code: " + transactionResult.ResultCode);

System.out.println("Transaction History Id: " + transactionDetail.TransactionHistoryId);
System.out.println("Authorization Code: " + transactionDetail.AuthorizationCode);
System.out.println("AVS Code: " + transactionDetail.AvsCode);
System.out.println("Currency Converted Amount: " + transactionDetail.CurrencyConvertedAmount);
System.out.println(
"Currency Converted Currency Code: " + transactionDetail.CurrencyConvertedCurrencyCode);
System.out.println("Currency Conversion Rate: " + transactionDetail.CurrencyConversionRate);
System.out.println("Gross Amount: " + transactionDetail.GrossAmount);
System.out.println("Gross Amount Less Net Amount: " + transactionDetail.GrossAmountLessNetAmount);
System.out.println("Net Amount: " + transactionDetail.NetAmount);
System.out.println("Per Transaction Fee: " + transactionDetail.PerTransactionFee);
System.out.println("Rate: " + transactionDetail.Rate);
System.out.println("Transaction Id: " + transactionDetail.TransactionId);
System.out.println("Transaction Result: " + transactionDetail.TransactionResult);
}
 }

 /**
* Creates a payment method.
*
* @return The payment method response.
*/
 private VoidTransactionResponse voidTransaction() {

VoidTransactionRequest voidRequest = this.buildRequest();

HttpRequestWithBody request = this.createRequest(baseUrl + "/VoidedTransactions/");

request.body(voidRequest);

return this.executeRequest(request, VoidTransactionResponse.class);
 }

 /**
* Gets the authentication token. This would normally be in a configuration
* file or database.
*
* @return The authentication token.
*/
 private String getAuthToken() {
return "EFA7EEDD-065C-4361-AC24-E13BCC4EF520";
 }

 /**
* Gets the biller's id. This would normally be in a configuration file or
* database.
*
* @return
*/
 private String getBillerId() {
return "9876543210987654";
 }

 /**
* Gets the transaction history id.
*
* This would normally be in a database or generated as a result of an
* earlier call, see ProtectPay API Manual sections "PaymentMethodId
* Processing Authorization Methods" or "PaymentMethodId Processing Capture
* Methods".
*/
 private String getTransactionHistoryId() {
return "135792468";
 }

 /**
* Create the request instance. This ensures that the authentication header
* is attached to each request.
*
* @param resourceUrl
* The URL of the REST resource.
* @return The GetRequest instance.
*/
 private HttpRequestWithBody createRequest(String resourceUrl) {
String authToken = this.getAuthToken();
String billerId = this.getBillerId();

HttpRequestWithBody restRequest = Unirest.put(resourceUrl).basicAuth(billerId, authToken)
.header("accept", "application/json").header("Content-Type", "application/json");

return restRequest;
 }

 /**
* Builds the request data.
*
* @returns The request data.
*/
 private VoidTransactionRequest buildRequest() {
String transactionHistoryId = this.getTransactionHistoryId();
// int merchantProfileId = this.getMerchantProfile();

VoidTransactionRequest voidRequest = new VoidTransactionRequest();
voidRequest.TransactionHistoryId = transactionHistoryId;
voidRequest.Comment1 = "Product back ordered";
voidRequest.Comment2 = "Customer good will";

return voidRequest;
 }

 /**
* Execute a REST request.
*
* @param request
* The request to perform.
* @param responseClass
* The type instance of the return type.
* @return An instance of type T or null if there was an error.
*/
 private <T> T executeRequest(HttpRequest request, Class<T> responseClass) {
try {
HttpResponse<T> response = request.asObject(responseClass);
if (response.getStatus() != 200) { // HTTP OK response code
System.out.println(response.getStatusText());
return null;
}

return response.getBody();
} catch (UnirestException e) {
e.printStackTrace();
}

return null;
 }

 /**
* Configures the mapping between JSON and Classes.
*
* This is boilerplate Unirest & Jackson configuration. It should only need
* to be done once in a full solution.
*/
 private static void configureObjectMapper() {
Unirest.setObjectMapper(new ObjectMapper() {
private com.fasterxml.jackson.databind.ObjectMapper jacksonObjectMapper = new com.fasterxml.jackson.databind.ObjectMapper();

public <T> T readValue(String value, Class<T> valueType) {
try {
return jacksonObjectMapper.readValue(value, valueType);
} catch (IOException e) {
throw new RuntimeException(e);
}
}

public String writeValue(Object value) {
try {
return jacksonObjectMapper.writeValueAsString(value);
} catch (JsonProcessingException e) {
throw new RuntimeException(e);
}
}
});
 }
}


// -------------------------------------------------------------------------------------------- //
// Object files

// VoidTransactionRequest.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

/**
 * A request to void a transaction.
 *
 */
public class VoidTransactionRequest {
 /**
* The transaction history id in the ProPay system.
*/
 public String TransactionHistoryId;

 /**
* The id of the merchant processing profile to use.
*
* Important if the account has multiple processing gateways, e.g. for
* different countries.
*
*/
 public int MerchantProfileId;

 /**
* Optional comment 1.
*/
 public String Comment1;

 /**
* Optional comment 2
*/
 public String Comment2;
}

// -------------------------------------------------------------------------------------------- //
// Result.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

/**
 * The result of the call.
 */
public class Result {
 /**
* The result of the transaction
*
* Will always be SUCCESS or FAILURE
*/
 public String ResultValue;

 /**
* The result code of the transaction
*
*
* Will be a two-digit string with only numbers. Allows "00" as a response.
*/
 public String ResultCode;

 /**
* The English-text message of what went wrong (if anything)
*
*
* The documentation shows the empty string being returned in the success
* cases.
*/
 public String ResultMessage;
}

// -------------------------------------------------------------------------------------------- //
// Transaction.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

import java.math.BigDecimal;

import com.fasterxml.jackson.annotation.JsonProperty;

/**
 * Transaction details.
 *
 */
public class Transaction {
 /**
* The transaction history id in the ProPay system.
*/
 public String TransactionHistoryId;

 /**
* The transaction authorization code from the issuing bank.
*/
 public String AuthorizationCode;

 /**
* The address verification system (AVS) code.
*
* Only present if billing information is present on payment method, or in
* the request.
*/
 @JsonProperty("AVSCode")
 public String AvsCode;

 /**
* The card verification value (CVV) response code.
*/
 @JsonProperty("CVVResponseCode")
 public String CvvResponseCode;

 /**
* The amount in the settled currency.
*/
 public int CurrencyConvertedAmount;

 /**
* The settled currency code.
*/
 public String CurrencyConvertedCurrencyCode;

 /**
* The conversion rate from the requested currency to the settled currency.
* e.g. USD to USD = 1, JPY to USD = 0.0090 (as of 5/17/2017)
*/
 public BigDecimal CurrencyConversionRate;

 /**
* The gross amount in the settled currency.
*/
 @JsonProperty("GrossAmt")
 public Integer GrossAmount;

 /**
* The gross amount less net amount in the settled currency.
*/
 @JsonProperty("GrossAmtLessNetAmt")
 public Integer GrossAmountLessNetAmount;

 /**
* The net amount in the settled currency.
*/
 @JsonProperty("NetAmt")
 public Integer NetAmount;

 /**
* The per transaction fee in the settled currency.
*/
 @JsonProperty("PerTransFee")
 public Integer PerTransactionFee;

 /**
* The percentage fee, if any.
*/
 public BigDecimal Rate;

 /**
* Result information from the transaction.
*/
 public Result ResultCode;

 /**
* The transaction number assigned by the processor.
*/
 public String TransactionId;

 /**
* The transaction result as reported by the processor.
*/
 public String TransactionResult;
}


// -------------------------------------------------------------------------------------------- //
// VoidTransactionResponse.java

/*
ProPay provides the following code "AS IS."
ProPay makes no warranties and ProPay disclaims all warranties and conditions, express, implied or statutory,
including without limitation the implied warranties of title, non-infringement, merchantability, and fitness for a particular purpose.
ProPay does not warrant that the code will be uninterrupted or error free,
nor does ProPay make any warranty as to the performance or any results that may be obtained by use of the code.
*/

/**
 * The value returned from call to void a transaction.
 *
 */
public class VoidTransactionResponse {
 /**
* The transaction details
*/
 public Transaction Transaction;

 /**
* The result of the request.
*/
 public Result RequestResult;
}

Response Handling

The following sample uses the Unirest and Jackson libraries.

You can add them to your project using:

Apache Maven
<dependency>
<groupId>com.mashape.unirest</groupId>
<artifactId>unirest-java</artifactId>
<version>1.4.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.8.1</version>
</dependency>


Gradle/Grails
compile 'com.mashape.unirest:unirest-java:1.4.9'
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.8.1'

Request Submission

Response Handling

Request Values

Request Element

Type

Max

Required

Notes

AuthenticationToken

String

100

Authorization

Valid value is a GUID. Value supplied by ProPay. Used to access the API

BillerAccountId

String

16

Authorization

Value supplied by ProPay. Used to identify the correct collection of tokens.

Comment1

String

128

Optional

 

Comment2

String

128

Optional

 

MerchantProfileId

Int(64)

Signed Int(64)

Required

Used to specify which processor and merchant account to process the transaction against.

originalTransactionID

Int(64)

Signed Int(64)

Optional**

Identifier for the transaction to capture.

This value would have been returned by AuthorizePaymentMethodTransaction.

**This is the Gateway’s identifier.

TransactionHistoryId

String

-

Optional**

Identifier for the transaction to capture.

This value would have been returned by AuthorizePaymentMethodTransaction.

**This ProtectPay’s identifier.

**Either the originalTransactionID or the TransactionHistoryId is required. If both are sent, the originalTransactionID is disregarded and the TransactionHistoryId is used.

Response Values

Response Element

Type

Notes

RequestResult.ResultValue

String

The ProtectPay API Method Response Value; SUCCESS indicates the method completed; FAILURE indicates the method call failed and the reason is indicated in the ResultCode and ResultMessage

RequestResult.ResultCode

String

The ProtectPay API Method Response Code. See Appendix for possible returned values

RequestResult.ResultMessage

String

The ProtectPay API Method Response Message. See Appendix for possible returned Messages

AuthorizationCode

String

Will return null as it is not applicable for Voids

AVSCode

String

Will return as Not Present as it is not applicable for Voids

CurrencyConversionRate

Decimal

The rate for currency conversion used for multi-currency transactions

CurrencyConvertedAmount

Integer

Gross converted amount of transaction in the number of [currency] without decimals for multi-currency transactions

CurrencyConvertedCurrencyCode

String

The currency the transaction was converted to for multi-currency transactions

CVVResponseCode

String

Will not Return as it is not applicable for Voids

GrossAmt

Integer

Gross amount of transaction of pennies in USD, or the number of [currency] without decimals.

GrossAmtLessNetAmt

Integer

Total amount of fees charged; *ProPay Gateway Only

NetAmt

Integer

Net amount of transaction after fees charged; *ProPay Gateway Only

PerTransFee

Integer

Per transaction fee; *ProPay Gateway Only

Rate

Decimal

Percentage fee; *ProPay Gateway Only

Transaction.ResultCode.ResultValue

String

The result value of the transaction request as reported by the ProtectPay. SUCCESS or FAILURE

Transaction.ResultCode.ResultCode

String

The result code of the transaction request as reported by ProtectPay. See Appendix for possible returned values

Transaction.ResultCode.ResultMessage

String

The result message of the transaction request as reported by ProtectPay. See Appendix for possible returned values

TransactionHistoryId

String

Unique transaction number assigned by ProtectPay.

TransactionId

String

Transaction number assigned by processor (Gateway)

TransactionResult

String

Transaction result as reported by processor (Gateway)