Use a Void operation to cancel a transaction that has not yet been settled (i.e., is still in an open batch). Voiding a transaction prevents it from being completed and removes the hold on the customer’s funds. This is typically used to correct errors or cancel sales before they are finalized.
Key Points:
| Environment | HTTP Method | URL |
|---|---|---|
| Sandbox | PUT | https://api.pit.paygateway.com/transactions/ |
| Production | PUT | https://api.paygateway.com/transactions/ |
To perform a void request on the relevant transaction type, you can use the ID assigned by the REST API or you can use the Reference ID you set in the transaction request. Regardless of which identifier you are using, the URL path will change based on the original transaction type.
| Transaction Type | URL |
|---|---|
| Credit Sale | {base url}/creditsales/{creditsale_id}/voids or {base url}/creditsales/reference_id/{reference_id}/voids |
| Credit Auth | {base url}/creditauths/{creditauth_id}/voids or {base url}/creditauths/reference_id/{reference_id}/voids |
| Loan Sale | {base url}/loansales/{loansale_id}/voids or {base url}/loansales/reference_id/{reference_id}/voids |
| Credit Refund | {base url}/creditreturns/{creditreturn_id}/voids or {base url}/creditreturns/reference_id/{reference_id}/voids |
| Loan Refund | {base url}/transactions/loanreturns/{loanreturn_id}/voids or {base url}/loanreturns/reference_id/{reference_id}/voids |
Important: For authentication, you must include the required headers in each request. For more information, please refer to Authenticating Your Requests.
To cancel a credit sale that is in an open batch, send a PUT request to the relevant endpoint. You can void sales only in an open batch. If the sale is in a closed batch, refund the transaction instead.
Content-Type: application/json
Authorization: AuthToken {AuthTokenV2}
X-GP-Request-Id: {request_id}
X-GP-Version: 2021-04-08
X-GP-Api-Key: {API Key}
X-GP-Partner-App-Name: {Name of integrating application}
{
"payment": {
"amount": "23.09"
},
"transaction": {
"processing_indicators": {
"generate_receipt": true
},
"terminal": {
"certification_id": "OEXXXX.0",
"pos_type": "MOBILE"
}
}
}{
"creditsale_id": "000008639902",
"reference_id": "XAZR863990",
"status": "approved",
"card": {
"masked_card_number": "XXXXXXXXXXX5538",
"expiry_month": "03",
"expiry_year": "35",
"type": "visa"
},
"payment": {
"amount": "23.09",
"type": "credit"
},
"transaction": {
"batch_amount": "12.09",
"batch_number": "001333"
},
"receipt": {
"id": "72845",
"text": {
"customer_receipt": "\\nBatch # 000161\\nTrans ID 000000141687\\nOrder ID PAYAPIa0155b35-420c-\\n 46a5-9b0a-f01ac0004a\\n 76\\nReceipt # 123456890\\nTrans Type Return\\nClerk ID Al090\\nDate/Time 2018-12-10 21:56:16\\nCard Type Visa\\nCard Number XXXXXXXXXXXX2222\\nEntry Legend MAG STRIPE\\nEntry Method CONTACTLESS\\nApproval Code 577279\\n\\nTotal Amount USD$132.00\\n\\n Approved - Thank You\\n\\n X____________________________________\\n Signature: Joe Doe\\n\\n ****Customer Copy****\\n Retain this copy for statement\\n verification",
"merchant_receipt": "\\nBatch # 000161\\nTrans ID 000000141687\\nOrder ID PAYAPIa0155b35-420c-\\n 46a5-9b0a-f01ac0004a\\n 76\\nReceipt # 123456890\\nTrans Type Return\\nClerk ID Al090\\nDate/Time 2018-12-10 21:56:16\\nCard Type Visa\\nCard Number XXXXXXXXXXXX2222\\nEntry Legend MAG STRIPE\\nEntry Method CONTACTLESS\\nApproval Code 577279\\n\\nTotal Amount USD$132.00\\n\\n Approved - Thank You\\n\\n X____________________________________\\n Signature: Joe Doe\\n\\n ****Merchant Copy****"
},
"attributes": {
"authorization_agreement": "I agree to pay above total amount according to card issuer agreement",
"call_issuer": "CALL ISSUER",
"copy_label_customer": "****Customer Copy**** Retain this copy for statement verification",
"copy_label_merchant": "MERCHANT COPY",
"merchant_address": "2578 West 600 North",
"merchant_footer": "Thank you. Come again.",
"merchant_header": "ABC Grocery",
"merchant_name": "ABC Stores",
"merchant_phone": "901-492-7269",
"merchant_policy": "Generally, merchandise purchased in store or online can be returned or exchanged within ninety (90) days of purchase with or without a receipt",
"verbiage": "Approved - Thank You"
},
"labeled_attributes": {
"amount": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"approval_code": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"authorization_response_code": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"avs_response_code": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"batch_number": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"card_balance": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"card_type": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"cardsecurity_response_code": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"clerk_id": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"entry_legend": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"entry_method": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"gratuity_amount": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"masked_card_number": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"merchant_id": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"original_auth_code": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"payment_type": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"number": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"reference_id": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"subtotal_amount": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"total_amount": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"transaction_datetime": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"transaction_id": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"transaction_type": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"validation_code": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"application_cryptogram": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"application_identifier": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"application_label": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"application_preferred_name": {
"label": "Total Amount",
"value": "$99.45 USD"
},
"application_transaction_counter": {
"label": "Total Amount",
"value": "$99.45 USD"
}
}
},
"links": [
{
"creditsale_id": [
{
"href": "https://api.paygateway.com/cnp-payments/sales/000000106821",
"relation": "self",
"method": "POST",
"description": "Use this endpoint to retrieve a previous sales transaction using reference id."
}
],
"reference_id": [
{
"href": "https://api.paygateway.com/cnp-payments/sales/000000106821",
"relation": "self",
"method": "POST",
"description": "Use this endpoint to retrieve a previous sales transaction using reference id."
}
]
}
]
}