> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.mercoa.com/embedded-ap-ar/api-reference/calculate/payment-timing/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mercoa.com/_mcp/server. # Calculate payment timing POST https://api.mercoa.com/paymentTiming Content-Type: application/json Calculate the estimated payment timing given the deduction date, payment source, and disbursement method. Can be used to calculate timing for a payment. Reference: https://docs.mercoa.com/embedded-ap-ar/api-reference/calculate/payment-timing ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Request ### Body (application/json) This endpoint expects an object or object. - `object or object` - Estimated Timing - `paymentSourceId` (string, required) — ID of payment source. - `paymentDestinationId` (string, required) — ID of payment destination. - `estimatedDeductionDate` (datetime, optional) — Date the payment is scheduled to be deducted from the payer's account. Use this field if the payment has not yet been deducted. - `processedAt` (datetime, optional) — Date the payment was processed. Use this field if the payment has already been deducted. - `paymentDestinationOptions` (object, optional) — Options for the payment destination. Depending on the payment destination, this may include things such as check delivery method. - `type`: `check` - `delivery` (enum, optional) — Delivery method for check disbursements. Defaults to MAIL. - Allowed values: `PRINT`, `MAIL`, `MAIL_PRIORITY`, `MAIL_UPS_NEXT_DAY` - `printDescription` (boolean, optional) — If true, prints the invoice description (noteToSelf) on the check note. Defaults to false. - `type`: `bankAccount` - `delivery` (enum, optional) — Delivery method for ACH payments. Defaults to ACH_SAME_DAY. - Allowed values: `ACH_STANDARD`, `ACH_SAME_DAY`, `ACH_ACCELERATED` - `description` (string, optional) — ACH Statement Description. By default, this will be 'AP' followed by the first 8 characters of the invoice ID (for a single invoice) or the first 8 characters of the transaction ID (for a batch payment). Must be at least 4 characters and no more than 10 characters, and follow this regex pattern `^[a-zA-Z0-9\-#.$&* ]{4,10}$` - `type`: `utility` - `accountId` (string, required) — The ID for the utility account to pay with. Links to accounts listed on payor/payee relationship. - `type`: `custom` - `dynamicUrls` (map from string to string, optional) — Map of field names to dynamic URL values that will be used for dynamicUrl fields in custom payment method schemas - Invoice Timing - `invoiceId` (string, required) ## Response ### 200 - `estimatedProcessingDate` (datetime, required) — Estimated date the payment will be or was processed. - `businessDays` (integer, required) — Number of business days between the estimated processing date and the estimated settlement date. This does not take into account bank holidays or weekends. - `estimatedProcessingTime` (integer, required) — Estimated payment time in days. This time takes into account bank holidays and weekends. - `estimatedSettlementDate` (datetime, required) — Estimated date the payment will be or was settled. This is the same as the request's deductionDate plus the paymentTiming. ## Errors ### 400 Bad Request - `errorName` ("BadRequest", required) - `content` (string, required) ### 401 Unauthorized - `errorName` ("Unauthorized", required) - `content` (string, required) ### 403 Forbidden - `errorName` ("Forbidden", required) - `content` (string, required) ### 404 Not Found - `errorName` ("NotFound", required) - `content` (string, required) ### 409 Conflict - `errorName` ("Conflict", required) - `content` (string, required) ### 500 Internal Server Error - `errorName` ("InternalServerError", required) - `content` (string, required) ### 501 Unimplemented - `errorName` ("Unimplemented", required) - `content` (string, required) ## Examples ### Estimated Timing **Request** ```json { "estimatedDeductionDate": "2024-01-02T00:00:00Z", "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769", "paymentDestinationId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769" } ``` **Response** ```json { "estimatedProcessingDate": "2024-01-02T00:00:00Z", "businessDays": 3, "estimatedProcessingTime": 3, "estimatedSettlementDate": "2024-01-05T00:00:00Z" } ``` **SDK Code** ```python Estimated Timing import requests url = "https://api.mercoa.com/paymentTiming" payload = { "estimatedDeductionDate": "2024-01-02T00:00:00Z", "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769", "paymentDestinationId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript Estimated Timing import { MercoaClient } from "@mercoa/javascript"; const client = new MercoaClient({ token: "YOUR_TOKEN" }); await client.calculate.paymentTiming({ estimatedDeductionDate: new Date("2024-01-02T00:00:00.000Z"), paymentSourceId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769", paymentDestinationId: "pm_4794d597-70dc-4fec-b6ec-c5988e759769" }); ``` ```go Estimated Timing package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mercoa.com/paymentTiming" payload := strings.NewReader("{\n \"estimatedDeductionDate\": \"2024-01-02T00:00:00Z\",\n \"paymentSourceId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\",\n \"paymentDestinationId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Estimated Timing require 'uri' require 'net/http' url = URI("https://api.mercoa.com/paymentTiming") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"estimatedDeductionDate\": \"2024-01-02T00:00:00Z\",\n \"paymentSourceId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\",\n \"paymentDestinationId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\"\n}" response = http.request(request) puts response.read_body ``` ```java Estimated Timing import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.mercoa.com/paymentTiming") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"estimatedDeductionDate\": \"2024-01-02T00:00:00Z\",\n \"paymentSourceId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\",\n \"paymentDestinationId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\"\n}") .asString(); ``` ```php Estimated Timing request('POST', 'https://api.mercoa.com/paymentTiming', [ 'body' => '{ "estimatedDeductionDate": "2024-01-02T00:00:00Z", "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769", "paymentDestinationId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Estimated Timing using RestSharp; var client = new RestClient("https://api.mercoa.com/paymentTiming"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"estimatedDeductionDate\": \"2024-01-02T00:00:00Z\",\n \"paymentSourceId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\",\n \"paymentDestinationId\": \"pm_4794d597-70dc-4fec-b6ec-c5988e759769\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Estimated Timing import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "estimatedDeductionDate": "2024-01-02T00:00:00Z", "paymentSourceId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769", "paymentDestinationId": "pm_4794d597-70dc-4fec-b6ec-c5988e759769" ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/paymentTiming")! 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() ``` ### Invoice Timing **Request** ```json { "invoiceId": "in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9" } ``` **Response** ```json { "estimatedProcessingDate": "2024-01-02T00:00:00Z", "businessDays": 3, "estimatedProcessingTime": 3, "estimatedSettlementDate": "2024-01-05T00:00:00Z" } ``` **SDK Code** ```python Invoice Timing import requests url = "https://api.mercoa.com/paymentTiming" payload = { "invoiceId": "in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9" } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```typescript Invoice Timing import { MercoaClient } from "@mercoa/javascript"; const client = new MercoaClient({ token: "YOUR_TOKEN" }); await client.calculate.paymentTiming({ invoiceId: "in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9" }); ``` ```go Invoice Timing package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.mercoa.com/paymentTiming" payload := strings.NewReader("{\n \"invoiceId\": \"in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby Invoice Timing require 'uri' require 'net/http' url = URI("https://api.mercoa.com/paymentTiming") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"invoiceId\": \"in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9\"\n}" response = http.request(request) puts response.read_body ``` ```java Invoice Timing import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.mercoa.com/paymentTiming") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"invoiceId\": \"in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9\"\n}") .asString(); ``` ```php Invoice Timing request('POST', 'https://api.mercoa.com/paymentTiming', [ 'body' => '{ "invoiceId": "in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9" }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp Invoice Timing using RestSharp; var client = new RestClient("https://api.mercoa.com/paymentTiming"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"invoiceId\": \"in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift Invoice Timing import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = ["invoiceId": "in_26e7b5d3-a739-4b23-9ad9-6aaa085f47a9"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.mercoa.com/paymentTiming")! 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() ```