Voiding and Refunding Payments

Step 1: Decide whether you need to void or refund the payment.

Void: A void cancels a card transaction before it has been fully processed and settled, which must be done on the same day as the transaction. No money is moved, so the customer's available balance remains unaffected, although the charge might appear as pending temporarily. Use a void if you need to correct a transaction mistake or if a customer cancels their purchase immediately.

Refund: A refund returns funds to the customer's account after the transaction has been fully processed and settled. This can be done anytime after the transaction day and results in both the original charge and the refund appearing on the customer's statement. Use a refund for returns or if you need to provide a refund after the transaction day.

📘

Note

A charge can only be refunded if it was already batched. If the charge has not been batched yet, a void must occur instead.

Option 1: Void

In order to void a charge, we will need its original ID: charge_id. You would have received it when creating a charge - as in the guide Pay by Card - Existing Customer.. Let's assume your charge_id is nBoLWODLMLLoOXyb.

POSThttps://api.payarc.net/v1/charges/{charge_id}/void

ParameterDescription
Reason
Required
This is the reason the transaction is being voided. This value cannot have spaces. If spaces are
needed use an underscore "_"
Format: String, Allowable Values: requested_by_customer, fraudulent, duplicate, other
Example:requested_by_customer
Void_description
Optional
This is an additional optional description of the situation leading to voiding the transaction.
Format: Alphanumeric and special characters, Length: 5-190
Example: Customer cancelled the order.
import http.client
conn = http.client.HTTPSConnection("api.payarc.net")
payload = 'reason=requested_by_customer&void_description=Description%20for%20void.'
headers = {
  'Accept': 'application/json',
  'Content-Type': 'application/x-www-form-urlencoded',
  'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}'
}
conn.request("POST", "/v1/charges/{charge_id}/void", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var qs = require('querystring');

var options = {
  'method': 'POST',
  'hostname': 'api.payarc.net',
  'path': '/v1/charges/{charge_id}/void',
  'headers': {
    'Accept': 'application/json',
    'Content-Type': 'application/x-www-form-urlencoded',
    'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = qs.stringify({
  'reason': 'requested_by_customer',
  'void_description': 'Description for void.'
});

req.write(postData);

req.end();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.payarc.net/v1/charges/{charge_id}/void");
request.Headers.Add("Accept", "application/json");
request.Headers.Add("Authorization", "Bearer {{Access-Token-From-Payarc-Dashboard}}");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("reason", "requested_by_customer"));
collection.Add(new("void_description", "Description for void."));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

You will receive the Exception code or Success Code and the original charge object.

RESPONSE TO BE ADDED. - not in documentation


Option 2: Refund

In order to refund a charge, we will need its original ID: charge_id. You would have received it when creating a charge - as in the guide Pay by Card - Existing Customer.. Let's assume your charge_id is nBoLWODLMLLoOXyb.

POSThttps://api.payarc.net/v1/charges/{charge_id}/refunds

ParameterDescription
Amount
Optional
This is the amount of the charge that is being refunded, in cents. It must be a positive integer. If the amount is not provided, this operation will refund the whole charge amount.
Format: Numeric, in cents
Example: 1201 for $12.01
Reason
Optional
This is the reason the transaction is being voided. This value cannot have spaces. If spaces are needed use an underscore "_"
Format: String, Allowable Values: requested_by_customer, fraudulent, duplicate, other
Example:requested_by_customer
Description
Optional
This is an additional optional description of the situation leading to refunding the transaction.
Format: Alphanumeric and special characters, Length: 5-190
Example:The reason for the refund is that the product could not be shipped.
Do_not_send_email_to_customer
Optional
This field prevents the sending of a confirmation email to the customer for the transaction. By default, all payarc transactions trigger a customer email.
Format: String, Allowable Values: yes, no
Do_not_send_sms_to_customer
Optional
This field prevents the sending of a confirmation text message to the customer for the transaction. By default, all payarc transactions trigger a text message to the customer phone number.
Format: String, Allowable Values: yes, no
import http.client
conn = http.client.HTTPSConnection("api.payarc.net")
payload = 'amount=1201&reason=requested_by_customer&description=The%20reason%20for%20the%20refund%20is%20that%20the%20product%20could%20not%20be%20shipped.&do_not_send_email_to_customer=yes&do_not_send_sms_to_customer=yes'
headers = {
  'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}',
  'Accept': 'application/json'
}
conn.request("POST", "/v1/charges/{charge_id}/refunds", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
var https = require('follow-redirects').https;
var fs = require('fs');

var qs = require('querystring');

var options = {
  'method': 'POST',
  'hostname': 'api.payarc.net',
  'path': '/v1/charges/{charge_id}/refunds',
  'headers': {
    'Authorization': 'Bearer {{Access-Token-From-Payarc-Dashboard}}',
    'Accept': 'application/json'
  },
  'maxRedirects': 20
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData = qs.stringify({
  'amount': '1201',
  'reason': 'requested_by_customer',
  'description': 'The reason for the refund is that the product could not be shipped.',
  'do_not_send_email_to_customer': 'yes',
  'do_not_send_sms_to_customer': 'yes'
});

req.write(postData);

req.end();
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.payarc.net/v1/charges/{charge_id}/refunds");
request.Headers.Add("Authorization", "Bearer {{Access-Token-From-Payarc-Dashboard}}");
request.Headers.Add("Accept", "application/json");
var collection = new List<KeyValuePair<string, string>>();
collection.Add(new("amount", "1201"));
collection.Add(new("reason", "requested_by_customer"));
collection.Add(new("description", "The reason for the refund is that the product could not be shipped."));
collection.Add(new("do_not_send_email_to_customer", "yes"));
collection.Add(new("do_not_send_sms_to_customer", "yes"));
var content = new FormUrlEncodedContent(collection);
request.Content = content;
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

You will receive the Exception code or Success Code and the original charge object.

RESPONSE TO BE ADDED. - not in documentation