Refund a transaction
Refunds a settled transaction (transaction_type=U).
Request Parameters
Content type: application/x-www-form-urlencoded
Required5 fields
profile_idstringID issued by MerchantE
pattern=^\d{20}$ ยท maxLength=20
profile_keystringAPI password assigned by MerchantE
maxLength=32
transaction_typestringenumRefund transaction (U)
transaction_idstringTransaction ID of original sale
maxLength=32
transaction_amountstringAmount to refund (partial refunds accepted)
pattern=^\d+\.\d{2}$
Example request
Starter values are pre-filled; replace with your own credentials and test data.
profile_id: YOUR_PROFILE_ID_HERE profile_key: YOUR_PROFILE_KEY_HERE transaction_type: U transaction_id: 8fc94e10b12130f4ab8a8ceeac40fc69 transaction_amount: "12.30" retry_id: REFUND001
Responses
200
Successful transaction response
Successful transaction response
Common3 fields
transaction_idstringUnique identifier for the transaction
error_codestringError/Response code:
- 000 = Approval
- 005 = Do Not Honor
- See full error code table in documentation
auth_response_textstringAuthorization response message
When Provided5 fields
auth_codestringAuthorization code (6 characters)
avs_resultstringAddress Verification Service result
- 0โAVS Error - Retry
- AโAddress Match Only
- BโAddress Match, Postal Code not verified
- CโNo Match
- DโAddress and Postal Code Match
- EโAVS Error - Ineligible
- FโAddress and Postal Code Match (UK only)
- GโNon-US Issuer does not participate
- IโAddress not verified, Postal Code not verified
- MโAddress and Postal Code Match
- NโNo Match
- PโPostal Code Match, Address not verified
- RโIssuer System Unavailable
- SโService not Supported
- UโAddress unavailable
- Wโ9-digit Postal Code Match, Address no match
- XโExact match, 9-digit Postal Code
- YโAddress and 5-digit Postal Code Match
- Zโ5-digit Postal Code Match, Address no match
cvv2_resultstringCVV2 verification result
- MโCVV2 Match
- NโCVV2 No Match
- PโNot Processed
- SโCVV2 should be on card but merchant indicates not present
- UโIssuer not certified
card_idstringPermanent token (stored card) identifier returned when store_card=Y is used
maxLength=32
batch_numberstringBatch number returned for Batch Close responses
maxLength=20
Other Fields12 fields
account_balancestringAccount balance (for prepaid cards)
batch_idstringBatch ID
batch_statusstringBatch status
card_exp_datestringCard expiration date (MMYY)
card_last_fourstringLast 4 digits of card number
card_typestringCard type (Visa, Mastercard, Discover, Amex, etc.)
commercial_cardstringCommercial card type
- BโBusiness Card
- RโCorporate Card
- SโPurchasing Card
- 0โNon-commercial card
extended_avs_resultstringExtended AVS result details
partial_auth_indicatorstringPartial authorization indicator
payment_account_referencestringPayment Account Reference returned by processor
product_levelstringProduct level code
transaction_feestringTransaction fee amount
Example response
transaction_id: 5fc24a2abe160c232a6dccd72ed8c5ba error_code: "000" auth_response_text: Approval T02786 avs_result: "0" cvv2_result: M auth_code: T02786
400
Bad request - invalid parameters
Bad request - invalid parameters
401
Unauthorized - invalid credentials
Unauthorized - invalid credentials
500
Server error
Server error
Error and result codes
The gateway response includes fields such as error_code,avs_result, andcvv2_result. Use the tables to interpret them.
Gateway error codes
visa
| Code | Meaning |
|---|---|
| 19 | Re-enter Transaction |
| 28 | File Temporarily Unavailable |
| 39 | No Credit Account |
| 58 | Transaction Not Permitted on Terminal |
| 68 | Response Received Too Late |
| 78 | Blocked - First Use |
| 82 | Negative CAM, dCVV, iCVV, or CVV results |
| 85 | No Reason to Decline |
| 91 | Issuer or Switch Inoperative |
| 92 | Routing Error |
| 93 | Violation of Law |
| 94 | Duplicate Transaction |
| 96 | System Malfunction |
| 000 | Approval |
| 005 | Do Not Honor |
| 012 | Invalid Transaction |
| 013 | Invalid Amount |
| 014 | Invalid Card Number |
| 015 | Invalid Issuer |
| 021 | Unable to Back Out Transaction |
| 023 | Unacceptable Transaction Fee |
| 025 | Unable to Locate Record |
| 041 | Lost Card |
| 043 | Stolen Card |
| 046 | Closed Account |
| 051 | Insufficient Funds |
| 052 | No Checking Account |
| 053 | No Savings Account |
| 054 | Expired Card |
| 055 | Incorrect PIN |
| 056 | No Card Record |
| 057 | Transaction Not Permitted to Cardholder |
| 061 | Exceeds Withdrawal Limit |
| 062 | Restricted Card |
| 063 | Security Violation |
| 065 | Exceeds withdrawal frequency |
| 075 | PIN Try Exceeded |
| 076 | Unable to Locate Previous Message |
| 0N4 | Exceeds Issuer Withdrawal Limit |
| 0N7 | CVV2 Failure |
| 0N0 | Unable to Authorize |
| 0P5 | PIN Change/Unblock Request Declined |
| 0Q1 | Invalid Card Authentication Data |
| 0R0 | Stop Payment Order |
| 0R1 | Revocation of Authorization Order |
| 0R3 | Revocation of All Authorizations Order |
| 0TA | Local Transaction; Time-Out at Issuer System Detected |
| 0XA | Forward to Issuer |
| 0XD | Forward to Issuer |
mastercard
| Code | Meaning |
|---|---|
| 19 | 22 Mer Not Qual or Re-enter Transaction |
| 28 | 22 Mer Not Qual or File Temporarily Unavailable |
| 39 | 22 Mer Not Qual or No Credit Account |
| 58 | Function Not Permitted to Merchant |
| 68 | Response Received Too Late |
| 78 | Blocked, First Used |
| 79 | Transaction Not Permitted to Acquirer/Terminal |
| 82 | Transaction Not Permitted to Acquirer/Terminal |
| 83 | Transaction Not Permitted to Acquirer/Terminal |
| 85 | No Reason to Decline |
| 91 | Issuer or Switch Inoperative |
| 92 | Routing Error |
| 94 | Duplicate Transaction |
| 96 | System Malfunction |
| 000 | Approval |
| 003 | 22 Mer Not Qual or Honor with Identification |
| 004 | Not used at this time |
| 005 | 22 Mer Not Qual or Do Not Honor |
| 012 | 22 Mer Not Qual or Invalid Transaction |
| 013 | 22 Mer Not Qual or Invalid Amount |
| 014 | 22 Mer Not Qual or Invalid Card Number |
| 015 | 22 Mer Not Qual or Invalid Issuer |
| 021 | 22 Mer Not Qual or Unable to Back Out Transaction |
| 025 | 22 Mer Not Qual or Unable to Locate Record On File |
| 041 | Lost Card - Pick Up (Fraud Account) |
| 043 | Stolen Card - Pick Up (Fraud Account) |
| 046 | Closed Account |
| 051 | Insufficient Funds |
| 052 | No Checking Account |
| 053 | No Savings Account |
| 054 | Expired Card |
| 055 | Incorrect PIN |
| 056 | No Card Record |
| 057 | Function Not Permitted to Cardholder |
| 061 | Exceeds Approval Amount Limit |
| 062 | Restricted Card |
| 063 | Security Violation |
| 065 | Exceeds Withdrawal Frequency Limit |
| 075 | Allowable number of PIN-Entry tries exceeded - Card Locked |
| 0N0 | Unable to Authorize |
| 0N3 | Cash Back Service Not Available |
| 0N4 | Exceeds Issuer Withdrawal Limit |
| 0N7 | CVV2 Failure |
| 0P5 | PIN Change/Unblock Request Declined |
| 0Q1 | Invalid Card Authentication Data |
| 0R0 | Stop Payment Order |
| 0R1 | Revocation of Authorization Order |
| 0R3 | Revocation of All Authorizations Order |
| 0XA | Forward to Issuer |
| 0XD | Forward to Issuer |
AVS result codes
| Code | Meaning |
|---|---|
| 0 | AVS Error - Retry, System unavailable or Timed out |
| A | Address Match Only |
| B | Address Match, Postal Code not verified |
| C | No Match |
| D | Address and Postal Code Match |
| E | AVS Error - Ineligible (not a mail/phone order) |
| F | Address and Postal Code Match (UK only) |
| G | Non-US Issuer does not participate |
| I | Address not verified, Postal Code not verified |
| M | Address and Postal Code Match |
| N | No Match |
| P | Postal Code Match, Address not verified |
| R | Issuer System Unavailable |
| S | Service not Supported |
| U | Address unavailable |
| W | 9-digit Postal Code Match, Address no match |
| X | Exact match, 9-digit Postal Code |
| Y | Address and 5-digit Postal Code Match |
| Z | 5-digit Postal Code Match, Address no match |
CVV result codes
| Code | Meaning |
|---|---|
| M | CVV2 Match |
| N | CVV2 No Match |
| P | Not Processed |
| S | CVV2 should be on card but merchant indicates not present |
| U | Issuer not certified |
Code samples
Copy-paste ready code in your preferred language for the Test environment.
API call
Copy/paste friendly
curl -X POST "https://cert.merchante-solutions.com/mes-api/transaction" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "profile_id=YOUR_PROFILE_ID_HERE" \
--data-urlencode "profile_key=YOUR_PROFILE_KEY_HERE" \
--data-urlencode "transaction_type=U" \
--data-urlencode "transaction_id=8fc94e10b12130f4ab8a8ceeac40fc69" \
--data-urlencode "transaction_amount=12.30" \
--data-urlencode "retry_id=REFUND001"