# Refund split transaction POST https://api-sandbox.payabli.com/api/MoneyIn/refund/{transId} Content-Type: application/json Refunds a settled transaction with split instructions. Reference: https://docs.payabli.com/developers/api-reference/moneyin/refund-a-settled-transaction-with-instructions ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Refund a settled transaction with split instructions version: endpoint_moneyIn.RefundWithInstructions paths: /MoneyIn/refund/{transId}: post: operationId: refund-with-instructions summary: Refund a settled transaction with split instructions description: Refunds a settled transaction with split instructions. tags: - - subpackage_moneyIn parameters: - name: transId in: path description: ReferenceId for the transaction (PaymentId). required: true schema: type: string - name: requestToken in: header required: true schema: type: string - name: idempotencyKey in: header required: false schema: $ref: '#/components/schemas/type_:IdempotencyKey' responses: '200': description: Success content: application/json: schema: $ref: >- #/components/schemas/type_moneyIn:RefundWithInstructionsResponse '400': description: Bad request/ invalid data content: {} '401': description: Unauthorized request. content: {} '500': description: Internal API Error content: {} '503': description: Database connection error content: {} requestBody: content: application/json: schema: type: object properties: amount: type: number format: double description: >- Amount to refund 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 refund up to $90. An amount equal to zero will refund the total amount authorized minus any service fee. ipaddress: $ref: '#/components/schemas/type_:IpAddress' orderDescription: $ref: '#/components/schemas/type_:Orderdescription' orderId: $ref: '#/components/schemas/type_:OrderId' refundDetails: $ref: '#/components/schemas/type_:RefundDetail' source: $ref: '#/components/schemas/type_:Source' components: schemas: type_:IdempotencyKey: type: string type_:IpAddress: type: string type_:Orderdescription: type: string type_:OrderId: type: string type_:PaymentCategories: type: object properties: amount: type: number format: double description: Price/cost per unit of item or category. description: type: string description: Description of item or category label: type: string description: Name of item or category. qty: type: integer default: 1 description: Quantity of item or category required: - amount - label type_:SplitFundingRefundContent: type: object properties: accountId: type: string description: The accountId for the account the transaction was routed to. amount: type: number format: double description: The amount to refund to this account. description: type: string description: Refund description. originationEntryPoint: type: string description: The entrypoint the transaction belongs to. type_:RefundDetail: type: object properties: categories: type: array items: $ref: '#/components/schemas/type_:PaymentCategories' description: >- Array of payment categories/line items describing the amount to be paid. Note: These categories are for information only and aren't validated against the total amount provided. splitRefunding: type: array items: $ref: '#/components/schemas/type_:SplitFundingRefundContent' description: Array of objects containing split instructions for the refund. type_:Source: type: string type_:ResponseText: type: string type_:IsSuccess: type: boolean 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_:PageIdentifier: type: string type_moneyIn:RefundWithInstructionsResponse: type: object properties: responseText: $ref: '#/components/schemas/type_:ResponseText' isSuccess: $ref: '#/components/schemas/type_:IsSuccess' responseData: $ref: '#/components/schemas/type_moneyIn:ResponseDataRefunds' pageidentifier: $ref: '#/components/schemas/type_:PageIdentifier' required: - responseText - isSuccess - responseData ``` ## SDK Code Examples ```python FullSplitRefund from payabli import RefundDetail, SplitFundingRefundContent, payabli client = payabli( api_key="YOUR_API_KEY", ) client.money_in.refund_with_instructions( trans_id="10-3ffa27df-b171-44e0-b251-e95fbfc7a723", idempotency_key="8A29FC40-CA47-1067-B31D-00DD010662DB", source="api", order_description="Materials deposit", amount=100.0, refund_details=RefundDetail( split_refunding=[ SplitFundingRefundContent( origination_entry_point="7f1a381696", account_id="187-342", description="Refunding undelivered materials", amount=60.0, ), SplitFundingRefundContent( origination_entry_point="7f1a381696", account_id="187-343", description="Refunding deposit for undelivered materials", amount=40.0, ), ], ), ) ``` ```typescript FullSplitRefund import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.moneyIn.refundWithInstructions("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", { idempotencyKey: "8A29FC40-CA47-1067-B31D-00DD010662DB", source: "api", orderDescription: "Materials deposit", amount: 100, refundDetails: { splitRefunding: [{ originationEntryPoint: "7f1a381696", accountId: "187-342", description: "Refunding undelivered materials", amount: 60 }, { originationEntryPoint: "7f1a381696", accountId: "187-343", description: "Refunding deposit for undelivered materials", amount: 40 }] } }); ``` ```go FullSplitRefund import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.MoneyIn.RefundWithInstructions( context.TODO(), "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", &sdkgo.RequestRefund{ IdempotencyKey: sdkgo.String( "8A29FC40-CA47-1067-B31D-00DD010662DB", ), Source: sdkgo.String( "api", ), OrderDescription: sdkgo.String( "Materials deposit", ), Amount: sdkgo.Float64( 100, ), RefundDetails: &sdkgo.RefundDetail{ SplitRefunding: []*sdkgo.SplitFundingRefundContent{ &sdkgo.SplitFundingRefundContent{ OriginationEntryPoint: sdkgo.String( "7f1a381696", ), AccountId: sdkgo.String( "187-342", ), Description: sdkgo.String( "Refunding undelivered materials", ), Amount: sdkgo.Float64( 60, ), }, &sdkgo.SplitFundingRefundContent{ OriginationEntryPoint: sdkgo.String( "7f1a381696", ), AccountId: sdkgo.String( "187-343", ), Description: sdkgo.String( "Refunding deposit for undelivered materials", ), Amount: sdkgo.Float64( 40, ), }, }, }, }, ) ``` ```csharp FullSplitRefund using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.MoneyIn.RefundWithInstructionsAsync( "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", new RequestRefund { IdempotencyKey = "8A29FC40-CA47-1067-B31D-00DD010662DB", Source = "api", OrderDescription = "Materials deposit", Amount = 100, RefundDetails = new RefundDetail { SplitRefunding = new List() { new SplitFundingRefundContent { OriginationEntryPoint = "7f1a381696", AccountId = "187-342", Description = "Refunding undelivered materials", Amount = 60, }, new SplitFundingRefundContent { OriginationEntryPoint = "7f1a381696", AccountId = "187-343", Description = "Refunding deposit for undelivered materials", Amount = 40, }, }, }, } ); ``` ```ruby FullSplitRefund require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["idempotencyKey"] = '8A29FC40-CA47-1067-B31D-00DD010662DB' request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"amount\": 100,\n \"orderDescription\": \"Materials deposit\",\n \"refundDetails\": {\n \"splitRefunding\": [\n {\n \"accountId\": \"187-342\",\n \"amount\": 60,\n \"description\": \"Refunding undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n },\n {\n \"accountId\": \"187-343\",\n \"amount\": 40,\n \"description\": \"Refunding deposit for undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n }\n ]\n },\n \"source\": \"api\"\n}" response = http.request(request) puts response.read_body ``` ```java FullSplitRefund HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723") .header("idempotencyKey", "8A29FC40-CA47-1067-B31D-00DD010662DB") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"amount\": 100,\n \"orderDescription\": \"Materials deposit\",\n \"refundDetails\": {\n \"splitRefunding\": [\n {\n \"accountId\": \"187-342\",\n \"amount\": 60,\n \"description\": \"Refunding undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n },\n {\n \"accountId\": \"187-343\",\n \"amount\": 40,\n \"description\": \"Refunding deposit for undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n }\n ]\n },\n \"source\": \"api\"\n}") .asString(); ``` ```php FullSplitRefund request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723', [ 'body' => '{ "amount": 100, "orderDescription": "Materials deposit", "refundDetails": { "splitRefunding": [ { "accountId": "187-342", "amount": 60, "description": "Refunding undelivered materials", "originationEntryPoint": "7f1a381696" }, { "accountId": "187-343", "amount": 40, "description": "Refunding deposit for undelivered materials", "originationEntryPoint": "7f1a381696" } ] }, "source": "api" }', 'headers' => [ 'Content-Type' => 'application/json', 'idempotencyKey' => '8A29FC40-CA47-1067-B31D-00DD010662DB', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift FullSplitRefund import Foundation let headers = [ "idempotencyKey": "8A29FC40-CA47-1067-B31D-00DD010662DB", "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "amount": 100, "orderDescription": "Materials deposit", "refundDetails": ["splitRefunding": [ [ "accountId": "187-342", "amount": 60, "description": "Refunding undelivered materials", "originationEntryPoint": "7f1a381696" ], [ "accountId": "187-343", "amount": 40, "description": "Refunding deposit for undelivered materials", "originationEntryPoint": "7f1a381696" ] ]], "source": "api" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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 PartialSplitRefund from payabli import RefundDetail, SplitFundingRefundContent, payabli client = payabli( api_key="YOUR_API_KEY", ) client.money_in.refund_with_instructions( trans_id="10-3ffa27df-b171-44e0-b251-e95fbfc7a723", idempotency_key="8A29FC40-CA47-1067-B31D-00DD010662DB", source="api", order_description="Materials deposit", amount=70.0, refund_details=RefundDetail( split_refunding=[ SplitFundingRefundContent( origination_entry_point="7f1a381696", account_id="187-342", description="Refunding undelivered materials", amount=40.0, ), SplitFundingRefundContent( origination_entry_point="7f1a381696", account_id="187-343", description="Refunding deposit for undelivered materials", amount=30.0, ), ], ), ) ``` ```typescript PartialSplitRefund import { PayabliClient } from "@payabli/sdk-node"; const client = new PayabliClient({ apiKey: "YOUR_API_KEY" }); await client.moneyIn.refundWithInstructions("10-3ffa27df-b171-44e0-b251-e95fbfc7a723", { idempotencyKey: "8A29FC40-CA47-1067-B31D-00DD010662DB", source: "api", orderDescription: "Materials deposit", amount: 70, refundDetails: { splitRefunding: [{ originationEntryPoint: "7f1a381696", accountId: "187-342", description: "Refunding undelivered materials", amount: 40 }, { originationEntryPoint: "7f1a381696", accountId: "187-343", description: "Refunding deposit for undelivered materials", amount: 30 }] } }); ``` ```go PartialSplitRefund import ( context "context" option "github.com/payabli/sdk-go/option" sdkgo "github.com/payabli/sdk-go" sdkgoclient "github.com/payabli/sdk-go/client" ) client := sdkgoclient.NewClient( option.WithApiKey( "", ), ) response, err := client.MoneyIn.RefundWithInstructions( context.TODO(), "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", &sdkgo.RequestRefund{ IdempotencyKey: sdkgo.String( "8A29FC40-CA47-1067-B31D-00DD010662DB", ), Source: sdkgo.String( "api", ), OrderDescription: sdkgo.String( "Materials deposit", ), Amount: sdkgo.Float64( 100, ), RefundDetails: &sdkgo.RefundDetail{ SplitRefunding: []*sdkgo.SplitFundingRefundContent{ &sdkgo.SplitFundingRefundContent{ OriginationEntryPoint: sdkgo.String( "7f1a381696", ), AccountId: sdkgo.String( "187-342", ), Description: sdkgo.String( "Refunding undelivered materials", ), Amount: sdkgo.Float64( 60, ), }, &sdkgo.SplitFundingRefundContent{ OriginationEntryPoint: sdkgo.String( "7f1a381696", ), AccountId: sdkgo.String( "187-343", ), Description: sdkgo.String( "Refunding deposit for undelivered materials", ), Amount: sdkgo.Float64( 40, ), }, }, }, }, ) ``` ```csharp PartialSplitRefund using PayabliApi; var client = new PayabliApiClient("API_KEY"); await client.MoneyIn.RefundWithInstructionsAsync( "10-3ffa27df-b171-44e0-b251-e95fbfc7a723", new RequestRefund { IdempotencyKey = "8A29FC40-CA47-1067-B31D-00DD010662DB", Source = "api", OrderDescription = "Materials deposit", Amount = 70, RefundDetails = new RefundDetail { SplitRefunding = new List() { new SplitFundingRefundContent { OriginationEntryPoint = "7f1a381696", AccountId = "187-342", Description = "Refunding undelivered materials", Amount = 40, }, new SplitFundingRefundContent { OriginationEntryPoint = "7f1a381696", AccountId = "187-343", Description = "Refunding deposit for undelivered materials", Amount = 30, }, }, }, } ); ``` ```ruby PartialSplitRefund require 'uri' require 'net/http' url = URI("https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["idempotencyKey"] = '8A29FC40-CA47-1067-B31D-00DD010662DB' request["requestToken"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"amount\": 70,\n \"orderDescription\": \"Materials deposit\",\n \"refundDetails\": {\n \"splitRefunding\": [\n {\n \"accountId\": \"187-342\",\n \"amount\": 40,\n \"description\": \"Refunding undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n },\n {\n \"accountId\": \"187-343\",\n \"amount\": 30,\n \"description\": \"Refunding deposit for undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n }\n ]\n },\n \"source\": \"api\"\n}" response = http.request(request) puts response.read_body ``` ```java PartialSplitRefund HttpResponse response = Unirest.post("https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723") .header("idempotencyKey", "8A29FC40-CA47-1067-B31D-00DD010662DB") .header("requestToken", "") .header("Content-Type", "application/json") .body("{\n \"amount\": 70,\n \"orderDescription\": \"Materials deposit\",\n \"refundDetails\": {\n \"splitRefunding\": [\n {\n \"accountId\": \"187-342\",\n \"amount\": 40,\n \"description\": \"Refunding undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n },\n {\n \"accountId\": \"187-343\",\n \"amount\": 30,\n \"description\": \"Refunding deposit for undelivered materials\",\n \"originationEntryPoint\": \"7f1a381696\"\n }\n ]\n },\n \"source\": \"api\"\n}") .asString(); ``` ```php PartialSplitRefund request('POST', 'https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723', [ 'body' => '{ "amount": 70, "orderDescription": "Materials deposit", "refundDetails": { "splitRefunding": [ { "accountId": "187-342", "amount": 40, "description": "Refunding undelivered materials", "originationEntryPoint": "7f1a381696" }, { "accountId": "187-343", "amount": 30, "description": "Refunding deposit for undelivered materials", "originationEntryPoint": "7f1a381696" } ] }, "source": "api" }', 'headers' => [ 'Content-Type' => 'application/json', 'idempotencyKey' => '8A29FC40-CA47-1067-B31D-00DD010662DB', 'requestToken' => '', ], ]); echo $response->getBody(); ``` ```swift PartialSplitRefund import Foundation let headers = [ "idempotencyKey": "8A29FC40-CA47-1067-B31D-00DD010662DB", "requestToken": "", "Content-Type": "application/json" ] let parameters = [ "amount": 70, "orderDescription": "Materials deposit", "refundDetails": ["splitRefunding": [ [ "accountId": "187-342", "amount": 40, "description": "Refunding undelivered materials", "originationEntryPoint": "7f1a381696" ], [ "accountId": "187-343", "amount": 30, "description": "Refunding deposit for undelivered materials", "originationEntryPoint": "7f1a381696" ] ]], "source": "api" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api-sandbox.payabli.com/api/MoneyIn/refund/10-3ffa27df-b171-44e0-b251-e95fbfc7a723")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data 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() ```