Follow

Refunding and Voiding Transactions

A very common question is, “What is the difference between a Refund and a Void?”. Let’s start with the definitions:

  1. REFUND – Creates a brand new transaction that returns funds to the account holder
  2. VOID – Updates an existing transaction so that funds are not captured from the account holder

Rules for a REFUND:

  • You can only refund an account holder as much as they have been previously charged.

Rules for a VOID:

  • You can only void a transaction before it is settled (Otherwise known as “batched”). If it is settled then you must do a refund.

You always want to VOID a transaction when possible because it does not create additional transaction fees, but if the transaction has been settled then you must issue a refund.

Voiding a Transaction After It Has Been Charged

You must use a transaction id from a previously charged account.

Production Request

curl -X PUT -u "login:password" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_PRODUCTION_APP_KEY" \
     -d "status=VOID" \
    "https://api.payjunction.com/transactions/12345"

Remember that you can only VOID a transaction before it has been settled. Here is a sample error you will receive if you try to VOID a settled transaction.

{
  "errors" : [ {
    "message" : "Status can not be updated because the Transaction has been settled.",
    "parameter" : "status",
    "type" : "invalid"
  } ],
  "help" : "http://developer.payjunction.com/documentation/update-a-transaction"
}

Refunding a Previously Charged Transaction

The easiest way to issue a refund is using a previous transaction id. If you don’t specify the amount to refund then the amount will be taken for the previously charged transaction.

Production Request

curl -X POST -u "login:password" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_PRODUCTION_APP_KEY" \
     -d "action=REFUND" \
    -d "transactionId=12345" \
    "https://api.payjunction.com/transactions"

Sandbox Request

curl -X POST -u "pj-ql-01:pj-ql-01p" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_LABS_APP_KEY" \
     -d "action=REFUND" \
    -d "transactionId=3595" \
    "https://api.payjunctionlabs.com/transactions"

Refunding a Card

This is an example of refunding a credit card without using the previous transaction id. Notice that the full card number must be provided.

Production Request

curl -X POST -u "login:password" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_PRODUCTION_APP_KEY" \
     -d "action=REFUND" \
    -d "cardNumber=4444333322221111" \
    -d "cardExpMonth=01" \
    -d "cardExpYear=2020" \
    -d "amountBase=1.00" \
    "https://api.payjunction.com/transactions"

Sandbox Request

curl -X POST -u "pj-ql-01:pj-ql-01p" -H "Accept: application/json" -H "X-PJ-Application-Key: YOUR_LABS_APP_KEY" \
     -d "action=REFUND" \
    -d "cardNumber=4444333322221111" \
    -d "cardExpMonth=01" \
    -d "cardExpYear=2020" \
    -d "amountBase=1.00" \
    "https://api.payjunctionlabs.com/transactions"