Refund
A refund of a previous payment (full or partial).
Examples
Create Refund
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
Refund refund = Refund.create(new PaymentsMap()
.set("amount", 100L)
.set("payment", "[PAYMENT ID]")
.set("reason", "Refund Description")
.set("reference", "76398734634")
);
System.out.println(refund);
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
refund = Simplify::Refund.create({
"reference" => "76398734634",
"reason" => "Refund Description",
"amount" => "100",
"payment" => "[PAYMENT ID]"
})
puts refund.inspect
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
refund = simplify.Refund.create({
"reference" : "76398734634",
"reason" : "Refund Description",
"amount" : "100",
"payment" : "[PAYMENT ID]"
})
print(refund)
<?php
require_once("./lib/Simplify.php");
Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';
$refund = Simplify_Refund::createRefund(array(
'reference' => '76398734634',
'reason' => 'Refund Description',
'amount' => '100',
'payment' => '[PAYMENT ID]'
));
print_r($refund);
?>
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
my $refund = Net::Simplify::Refund->create({
reference => "76398734634",
reason => "Refund Description",
amount => "100",
payment => "[PAYMENT ID]"
});
print "Refund ID ", $refund->{id}, "\n";
using SimplifyCommerce.Payments;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
Refund refund = new Refund();
refund.Amount = 100;
refund.Payment = new Payment("[PAYMENT ID]");
refund.Reason = "Refund Description";
refund.Reference = "76398734634";
try
{
refund = (Refund)api.Create(refund);
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.refund.create({
reference : "76398734634",
reason : "Refund Description",
amount : "100",
payment : "[PAYMENT ID]"
}, function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
amount
Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00
[min value: 50, max value: 9999900]
required
payment
ID of the payment for the refund
optional
reason
Reason for the refund
optional
reference
Custom reference field to be used with outside systems.
optional
replayId
An identifier that can be sent to uniquely identify a refund request to facilitate retries due to I/O related issues. This identifier must be unique for your account (sandbox or live) across all of your refunds. If supplied, we will check for a refund on your account that matches this identifier. If found we will return an identical response to that of the original request.
[max length: 50, min length: 1]
optional
OUTPUT
card.customer.id
Customer ID
card.id
Unique ID of the card associated with the payment
id
Unique id of the refund
payment.id
Payment ID
transactionDetails.id
Transaction details id
amount
Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00
authCode
Refund authorization code
card
Credit or debit card being used to apply the payment to.
card.addressCity
City of the cardholder.
card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
card.addressLine1
Address of the cardholder.
card.addressLine2
Address of the cardholder if needed.
card.addressState
State of residence of the cardholder. State abbreviations should be used.
card.addressZip
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
card.customer
Customer associated with the card
card.customer.email
Email address of the customer
card.customer.name
Name of the customer
card.dateCreated
Creation date in UTC millis of the card in the system
card.expMonth
Expiration month of the card. Format is MM. Example: January = 01
card.expYear
Expiration year of the card. Format is YY. Example: 2013 = 13
card.indicator
Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
card.indicatorSource
Card indicator source.
card.last4
Last 4 digits of the card number
card.name
Name as appears on the card.
card.type
Type of credit or debit card
currency
Currency code (ISO-4217) for the refund. Must match the currency associated with your account.
dateCreated
Date in UTC millis the refund was created in the system
description
Description of the refund
fee
The fee charged for processing the transaction. This is the standard per transaction fee.
feeCurrency
Currency code (ISO4217) for the refund fee.
feeEstimated
Flag indicating whether the fees are estimated or actual.
payment
Payment associated with refund
paymentStatus
Status of the payment associated with the refund
reference
Custom reference field to be used with outside systems
replayId
The replayId that was submitted with the refund create request
source
The source of the refund (one of ECOMMERCE or VIRTUAL_TERMINAL)
transactionDetails
Raw response from the payment processor.
transactionDetails.data
Raw response data from the acquirer.
Examples
List Refund
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
ResourceList<Refund> refund = Refund.list(new PaymentsMap("max", 30));
System.out.println ("Total: " + refund.getTotal());
for (Refund o: refund.getList()) {
System.out.println(o.toString());
}
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
val = Simplify::Refund.list({"max" => 30})
puts "Total: #{val['total']}"
val['list'].each do |o|
puts o.inspect
end
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
refunds = simplify.Refund.list({"max": 30})
print "Total: " + str(refunds.total)
for o in refunds.list:
print(o)
<?php
require_once("./lib/Simplify.php");
Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';
$refund = Simplify_Refund::listRefund(array("max" => 30));
print "Total: " . $refund->total . "\n";
foreach ($refund->list as $o) {
print_r($o);
}
?>
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
$refunds = Net::Simplify::Refund->list({max => 30});
print "Total: ", $refunds->total, "\n";
foreach my $refund ($refunds->list) {
print $refund->{id}, "\n";
}
using SimplifyCommerce.Payments;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
try
{
ResourceList<Refund> refund = (ResourceList<Refund>)api.List(typeof(Refund));
Console.WriteLine ("Total: " + refund.Total);
Console.WriteLine ("List: " + refund.List.ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.refund.list({max: 30}, function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Total: " + data.total);
for(var i=0; i < data.list.length; i++){
console.log("Amount: " + data.list[i].amount);
}
});
INPUT PARAMETERS
filter
*Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates optional
filter.id | Filter by the refund Id |
filter.text | Filter by the refund description text |
filter.replayId | Filter by the compoundReplayId |
filter.authCode | Filter by the authorization code (Not authorization ID) |
filter.amount | Filter by the refund amount (in the smallest unit of your currency) |
filter.dateCreatedMin* | Filter by the minimum created date you are searching for - Date in UTC millis |
filter.dateCreatedMax* | Filter by the maximum created date you are searching for - Date in UTC millis |
filter.deposit | Filter by the deposit id |
filter.q | You can use this to filter by the Id, the authCode or the amount of the refund |
*Use dateCreatedMin with dateCreatedMax in the same filter if you want to search between two created dates optional
max
Allows up to a max of 50 list items to return.
[min value: 0, max value: 50, default:
optional
20
]
offset
Used in paging of the list. This is the start offset of the page.
[min value: 0, default:
optional
0
]
sorting
Allows for ascending or descending sorting of the list.
The value is a map between the property name and the sorting direction (either 'asc' for ascending or 'desc' for descending). Sortable properties are:
id
, amount
, description
, dateCreated
, paymentDate
optional
OUTPUT
filter
Filters to apply to the list.
list
Object list
max
Allows up to a max of 50 list items to return.
offset
Used in paging of the list. This is the start offset of the page.
sorting
Allows for ascending or descending sorting of the list.
total
Total number of records available
Examples
Find Refund
PaymentsApi.PUBLIC_KEY = "YOUR_PUBLIC_API_KEY";
PaymentsApi.PRIVATE_KEY = "YOUR_PRIVATE_API_KEY";
Refund refund = Refund.find("4TR6Bc");
System.out.println (refund);
require 'simplify'
Simplify::public_key = "YOUR_PUBLIC_API_KEY"
Simplify::private_key = "YOUR_PRIVATE_API_KEY"
refund = Simplify::Refund.find('4TR6Bc')
puts refund.inspect
import simplify
simplify.public_key = "YOUR_PUBLIC_API_KEY"
simplify.private_key = "YOUR_PRIVATE_API_KEY"
refund = simplify.Refund.find('4TR6Bc')
print(refund)
<?php
require_once("./lib/Simplify.php");
Simplify::$publicKey = 'YOUR_PUBLIC_API_KEY';
Simplify::$privateKey = 'YOUR_PRIVATE_API_KEY';
$obj = Simplify_Refund::findRefund('4TR6Bc');
print_r($obj);
?>
use Net::Simplify;
$Net::Simplify::public_key = "YOUR_PUBLIC_API_KEY";
$Net::Simplify::private_key = "YOUR_PRIVATE_API_KEY";
$refund = Net::Simplify::Refund->find('4TR6Bc');
print $refund->{id}, "\n";
using SimplifyCommerce.Payments;
using Newtonsoft.Json;
PaymentsApi.PublicApiKey = "YOUR_PUBLIC_KEY";
PaymentsApi.PrivateApiKey = "YOUR_PRIVATE_KEY";
PaymentsApi api = new PaymentsApi();
try
{
String id = "1234";
Refund refund = (Refund)api.Find(typeof(Refund), id);
// output all properties
Console.WriteLine(JsonConvert.SerializeObject(refund).ToString());
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
var Simplify = require("simplify-commerce"),
client = Simplify.getClient({
publicKey: 'YOUR_PUBLIC_API_KEY',
privateKey: 'YOUR_PRIVATE_API_KEY'
});
client.refund.find("4TR6Bc", function(errData, data){
if(errData){
console.error("Error Message: " + errData.data.error.message);
// handle the error
return;
}
console.log("Success Response: " + JSON.stringify(data));
});
INPUT PARAMETERS
id
Object ID
required
OUTPUT
card.customer.id
Customer ID
card.id
Unique ID of the card associated with the payment
id
Unique id of the refund
payment.id
Payment ID
transactionDetails.id
Transaction details id
amount
Amount of the refund in the smallest unit of your currency. Example: 100 = $1.00
authCode
Refund authorization code
card
Credit or debit card being used to apply the payment to.
card.addressCity
City of the cardholder.
card.addressCountry
Country code (ISO-3166-1-alpha-2 code) of residence of the cardholder.
card.addressLine1
Address of the cardholder.
card.addressLine2
Address of the cardholder if needed.
card.addressState
State of residence of the cardholder. State abbreviations should be used.
card.addressZip
Postal code of the cardholder. The postal code size is between 5 and 9 in length and only contain numbers or letters.
card.customer
Customer associated with the card
card.customer.email
Email address of the customer
card.customer.name
Name of the customer
card.dateCreated
Creation date in UTC millis of the card in the system
card.expMonth
Expiration month of the card. Format is MM. Example: January = 01
card.expYear
Expiration year of the card. Format is YY. Example: 2013 = 13
card.indicator
Card indicator, i.e. DEBIT, CREDIT or CHARGE CARD.
card.indicatorSource
Card indicator source.
card.last4
Last 4 digits of the card number
card.name
Name as appears on the card.
card.type
Type of credit or debit card
currency
Currency code (ISO-4217) for the refund. Must match the currency associated with your account.
dateCreated
Date in UTC millis the refund was created in the system
description
Description of the refund
fee
The fee charged for processing the transaction. This is the standard per transaction fee.
feeCurrency
Currency code (ISO4217) for the refund fee.
feeEstimated
Flag indicating whether the fees are estimated or actual.
payment
Payment associated with refund
paymentStatus
Status of the payment associated with the refund
reference
Custom reference field to be used with outside systems
replayId
The replayId that was submitted with the refund create request
source
The source of the refund (one of ECOMMERCE or VIRTUAL_TERMINAL)
transactionDetails
Raw response from the payment processor.
transactionDetails.data
Raw response data from the acquirer.