### Example HTTP GET Request Source: https://docs.payroc.com/guides/integrate/3-d-secure/run-a-sale-with-3-d-secure.mdx This snippet shows a complete example of an HTTP GET request to the Payroc MPI endpoint, demonstrating how to include all required query parameters (processingTerminalId, amount, currency, orderId, email, singleUseToken) with example values. ```HTTP https://payments.payroc.com/merchant/mpi?processingTerminalId=4479001&amount=100¤cy=EUR&orderId=25&email=joe%40adomain.com&singleUseToken=1a8731f50b02e287ac0529fbce352317c089d4adc1178c1867d65114078791d3c3e13962cbab6b574769dfe9ad5397a5aa67a529ceb0b7be17751f076bbe0e4d ``` -------------------------------- ### GET /payment-instructions/{id} Response JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx Example JSON response for retrieving the status of a payment instruction. Includes the instruction ID, current status (e.g., 'completed'), and a link to the associated payment resource. ```json { "paymentInstructionId": "3743a9165d134678a9100ebba3b29597", "status": "completed", "link": { "rel": "payment", "method": "GET", "href": "https://api.payroc.com/v1/payments/DD6ZDQU7L2" } } ``` -------------------------------- ### GET /refund-instructions/{id} Response JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx Example JSON response for retrieving the status of a refund instruction. Includes the instruction ID, current status (e.g., 'completed'), and a link to the associated refund resource. ```json { "refundInstructionId": "3743a9165d134678a9100ebba3b29597", "status": "completed", "link": { "rel": "refunds", "method": "GET", "href": "https://api.payroc.com/v1/refunds/DD6ZDQU7L27" } } ``` -------------------------------- ### Example GET Request Headers - Shell Source: https://docs.payroc.com/guides/integrate/apple-pay/add-apple-pay-to-your-integration.mdx Example `curl` command showing the required headers (Content-Type and Authorization) for a GET request to the Payroc API. ```Shell curl -H "Content-Type: application/json" -H "Authorization: " ``` -------------------------------- ### Example 3-D Secure Response URL Source: https://docs.payroc.com/guides/integrate/3-d-secure/run-a-sale-with-3-d-secure.mdx An example of the GET request URL sent to the merchant's MPI receipt URL after a successful 3-D Secure check, containing the results as query parameters. ```URL https://{MPI_RECEIPT_URL}?result=A&status=A&eci=06&mpiReference=d01656cf0ec3e62e3754&orderId=25 ``` -------------------------------- ### List Contacts Example - Ruby Source: https://docs.payroc.com/api/schema/boarding/processing-accounts/contacts.mdx Provides a Ruby example using the `uri` and `net/http` libraries. It parses the URL, sets up an HTTP connection with SSL, creates a GET request object, adds the Authorization header, and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/processing-accounts/38765/contacts?before=2571&after=8516&limit=25") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### List Contacts Example - Java (Unirest) Source: https://docs.payroc.com/api/schema/boarding/processing-accounts/contacts.mdx Shows a concise Java example using the Unirest library to perform the GET request. It directly calls the `get` method with the URL, chains the `header` method to add authorization, and retrieves the response as a string. ```java HttpResponse response = Unirest.get("https://api.payroc.com/v1/processing-accounts/38765/contacts?before=2571&after=8516&limit=25") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### List Funding Instructions - Java Unirest Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Provides a concise example using the Java Unirest library to execute a GET request to the funding instructions API, specifying the URL and adding the Authorization header. ```java HttpResponse response = Unirest.get("https://api.payroc.com/v1/funding-instructions?before=2571&after=8516&limit=25&dateFrom=2024-07-01&dateTo=2024-07-03") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Example Response for Creating Payment Plan Source: https://docs.payroc.com/test/test-your-integration/payments.mdx This JSON snippet shows an example response received after successfully creating a payment plan using the Payroc API. It includes details such as the payment plan ID, terminal ID, name, description, currency, setup order amount, plan length, type, frequency, and update/delete behaviors. ```JSON { "paymentPlanId": "PaymentPlanTest", "processingTerminalId": "3204001", "name": "Davi Crisostomo", "description": "Payment Plan creation", "currency": "USD", "setupOrder": { "amount": 11000, "description": "Setup Amount" }, "length": 24, "type": "manual", "frequency": "monthly", "onUpdate": "update", "onDelete": "complete" } ``` -------------------------------- ### Example GET Request Headers (cURL) Source: https://docs.payroc.com/guides/integrate/payment-links/create-and-share-a-payment-link.mdx Shows the required headers for making a GET request to the API, including Content-Type set to application/json and the Authorization header containing the Bearer token. ```sh curl -H "Content-Type: application/json" -H "Authorization: " ``` -------------------------------- ### List Batches using Ruby net/http Source: https://docs.payroc.com/api/schema/reporting/settlement/list-batches.mdx Example in Ruby using the `uri` and `net/http` libraries to make an HTTPS GET request to the batches endpoint. It sets up the connection, creates the GET request object, adds the Authorization header, sends the request, and prints the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/batches?before=2571&after=8516&limit=25&date=2027-07-02&merchantId=4525644354") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### List Funding Instructions - Go net/http Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Provides an example of making a GET request to the funding instructions API using Go's standard `net/http` package, setting the URL, adding the Authorization header, and reading the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/funding-instructions?before=2571&after=8516&limit=25&dateFrom=2024-07-01&dateTo=2024-07-03" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### GET /payments/{id} Response JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx Example JSON response for retrieving detailed payment status. Contains comprehensive information about the payment, including order, card, and transaction result details. ```json { "paymentId": "DD6ZDQU7L2", "processingTerminalId": "1021", "operator": "Postman", "order": { "orderId": "4fd4-99bc", "dateTime": "2023-07-26T16:42:25.018Z", "description": "Example payment", "amount": 1000, "currency": "USD" }, "customer": { "shippingAddress": {} }, "card": { "type": "MasterCard", "entryMethod": "keyed", "cardNumber": "500165******0000", "expiryDate": "0328", "securityChecks": { "cvvResult": "M", "avsResult": "Y" } }, "transactionResult": { "type": "sale", "status": "ready", "approvalCode": "OK3", "authorizedAmount": 1000, "currency": "USD", "responseCode": "A", "responseMessage": "OK3" } } ``` -------------------------------- ### List Funding Instructions - cURL Example Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Demonstrates how to use the cURL command-line tool to make a GET request to the funding instructions endpoint, including query parameters for filtering and pagination, and the required Authorization header. ```shell curl -G https://api.payroc.com/v1/funding-instructions \ -H "Authorization: Bearer " \ -d before=2571 \ -d after=8516 \ -d limit=25 \ -d dateFrom=2024-07-01 \ -d dateTo=2024-07-03 ``` -------------------------------- ### List Funding Instructions - Ruby Net::HTTP Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Shows how to use Ruby's standard `net/http` library to construct and send a GET request to the funding instructions endpoint, including setting the URL, enabling SSL, adding the Authorization header, and printing the response body. ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/funding-instructions?before=2571&after=8516&limit=25&dateFrom=2024-07-01&dateTo=2024-07-03") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### Create Funding Instruction - Go Source: https://docs.payroc.com/api/schema/funding/funding-instructions/create.mdx This snippet shows how to create a funding instruction using Go's standard net/http package. It constructs a POST request, adds the necessary headers (Idempotency-Key, Authorization, Content-Type), and sends an empty request body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/funding-instructions" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") 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)) } ``` -------------------------------- ### GET /refunds/{id} Response JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx Example JSON response for retrieving detailed refund status. Contains comprehensive information about the refund, including order, card, and transaction result details, similar to a payment response. ```json { "paymentId": "DD6ZDQU7L2", "processingTerminalId": "1021", "operator": "Postman", "order": { "orderId": "4fd4-99bc", "dateTime": "2023-07-26T16:42:25.018Z", "description": "Example payment", "amount": 1000, "currency": "USD" }, "customer": { "shippingAddress": {} }, "card": { "type": "MasterCard", "entryMethod": "keyed", "cardNumber": "500165******0000", "expiryDate": "0328", "securityChecks": { "cvvResult": "M", "avsResult": "Y" } }, "transactionResult": { "type": "sale", "status": "ready", "approvalCode": "OK3", "authorizedAmount": 1000, "currency": "USD", "responseCode": "A", "responseMessage": "OK3" } } ``` -------------------------------- ### Create Funding Instruction - Swift Source: https://docs.payroc.com/api/schema/funding/funding-instructions/create.mdx This snippet demonstrates creating a funding instruction using Swift's Foundation framework. It sets up the URL, configures the POST request with required headers (Idempotency-Key, Authorization, Content-Type) and an empty body, and executes the request asynchronously. ```swift import Foundation let headers = [ "Idempotency-Key": "8e03978e-40d5-43e8-bc93-6894a57f9324", "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-instructions")! 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() ``` -------------------------------- ### List Funding Instructions - Swift URLSession Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Illustrates how to use Swift's native `URLSession` to construct a GET request to the funding instructions API, setting the URL, HTTP method, headers, and handling the asynchronous response. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-instructions?before=2571&after=8516&limit=25&dateFrom=2024-07-01&dateTo=2024-07-03")! 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() ``` -------------------------------- ### Example Request Headers - Bash Source: https://docs.payroc.com/guides/integrate/payroc-cloud/same-device/run-a-sale.mdx Example `curl` command demonstrating the required headers for POST requests to Payroc APIs, including `Content-Type`, `Authorization` with a Bearer token, and `Idempotency-Key`. ```bash curl -H "Content-Type: application/json" -H "Authorization: " -H "Idempotency-Key: " ``` -------------------------------- ### POST /devices/{sn}/refund-instructions Request JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx Example JSON request body for creating a refund instruction for a card-not-present scenario. Specifies operator, terminal, order details, and entry method. ```json { "operator": "jbloggs", "processingTerminalId": "1021", "order": { "orderId": "4fd4-99bc", "currency": "USD", "amount": 1000 }, "customizationOptions": { "entryMethod": "manualEntry" } } ``` -------------------------------- ### Retrieve Payment Status Response - Payroc API - JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx This JSON object is an example response from a GET request to retrieve the details of a completed payment using the Payroc API. It provides comprehensive information including operator, terminal, order details (breakdown, taxes, tip), customer information, and processing options. ```JSON { "operator": "XYZ", "terminal": 1021, "order": { "orderId": "4fd4-99bc", "description": "Payment Instruction", "currency": "USD", "totalAmount": 10.00, "orderBreakdown": { "subtotalAmount": 10.00, "surcharge": { "bypass": "true" }, "taxes": [ { "name": "TAX10", "rate": 10.0 } ], "tip": {} } }, "customizationOptions": { "entryMethod": "DEVICE_READ" }, "customer": { "name": "First Last", "dateOfBirth": "2023-01-01", "referenceNumber": "ABCDEFGH", "billingAddress": { "line1": "billing Addr Line1", "line2": "billing Addr Line2", "city": "billCity", "state": "AZ", "country": "US", "postalCode": 12345 }, "shippingAddress": { "name": "shipping recipient name", "line1": "shipping Addr Line1", "line2": "shipping Addr Line2", "city": "shipCity", "state": "AZ", "country": "US", "postalCode": "SH12345" }, "email": "email@domain.com", "phone": "+353891234567", "notificationLanguage": "en" }, "autoCapture": true, "processAsSale": false } ``` -------------------------------- ### Initializing Card Hosted Fields - JavaScript Source: https://docs.payroc.com/guides/integrate/hosted-fields/set-up-hosted-fields.mdx This snippet demonstrates how to load the Payroc Hosted Fields library and initialize an instance configured for card tokenization. It specifies the target elements for card details fields and a submit button. ```JavaScript ``` -------------------------------- ### List Batches using Go net/http Source: https://docs.payroc.com/api/schema/reporting/settlement/list-batches.mdx This Go example demonstrates fetching batch data using the standard `net/http` package. It creates a GET request, adds the Authorization header, executes the request, and reads and prints the response status and body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/batches?before=2571&after=8516&limit=25&date=2027-07-02&merchantId=4525644354" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### Retrieve Payment Instruction Status Response - Payroc API - JSON Source: https://docs.payroc.com/test/test-your-integration/pay-by-cloud.mdx This JSON object is an example response from a GET request to retrieve the status of a payment instruction using the Payroc API. It shows the payment instruction ID, its current status (e.g., "completed"), and a link to the related payment resource. ```JSON { "paymentInstructionId": "3743a9165d134678a9100ebba3b29597", "status": "completed", "link": { "rel": "payment", "method": "GET", "href": "https://api.payroc.com/v1/payments/DD6ZDQU7L2" } } ``` -------------------------------- ### Curl Example to List Funding Recipients Source: https://docs.payroc.com/api/schema/funding/funding-recipients/list-owners.mdx Example using curl to make a GET request to the funding recipients endpoint, including the Authorization header. Note: This example hits the base recipients endpoint, not the owners endpoint for a specific recipient. ```shell curl https://api.payroc.com/v1/funding-recipients/ \ -H "Authorization: Bearer " ``` -------------------------------- ### List Funding Instructions - C# RestSharp Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Shows how to use the C# RestSharp library to create a client and request object for a GET call to the funding instructions API, setting the base URL and adding the Authorization header. ```csharp var client = new RestClient("https://api.payroc.com/v1/funding-instructions?before=2571&after=8516&limit=25&dateFrom=2024-07-01&dateTo=2024-07-03"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Retrieve Transaction Swift Example (URLSession) Source: https://docs.payroc.com/api/schema/reporting/settlement/get-transaction.mdx Provides an example using Swift's URLSession to make a GET request to retrieve a transaction, setting headers and handling the asynchronous response. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/transactions/442233")! 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() ``` -------------------------------- ### Retrieve Transaction Java Example (Unirest) Source: https://docs.payroc.com/api/schema/reporting/settlement/get-transaction.mdx Provides a concise example using the Unirest library in Java to perform a GET request to retrieve a transaction, including setting the Authorization header. ```java HttpResponse response = Unirest.get("https://api.payroc.com/v1/transactions/442233") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Requesting Refund Instructions (Go) Source: https://docs.payroc.com/api/schema/payroc-cloud/refund-instructions/send.mdx Provides a Go example for sending a POST request to the `/refund-instructions` endpoint using the standard `net/http` package. It constructs the request with the necessary URL, headers, and request body, then executes it and prints the response. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/devices/1850010868/refund-instructions" payload := strings.NewReader("{\n \"processingTerminalId\": \"1234001\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") 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)) } ``` -------------------------------- ### Get Funding Activity via Swift URLSession Source: https://docs.payroc.com/api/schema/funding/funding-activity/get.mdx Example using Swift's URLSession to create and execute a GET request for funding activity, including setting the authorization header. ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/funding-activity?before=2571&after=8516&limit=25&dateFrom=2024-07-02&dateTo=2024-07-03&merchantId=4525644354")! 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() ``` -------------------------------- ### Requesting SYSTEM_ALERT_WINDOW Permission in Kotlin Source: https://docs.payroc.com/guides/integrate/payroc-cloud.mdx This Kotlin function demonstrates how to programmatically request the SYSTEM_ALERT_WINDOW permission at runtime, which is necessary on newer Android versions (M and above). It constructs an intent to open the system settings screen for managing overlay permissions for the current package. ```kotlin private fun requestPermission() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { val intent = Intent( Settings.ACTION_MANAGE_OVERLAY_PERMISSION, Uri.parse("package:$packageName") ) startActivityForResult(intent, ACTION_MANAGE_OVERLAY_PERMISSION_REQUEST_CODE) } } ``` -------------------------------- ### Get Funding Activity via PHP GuzzleHttp Source: https://docs.payroc.com/api/schema/funding/funding-activity/get.mdx Example using the PHP GuzzleHttp client to perform a GET request to the funding activity endpoint, including setting the authorization header. ```php request('GET', 'https://api.payroc.com/v1/funding-activity?before=2571&after=8516&limit=25&dateFrom=2024-07-02&dateTo=2024-07-03&merchantId=4525644354', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ?> ``` -------------------------------- ### List Funding Instructions - Python Requests Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Shows how to use the Python `requests` library to perform a GET request to the funding instructions API, passing query parameters via a dictionary and setting the Authorization header. ```python import requests url = "https://api.payroc.com/v1/funding-instructions" querystring = {"before":"2571","after":"8516","limit":"25","dateFrom":"2024-07-01","dateTo":"2024-07-03"} headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers, params=querystring) print(response.json()) ``` -------------------------------- ### Get Funding Activity via cURL Source: https://docs.payroc.com/api/schema/funding/funding-activity/get.mdx Example using the cURL command-line tool to perform a GET request to the funding activity endpoint, including authorization header and query parameters. ```shell curl -G https://api.payroc.com/v1/funding-activity \ -H "Authorization: Bearer " \ -d before=2571 \ -d after=8516 \ -d limit=25 \ -d dateFrom=2024-07-02 \ -d dateTo=2024-07-03 \ -d merchantId=4525644354 ``` -------------------------------- ### Create Payment Instruction Request (Basic) Source: https://docs.payroc.com/guides/integrate/payroc-cloud/same-device/run-a-sale.mdx Example JSON request body for creating a payment instruction via the Devices API. Configures basic order details and processing options. ```json { "operator": "jbloggs", "processingTerminalId": "1021", "order": { "orderId": "4fd4-99bc", "currency": "USD", "amount": 1000, "orderBreakdown": { "subtotalAmount": 1000 } }, "customizationOptions": { "entryMethod": "deviceRead" }, "autoCapture": true, "processAsSale": false } ``` -------------------------------- ### Retrieve Transaction JavaScript Example Source: https://docs.payroc.com/api/schema/reporting/settlement/get-transaction.mdx Provides an example using the JavaScript fetch API to perform a GET request to retrieve a transaction, including setting the Authorization header and basic error handling. ```javascript const url = 'https://api.payroc.com/v1/transactions/442233'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Request Balance Inquiry using Go net/http Source: https://docs.payroc.com/api/schema/payments/cards/balance.mdx Shows a Go example using the standard `net/http` package to construct and send the balance inquiry POST request, including setting headers and using a strings.NewReader for the body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/cards/balance" payload := strings.NewReader("{\n \"processingTerminalId\": \"1234001\",\n \"currency\": \"AED\"\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)) } ``` -------------------------------- ### List Funding Instructions - JavaScript Fetch API Source: https://docs.payroc.com/api/schema/funding/funding-instructions/list.mdx Illustrates how to use the browser's native `fetch` API in JavaScript to make an asynchronous GET request to the funding instructions endpoint, including query parameters in the URL and setting the Authorization header. ```javascript const url = 'https://api.payroc.com/v1/funding-instructions?before=2571&after=8516&limit=25&dateFrom=2024-07-01&dateTo=2024-07-03'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Retrieve Owner - Multi-language Examples Source: https://docs.payroc.com/api/schema/boarding/owners/get.mdx Provides code examples in various programming languages demonstrating how to make a GET request to retrieve a specific owner using the Payroc API, including setting the Authorization header. ```shell curl https://api.payroc.com/v1/owners/ \ -H "Authorization: Bearer " ``` ```python import requests url = "https://api.payroc.com/v1/owners/4564" headers = {"Authorization": "Bearer "} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.payroc.com/v1/owners/4564'; const options = {method: 'GET', headers: {Authorization: 'Bearer '}}; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/owners/4564" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/owners/4564") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` ```java HttpResponse response = Unirest.get("https://api.payroc.com/v1/owners/4564") .header("Authorization", "Bearer ") .asString(); ``` ```php request('GET', 'https://api.payroc.com/v1/owners/4564', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` ```csharp var client = new RestClient("https://api.payroc.com/v1/owners/4564"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": "Bearer "] let request = NSMutableURLRequest(url: NSURL(string: "https://api.payroc.com/v1/owners/4564")! 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() ``` -------------------------------- ### Create Funding Instruction - Ruby Source: https://docs.payroc.com/api/schema/funding/funding-instructions/create.mdx This snippet demonstrates how to create a funding instruction using Ruby's standard net/http library. It sets up an HTTPS connection, creates a POST request, adds the required headers (Idempotency-Key, Authorization, Content-Type), and sends an empty JSON body. ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/funding-instructions") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Idempotency-Key"] = '8e03978e-40d5-43e8-bc93-6894a57f9324' request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{}" response = http.request(request) puts response.read_body ``` -------------------------------- ### Curl Example to List Disputes Source: https://docs.payroc.com/api/schema/reporting/settlement/get-disputes-statuses.mdx Provides a command-line example using curl to send a GET request to the base disputes endpoint, demonstrating how to include the required Authorization header with a bearer token. Note: This example queries the base disputes endpoint, not the specific statuses endpoint described in the page title. ```shell curl https://api.payroc.com/v1/disputes/ \ -H "Authorization: Bearer " ``` -------------------------------- ### List Merchant Platforms using net/http (Go) Source: https://docs.payroc.com/api/schema/boarding/merchant-platforms/list.mdx Shows how to make the GET request using Go's standard net/http package, creating a new request, setting headers, and reading the response body. ```go package main import ( "fmt" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/merchant-platforms?before=2571&after=8516&limit=25" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "Bearer ") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` -------------------------------- ### POST /v1/fx-rates using Go net/http Source: https://docs.payroc.com/api/schema/payments/currency-conversion/get-fx-rates.mdx Provides an example of making a POST request to the /v1/fx-rates endpoint using Go's standard net/http package, setting headers and including the request body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/fx-rates" payload := strings.NewReader("{\n \"channel\": \"pos\",\n \"processingTerminalId\": \"1234001\",\n \"baseAmount\": 42,\n \"baseCurrency\": \"AED\"\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)) } ``` -------------------------------- ### Standard GET Request Headers - API - Bash Source: https://docs.payroc.com/guides/integrate/refunds/reversals/bank.mdx Example curl command showing the required headers for a standard GET request to the API. Includes 'Content-Type' set to 'application/json' and 'Authorization' with the obtained Bearer token. ```bash curl -H "Content-Type: application/json" -H "Authorization: " ``` -------------------------------- ### Retrieve Payment Plan - C# (RestSharp) Source: https://docs.payroc.com/api/schema/payments/payment-plans/get.mdx Example using the RestSharp library in C# to perform a GET request for a specific payment plan. Sets the base URL, creates a GET request, and adds the Authorization header. ```csharp var client = new RestClient("https://api.payroc.com/v1/processing-terminals/1234001/payment-plans/PlanRef8765"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Create Funding Instruction - JavaScript Source: https://docs.payroc.com/api/schema/funding/funding-instructions/create.mdx This snippet demonstrates creating a funding instruction using the Fetch API in JavaScript. It configures the POST request with the target URL, required headers (Idempotency-Key, Authorization, Content-Type), and an empty JSON body. ```javascript const url = 'https://api.payroc.com/v1/funding-instructions'; const options = { method: 'POST', headers: { 'Idempotency-Key': '8e03978e-40d5-43e8-bc93-6894a57f9324', Authorization: 'Bearer ', 'Content-Type': 'application/json' }, body: '{}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` -------------------------------- ### Java Unirest Example to List Funding Recipient Owners Source: https://docs.payroc.com/api/schema/funding/funding-recipients/list-owners.mdx Provides an example using the Unirest library in Java to make a GET request to retrieve funding recipient owners, including setting the Authorization header. ```java HttpResponse response = Unirest.get("https://api.payroc.com/v1/funding-recipients/234/owners") .header("Authorization", "Bearer ") .asString(); ``` -------------------------------- ### Creating Merchant Platform using Go net/http Source: https://docs.payroc.com/api/schema/boarding/merchant-platforms/create.mdx Provides an example of sending a POST request to the /v1/merchant-platforms endpoint using Go's standard net/http package. It constructs the request with an empty body reader and adds the necessary headers (Idempotency-Key, Authorization, Content-Type). ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/merchant-platforms" payload := strings.NewReader("{}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") 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)) } ``` -------------------------------- ### Standard GET Request Headers (Shell) Source: https://docs.payroc.com/guides/integrate/google-pay/google-pay.mdx Example `curl` command illustrating the required headers for standard GET requests to the Payroc API, including `Content-Type` set to `application/json` and `Authorization` with the generated Bearer token. ```sh curl -H "Content-Type: application/json" -H "Authorization: " ``` -------------------------------- ### Initiating Bank Transfer Payment using Go net/http Source: https://docs.payroc.com/api/schema/payments/bank-transfer-payments/create.mdx Provides an example of making a POST request in Go using the standard `net/http` package. Sets up the request with headers and body, executes it, and prints the response status and body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/bank-transfer-payments" payload := strings.NewReader("{\n \"processingTerminalId\": \"ready\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") 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)) } ``` -------------------------------- ### Create Funding Instruction - cURL Source: https://docs.payroc.com/api/schema/funding/funding-instructions/create.mdx This snippet demonstrates how to create a funding instruction using the cURL command-line tool. It includes setting the required Idempotency-Key, Authorization (Bearer token), and Content-Type headers, along with an empty JSON body. ```shell curl -X POST https://api.payroc.com/v1/funding-instructions \ -H "Idempotency-Key: 8e03978e-40d5-43e8-bc93-6894a57f9324" \ -H "Authorization: Bearer " \ -H "Content-Type: application/json" \ -d '{}' ``` -------------------------------- ### Retrieve Merchant Platform - C# (RestSharp) Source: https://docs.payroc.com/api/schema/boarding/merchant-platforms/get.mdx C# example using the RestSharp library to send a GET request to the Payroc API. Sets the base URL, creates a GET request, adds the Authorization header, and executes the request. ```csharp var client = new RestClient("https://api.payroc.com/v1/merchant-platforms/12345"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", "Bearer "); IRestResponse response = client.Execute(request); ``` -------------------------------- ### Example Request Headers using cURL Source: https://docs.payroc.com/guides/integrate/payroc-cloud/different-device/run-a-sale.mdx Illustrates the required headers for API requests to Payroc Cloud, including Content-Type, Authorization (with the Bearer token), and an Idempotency-Key. ```bash curl -H "Content-Type: application/json" -H "Authorization: " -H "Idempotency-Key: " ``` -------------------------------- ### List Owners using PHP GuzzleHttp Source: https://docs.payroc.com/api/schema/boarding/processing-accounts/list-owners.mdx Example using the GuzzleHttp client library in PHP to perform a GET request. Creates a Guzzle client, sends a GET request with the URL and authorization header, and echoes the response body. Requires the GuzzleHttp library. ```php request('GET', 'https://api.payroc.com/v1/processing-accounts/38765/owners?before=2571&after=8516&limit=25', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Creating Event Subscription using Net/http (Go) Source: https://docs.payroc.com/api/schema/event-subscriptions/create-event-subscription.mdx This Go snippet demonstrates making a POST request using the standard net/http package. It creates a new request with the URL and payload, adds necessary headers, executes the request, and reads the response body. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/event-subscriptions" payload := strings.NewReader("{\n \"enabled\": true\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Idempotency-Key", "8e03978e-40d5-43e8-bc93-6894a57f9324") 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)) } ``` -------------------------------- ### List Merchant Platforms using Net::HTTP (Ruby) Source: https://docs.payroc.com/api/schema/boarding/merchant-platforms/list.mdx Demonstrates making the GET request using Ruby's standard net/http library, handling SSL and setting the Authorization header. ```ruby require 'uri' require 'net/http' url = URI("https://api.payroc.com/v1/merchant-platforms?before=2571&after=8516&limit=25") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = 'Bearer ' response = http.request(request) puts response.read_body ``` -------------------------------- ### List Contacts Example - PHP (Guzzle) Source: https://docs.payroc.com/api/schema/boarding/processing-accounts/contacts.mdx Provides a PHP example using the Guzzle HTTP client. It creates a client instance, makes a GET request to the specified URL, passing the Authorization header within the options array, and echoes the response body. ```php request('GET', 'https://api.payroc.com/v1/processing-accounts/38765/contacts?before=2571&after=8516&limit=25', [ 'headers' => [ 'Authorization' => 'Bearer ', ], ]); echo $response->getBody(); ``` -------------------------------- ### Making a POST Request with Go net/http Source: https://docs.payroc.com/api/schema/payments/apple-pay-sessions/create.mdx Demonstrates performing a POST request using Go's standard 'net/http' package. It creates a request with the method, URL, and a string reader for the JSON payload, adds headers, and executes the request. ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.payroc.com/v1/processing-terminals/1234001/apple-pay-sessions" payload := strings.NewReader("{\n \"appleDomainId\": \"DUHDZJHGYY\",\n \"appleValidationUrl\": \"https://apple-pay-gateway.apple.com/paymentservices/startSession\"\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)) } ``` -------------------------------- ### Retrieve ACH Deposits - curl Source: https://docs.payroc.com/api/schema/reporting/settlement/list-ach-deposits.mdx Example using curl to perform the GET request, including query parameters for pagination/filtering and the Authorization header. ```shell curl -G https://api.payroc.com/v1/ach-deposits \ -H "Authorization: Bearer " \ -d before=2571 \ -d after=8516 \ -d limit=25 \ -d date=2024-07-02 \ -d merchantId=4525644354 ``` -------------------------------- ### Initializing PAD Hosted Fields - JavaScript Source: https://docs.payroc.com/guides/integrate/hosted-fields/set-up-hosted-fields.mdx This snippet illustrates loading the Hosted Fields library and initializing an instance for PAD payment tokenization. It configures fields for account holder name, account number, institution number, and transit number. ```JavaScript ```