{"title":"Refund a transaction from the PED","category":"default","creationDate":1776961627,"content":"<p>Cancel or refund a transaction from the terminal transaction list, and receive a receipt on the POS or on the PED.<\/p>\n<div class=\"sc-notice note\"><div>\n<p>You can only use this cancel or refund method for transactions that:<\/p>\n<ul>\n<li>have been completed on the PED that is receiving the cancel or refund request.<\/li>\n<li>are still within the PED storage \u2013 this is currently limited to 100 tenders.<\/li>\n<\/ul>\n<\/div><\/div>\n<h2 id=\"implement-the-callback\">Implement the callback<\/h2>\n<p>Implement the callback based on the signature in the <span translate=\"no\"><strong>cancel_or_refund_on_terminal_extern.h<\/strong><\/span>\u00a0file and pass this as a parameter of the\u00a0<span translate=\"no\"><strong>cancel_or_refund_on_terminal_allocate<\/strong><\/span>\u00a0call. For more information on how to do this, see\u00a0<a href=\"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/calls-and-callbacks-c-library\/implement-callbacks\">Implement callbacks<\/a>.<\/p>\n<h2 id=\"allocate-the-request-struct\">Allocate the request struct<\/h2>\n<p>Allocates, initializes and returns a\u00a0<code>cancel_or_refund_on_terminal_request<\/code> struct. Populate the request by performing string duplication.<\/p>\n<p>To specify where you want to receive the receipt, use the\u00a0<code>handle_receipt<\/code>\u00a0field in the\u00a0<code>cancel_or_refund_on_terminal_request<\/code>\u00a0struct:\u00a0<\/p>\n<ul>\n<li>To handle and print the receipt on the POS, set the\u00a0<code>handle_receipt<\/code> field to <span translate=\"no\"><strong>true<\/strong><\/span>.\u00a0<\/li>\n<li>To have the PED print the receipt, omit\u00a0the\u00a0<code>handle_receipt<\/code> field\u00a0(if the terminal has no printer, the transaction will fail).<\/li>\n<\/ul>\n<p>If you want the data for later use, retain it, or it will be released automatically.<\/p>\n<table><thead><tr class=\"header\"><th>Name<\/th><th>Description<\/th><\/tr><\/thead><tbody><tr><td><p><code>cancel_or_refund_on_terminal_allocate<\/code><\/p><\/td><td><p>Allocates, initializes and returns a\u00a0<code>cancel_or_refund_on_terminal_request<\/code>\u00a0struct. Populate the request by performing string duplication.<\/p><p>If you want the data for later use, retain it, or it will be released automatically.<\/p><\/td><\/tr><\/tbody><\/table>\n<h2 id=\"call-the-cancel_or_refund_on_terminal-function\">Call the cancel_or_refund_on_terminal function<\/h2>\n<p>Call the\u00a0<code>cancel_or_refund_on_terminal<\/code> function to cancel or refund a completed transaction from the terminal transaction list. The transaction must have been completed on the PED that is receiving the cancel or refund request, and must be still within the PED storage (this is currently limited to 100 tenders.)<\/p>\n<h3 id=\"parameters\">Parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Value<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>cancel_or_refund_on_terminal_request<\/code><\/td>\n<td>Pointer to the <code>cancel_or_refund_on_terminal_request<\/code> struct, this struct contains all the input parameters for this call.<\/td>\n<\/tr>\n<tr>\n<td><code>cancel_or_refund_on_terminal_response<\/code><\/td>\n<td>Pointer to the callback function in the POS that will be called with the results of the <code>cancel_or_refund_on_terminal<\/code> call<\/td>\n<\/tr>\n<tr>\n<td><code>echo_struct<\/code><\/td>\n<td>Pointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2 id=\"handle-the-callback\">Handle the callback<\/h2>\n<p>The\u00a0<code>cancel_or_refund_on_terminal_CB<\/code>\u00a0returns the immediate response to the call and a pointer to the POS-defined echo struct.<\/p>\n<h3 id=\"parameters-1\">Parameters<\/h3>\n<table>\n<thead>\n<tr>\n<th>Value<\/th>\n<th>Description<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>cancel_or_refund_on_terminal_response<\/code><\/td>\n<td>Pointer to the callback function in the POS that will be called with the results of the <code>cancel_or_refund_on_terminal<\/code> call<\/td>\n<\/tr>\n<tr>\n<td><code>echo_struct<\/code><\/td>\n<td>Pointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>","url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/cancel-or-refund-a-transaction-c-library\/refund-a-transaction-from-the-ped-c","articleFields":{"id":"39944656","type":"page","_expandable":{"operations":""},"status":"current"},"algolia":{"url":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/cancel-or-refund-a-transaction-c-library\/refund-a-transaction-from-the-ped-c","title":"Refund a transaction from the PED","content":"Cancel or refund a transaction from the terminal transaction list, and receive a receipt on the POS or on the PED.\n\nYou can only use this cancel or refund method for transactions that:\n\nhave been completed on the PED that is receiving the cancel or refund request.\nare still within the PED storage \u2013 this is currently limited to 100 tenders.\n\n\nImplement the callback\nImplement the callback based on the signature in the cancel_or_refund_on_terminal_extern.h\u00a0file and pass this as a parameter of the\u00a0cancel_or_refund_on_terminal_allocate\u00a0call. For more information on how to do this, see\u00a0Implement callbacks.\nAllocate the request struct\nAllocates, initializes and returns a\u00a0cancel_or_refund_on_terminal_request struct. Populate the request by performing string duplication.\nTo specify where you want to receive the receipt, use the\u00a0handle_receipt\u00a0field in the\u00a0cancel_or_refund_on_terminal_request\u00a0struct:\u00a0\n\nTo handle and print the receipt on the POS, set the\u00a0handle_receipt field to true.\u00a0\nTo have the PED print the receipt, omit\u00a0the\u00a0handle_receipt field\u00a0(if the terminal has no printer, the transaction will fail).\n\nIf you want the data for later use, retain it, or it will be released automatically.\nNameDescriptioncancel_or_refund_on_terminal_allocateAllocates, initializes and returns a\u00a0cancel_or_refund_on_terminal_request\u00a0struct. Populate the request by performing string duplication.If you want the data for later use, retain it, or it will be released automatically.\nCall the cancel_or_refund_on_terminal function\nCall the\u00a0cancel_or_refund_on_terminal function to cancel or refund a completed transaction from the terminal transaction list. The transaction must have been completed on the PED that is receiving the cancel or refund request, and must be still within the PED storage (this is currently limited to 100 tenders.)\nParameters\n\n\n\nValue\nDescription\n\n\n\n\ncancel_or_refund_on_terminal_request\nPointer to the cancel_or_refund_on_terminal_request struct, this struct contains all the input parameters for this call.\n\n\ncancel_or_refund_on_terminal_response\nPointer to the callback function in the POS that will be called with the results of the cancel_or_refund_on_terminal call\n\n\necho_struct\nPointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.\n\n\n\nHandle the callback\nThe\u00a0cancel_or_refund_on_terminal_CB\u00a0returns the immediate response to the call and a pointer to the POS-defined echo struct.\nParameters\n\n\n\nValue\nDescription\n\n\n\n\ncancel_or_refund_on_terminal_response\nPointer to the callback function in the POS that will be called with the results of the cancel_or_refund_on_terminal call\n\n\necho_struct\nPointer to a POS defined struct. Returned in the callback. It can be used to share a POS data struct between the call to the library and the callback from the library in response to the call.\n\n\n","type":"page","locale":"pt","boost":13,"hierarchy":{"lvl0":"Home","lvl1":"Terminais","lvl2":"Deprecation of classic libraries","lvl3":"Library integrations","lvl4":"C library integration","lvl5":"Key steps","lvl6":"Cancel or refund a transaction","lvl7":"Refund a transaction from the PED"},"hierarchy_url":{"lvl0":"https:\/\/docs.adyen.com\/pt","lvl1":"https:\/\/docs.adyen.com\/pt\/point-of-sale","lvl2":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation","lvl3":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations","lvl4":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration","lvl5":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library","lvl6":"https:\/\/docs.adyen.com\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/cancel-or-refund-a-transaction-c-library","lvl7":"\/pt\/point-of-sale\/classic-library-deprecation\/classic-library-integrations\/c-library-integration\/key-steps-c-library\/cancel-or-refund-a-transaction-c-library\/refund-a-transaction-from-the-ped-c"},"levels":8,"category":"In-person payments","category_color":"green","tags":["Refund","transaction"]}}
