Disbursements

This method will immediately disburse funds from a specifically designated ProPay source account into another.
  • You will need to fund your ProPay Disbursements account prior to sending money to anyone.
  • Minimum amount is $1.00 USD.
  • Rather than using the normal affiliate certStr, this method uses a certStr directly tied to the source account for funds disbursement.
 
How to call this method?

Example Request

Example Response

{
 "amount":1000,
 "recAccntNum":32543210,
 "invNum":"invoice number",
 "comment1":"comment 1",
 "comment2":"comment 2"
}
{
 "AccountNumber":32543210,
 "Status":"00",
 "TransactionNumber":2
}
Implementation Details
Request Submission

namespace ProPayApi_ProPayToProPay
{
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 ProPayToProPayProgram
{
public static void Main(string[] args)
{
var propayToProPayResponse = PerformProPayToProPayTransaction();
}
private static TransferResult PerformProPayToProPayTransaction()
{
var baseUrl = "https://xmltest.propay.com/api/propayapi/PropayMerchantService.svc/";
var request = BuildTestData();
var restRequest = CreateRestRequest("/PropayToPropay", RestSharp.Method.PUT);
restRequest.AddBody(request);
return Execute<TransferResult>(restRequest, baseUrl);
}

private static PropayToPropayRequest BuildTestData()
{
return new PropayToPropayRequest
{
amount = 100,
comment1 = "comment 1",
comment2 = "comment 2",
invNum = "invoice number",
recAccntNum = 123456 // this is the account number that will be receiving the funds
};
}

/// <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 credentials = GetCredentials();

var restRequest = new RestRequest { Resource = resource, Method = method, RequestFormat = DataFormat.Json, };
restRequest.AddHeader("accept", "application/json");
restRequest.AddHeader("Authorization", credentials);
return restRequest;
}

private static string GetCredentials()
{
var termId = "AffTermId01"; // put affiliate term id here, if you have it
var certString = "TestAffiliateMerchCertString01"; // put affiliate cert string here
var encodedCredentials = Convert.ToBase64String(termId == null ? Encoding.Default.GetBytes(certString) : Encoding.Default.GetBytes(certString + ":" + termId));

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>
/// Contract for Propay-To-Propay Transfer.
/// </summary>
public class PropayToPropayRequest
{
/// <summary>
/// Gets or sets the amount to be transferred to the receiving account number when the transaction settles.
/// </summary>
public long amount { get; set; }

/// <summary>
/// Gets or sets the ProPay account identifier.
/// This is the account to which the amount will be sent when the transaction settles.
/// </summary>
public long recAccntNum { get; set; }

/// <summary>
/// Gets or sets the invoice number for the transaction.
/// </summary>
public string invNum { get; set; }

/// <summary>
/// Gets or sets the first comment.
/// </summary>
public string comment1 { get; set; }

/// <summary>
/// Gets or sets the second comment.
/// </summary>
public string comment2 { get; set; }
}

/// <summary>
/// Response object for timed pull or Propay-To-Propay transaction.
/// </summary>
public class TransferResult
{
/// <summary>
/// Gets or sets the proPay account identifier. This is the ‘from’ account and the account upon which the cc transaction was initially performed.
/// </summary>
public long AccountNumber { get; set; }

/// <summary>
/// Gets or sets the ProPay transaction identifier. It is when this transaction settles that the timed pull will occur.
/// </summary>
public long TransactionNumber { get; set; }

/// <summary>
/// Gets or sets the status.
/// </summary>
public string Status { 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 ProPayApi
{
/* change this to the production url for going live after testing https://api.propay.com */
private $_apiBaseUrl = 'https://xmltestapi.propay.com';

private $_certStr;
private $_termid;

/* for transfers */
private $_propayToPropayTransferData;
private $_propayToPropayTransferInfo;

/**
* @param string $certStr
* @return $this
*/
public function setCertStr($certStr)
{
$this->_certStr = $certStr;
return $this;
}

/**
* @param string $termid
* @return $this
*/
public function setTermid($termid)
{
$this->_termid = $termid;
return $this;
}

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

/**
* @param array $transferData
* @return $this
*/
public function setPropayToPropayTransferData($transferData) {
$this->_propayToPropayTransferData = $transferData;
return $this;
}

/**
* @return $this
*/
public function processProPayToProPay() {
$data_string = json_encode($this->_propayToPropayTransferData);

$ch = curl_init($this->_apiBaseUrl . '/ProPayAPI/ProPayToProPay');
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->_propayToPropayTransferInfo = curl_exec($ch);
return $this;
}

/**
* @return mixed
* returns a json string that looks like
* {"AccountNumber":32291226,"Status":"00","TransactionNumber":3249572035}
*/
public function getProPayToPropayTransferInfo() {
return $this->_propayToPropayTransferInfo;
}
}

$data = [
"amount" => 100,
"invNum" => "",
"recAccntNum" => "123456789"
];

$proPayAPI = new ProPayApi();
$result = $proPayAPI->setCertStr('thecertstringgoesin here')
->setTermid('termid goes here')
->setPropayToPropayTransferData($data)
->processProPayToProPay()
->getProPayToPropayTransferInfo();

The online Word to HTML converter lets you compose a clean and tidy code for your website. Please leave this message unchanged or subscribe for a htmlg membership.

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 java.util.Random;

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 ProPayToProPaySample {
 /**
* This URL would normally come from some configuration file or database.
*/
 final static String ApiUrl = "https://xmltestapi.propay.com/propayapi/";

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

ProPayToProPaySample program = new ProPayToProPaySample();
ProPayToProPayResponse response = program.propayToPropay();

System.out.println("Transaction Status:" + response.Status);
System.out.println("Account number: " + response.AccountNumber);
System.out.println("Transaction number: " + response.TransactionNumber);
 }

 /**
* Execute a ProPay to ProPay transaction.
*
* @return The ProPay to ProPay transaction response.
*/
 public ProPayToProPayResponse propayToPropay() {
String resourceUrl = ApiUrl + "ProPayToProPay";

final int TenUsDollars = 1000;

ProPayToProPayRequest ppToPpRequest = new ProPayToProPayRequest();
ppToPpRequest.Amount = TenUsDollars;
ppToPpRequest.ReceivingAccountNumber = this.getReceivingAccount();
ppToPpRequest.InvoiceNumber = this.getInvoiceNumber();
ppToPpRequest.Comment1 = "Product Sales commission";
ppToPpRequest.Comment2 = "May 2017";

HttpRequestWithBody request = this.createRequest(resourceUrl);

request.body(ppToPpRequest);

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

 /**
* The source account's certificate string.
*
* This is different than the affiliate's certstring.
*
* Normally this would be in a database or configuration file.
*/
 private String getCertString() {
return "D835BBB96D23476BBD1E2A79736EC3";
 }

 /**
* The affiliate term id.
*
* Normally this would be in a database or configuration file.
*/
 private String getTermId() {
return "commissions";
 }

 /**
* Gets a random invoice number.
*
* This would normally come from an internal invoice number tracking system.
*
* @return The invoice number.
*/
 private String getInvoiceNumber() {
Random rand = new Random();

int invoiceNumber = rand.nextInt(100) + 1;

return String.valueOf(invoiceNumber);
 }

 /**
* Get the account number for the account receiving the money.
*
* @return The receiving account number.
*/
 private String getReceivingAccount() {
return "30829395";
 }

 /**
* 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 certString = this.getCertString();
String termId = this.getTermId();

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

return restRequest;
 }

 /**
* 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

// ProPayToProPayRequest.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 com.fasterxml.jackson.annotation.JsonProperty;

public class ProPayToProPayRequest {

 @JsonProperty("amount")
 public int Amount;

 @JsonProperty("invNum")
 public String InvoiceNumber;

 @JsonProperty("recAccntNum")
 public String ReceivingAccountNumber;

 @JsonProperty("comment1")
 public String Comment1;

 @JsonProperty("comment2")
 public String Comment2;
}


// -------------------------------------------------------------------------------------------- //
// ProPayToProPayResponse.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.
 */

public class ProPayToProPayResponse {
 public String Status;

 public String AccountNumber;

 public int TransactionNumber;
}

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

Element

Type

Max

Required

Notes

amount

Int(64)

 

Required

The value representing the number of pennies in USD, or the number of [currency] without decimals.

recAccntNum

Int(32)

 

Required

ProPay assigned account identifier. The receiving account.

comment1

String

120

Optional

Optional Comment Line 1

comment2

String

120

Optional

Optional Comment Line 2

invNum

String

50

Optional

Optional Invoice Number for external tracking

Response Values

Element

Type

Notes

Status

string

Result of the transaction request. See ProPay Appendix B for result code definitions

TransactionNumber

Int(32)

The ProPay transaction identifier

How to call this method?

You should submit a post of XML data to the following URL
 
HTTP URL(s)
Example Request

Example Response

<?xml version='1.0'?>
<!DOCTYPE Request.dtd>
<XMLRequest>
<certStr>My certStr</certStr>
<class>partner</class>
<XMLTrans>
<transType>02</transType>
<amount>123</amount>
<recAccntNum>123456</recAccntNum>
<invNum>My Invoice</invNum>
</XMLTrans>
</XMLRequest>
<XMLResponse>
<XMLTrans>
<transType>02</transType>
<invNum>My Invoice</invNum>
<status>00</status>
<transNum>2</transNum>
</XMLTrans>
</XMLResponse>
Implementation Details
Request Submission

Response Handling

Request Submission

Response Handling

Request Submission

Response Handling

Request Submission

Response Handling

Request Values

Element

Type

Max

Required

Notes

amount

Int(64)

 

Required

The value representing the number of pennies in USD, or the number of [currency] without decimals.

recAccntNum

Int(32)

 

Required

ProPay assigned account identifier. The receiving account.

comment1

String

120

Optional

Optional Comment Line 1

comment2

String

120

Optional

Optional Comment Line 2

invNum

String

50

Optional

Optional Invoice Number for external tracking

Response Values

Element

Type

Notes

status

string

Result of the transaction request. See ProPay Appendix for result code definitions

invNum

String

Echo of the value passed into request.

transNum

Int(32)

The ProPay transaction identifier

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