# Reverse transaction GET https://api-sandbox.payabli.com/api/MoneyIn/reverse/{transId}/{amount} A reversal either refunds or voids a transaction independent of the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. You don't need to know whether the transaction is settled or not. Reference: https://docs.payabli.com/developers/api-reference/moneyin/reverse-a-transaction ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Reverse a transaction version: endpoint_moneyIn.Reverse paths: /MoneyIn/reverse/{transId}/{amount}: get: operationId: reverse summary: Reverse a transaction description: >- A reversal either refunds or voids a transaction independent of the transaction's settlement status. Send a reversal request for a transaction, and Payabli automatically determines whether it's a refund or void. You don't need to know whether the transaction is settled or not. tags: - - subpackage_moneyIn parameters: - name: transId in: path description: ReferenceId for the transaction (PaymentId). required: true schema: type: string - name: amount in: path description: >- Amount to reverse from original transaction, minus any service fees charged on the original transaction. The amount provided can't be greater than the original total amount of the transaction, minus service fees. For example, if a transaction was $90 plus a $10 service fee, you can reverse up to $90. An amount equal to zero will refunds the total amount authorized minus any service fee. required: true schema: type: number format: double - name: requestToken in: header required: true schema: type: string responses: '200': description: Ok content: application/json: schema: $ref: '#/components/schemas/type_moneyIn:ReverseResponse' '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} components: schemas: type_:Responsecode: type: integer type_:PageIdentifier: type: string type_:IsSuccess: type: boolean type_:ResponseText: type: string type_:Authcode: type: string type_:ExpectedProcessingDateTime: type: string format: date-time type_:AvsResponseText: type: string type_:CustomerId: type: integer format: int64 type_:CvvResponseText: type: string type_:MethodReferenceId: type: string type_:Referenceidtrans: type: string type_:ResultCode: type: integer type_moneyIn:ResponseDataRefunds: type: object properties: authCode: $ref: '#/components/schemas/type_:Authcode' expectedProcessingDateTime: oneOf: - $ref: '#/components/schemas/type_:ExpectedProcessingDateTime' - type: 'null' avsResponseText: $ref: '#/components/schemas/type_:AvsResponseText' description: This field isn't applicable to refund operations. customerId: oneOf: - $ref: '#/components/schemas/type_:CustomerId' - type: 'null' cvvResponseText: oneOf: - $ref: '#/components/schemas/type_:CvvResponseText' - type: 'null' description: This field isn't applicable to refund operations. methodReferenceId: oneOf: - $ref: '#/components/schemas/type_:MethodReferenceId' - type: 'null' description: This field isn't applicable to refund operations. referenceId: $ref: '#/components/schemas/type_:Referenceidtrans' resultCode: $ref: '#/components/schemas/type_:ResultCode' resultText: type: string description: Text description of the transaction result required: - authCode - expectedProcessingDateTime - customerId - cvvResponseText - methodReferenceId - referenceId - resultCode - resultText type_moneyIn:ReverseResponse: type: object properties: responseCode: $ref: '#/components/schemas/type_:Responsecode' pageIdentifier: $ref: '#/components/schemas/type_:PageIdentifier' roomId: type: integer isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseText: $ref: '#/components/schemas/type_:ResponseText' responseData: $ref: '#/components/schemas/type_moneyIn:ResponseDataRefunds' required: - responseCode - roomId - isSuccess - responseText - responseData ``` ## SDK Code Examples ```python Void from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.money_in.reverse( amount=0.0, trans_id="10-3ffa27df-b171-44e0-b251-e95fbfc7a723", ) ``` ```typescript Void import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 0); ``` ```go Void import ( context "context" option "github.com/payabli/sdk-go/option" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.MoneyIn.Reverse( context.TODO(), 0, "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", ) ``` ```csharp Void using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.MoneyIn.ReverseAsync(0, "10-3ffa27df-b171-44e0-b251-e95fbfc7a723"); ``` ```ruby Void require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["requestToken"] = '' response = http.request(request) puts response.read_body ``` ```java Void HttpResponse response = Unirest.get("https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0") .header("requestToken", "") .asString(); ``` ```php Void request('GET', 'https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift Void import Foundation let headers = ["requestToken": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/0")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ``` ```python Refund from payabli import payabli client = payabli( api_key="YOUR_API_KEY", ) client.money_in.reverse( amount=53.76, trans_id="10-3ffa27df-b171-44e0-b251-e95fbfc7a723", ) ``` ```typescript Refund import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.moneyIn.reverse("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", 53.76); ``` ```go Refund import ( context "context" option "github.com/payabli/sdk-go/option" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.MoneyIn.Reverse( context.TODO(), 0, "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", ) ``` ```csharp Refund using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.MoneyIn.ReverseAsync(53.76, "10-3ffa27df-b171-44e0-b251-e95fbfc7a723"); ``` ```ruby Refund require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["requestToken"] = '' response = http.request(request) puts response.read_body ``` ```java Refund HttpResponse response = Unirest.get("https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76") .header("requestToken", "") .asString(); ``` ```php Refund request('GET', 'https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76', [ 'headers' => [ 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift Refund import Foundation let headers = ["requestToken": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/reverse/10-3ffa27df-b171-44e0-b251-e95fbfc7a723/53.76")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```