Run a sale
A merchant can use their POS to initiate a sale on their payment device.
Integration steps
To run a sale using Payroc Cloud, integrate with the following:
Step 1. Create a payment instruction.
Step 2. View the status of the payment instruction.
Step 3. View the details of the payment.
Before you begin
Bearer tokens
Use our Identity Service to generate a Bearer token to include in the header of your requests. To generate a Bearer token, complete the following steps:
- Include your API key in the x-api-key parameter in the header of a POST request.
- Send your request to https://identity.payroc.com/authorize.
Note: You need to generate a new Bearer token before the previous Bearer token expires.
Example request
If your request is successful, we return a response that contains your Bearer token, information about its scope, and when it expires.
Example response
Headers
To create the header of each POST request, you must include the following parameters:
- Content-Type: Include application/json as the value for this parameter.
- Authorization: Include your Bearer token in this parameter.
- Idempotency-Key: Include a UUID v4 to make the request idempotent.
Errors
If your request is unsuccessful, we return an error. For more information about errors, see Errors.
Step 1. Create a payment instruction
To send a payment instruction to a device, send a POST request to the Devices endpoint.
Request parameters
To create the body of your request, use the following parameters:
Request
Example request
Response fields
If your request is successful, we send the payment instruction to the device.
Note: The response returns a value of inProgress
for status and an identifier for the instruction that you can use to check the status of the instruction. To get a link to view the details of the payment, go to Step 2.
The response contains the following fields:
Response
Example response
Step 2. View the status of a payment instruction
To check for updates to the status or view the details of the payment, send a GET request to the Payment Instructions endpoint.
Before our gateway sends a response, it waits for up to 30 seconds for the status of the instruction to change. We recommend that you keep the session open until the status of the instruction changes or the request times out.
If the status of the instruction doesn’t change, send another GET request. Our gateway waits up to 30 seconds for the status of the instruction to change. Continue to send GET requests until the status changes.
Note: Wait until you receive a response from our gateway before you send another request.
Request parameters
To create the body of your request, use the following parameters:
Path parameters
Example request
Response fields
If your request is successful, we return the details of the payment instruction.
To check whether a transaction is approved or declined, follow the HATEOAS link in the response to view the transaction.
If the status of the payment instruction is inProgress
, our gateway waits up to a minute for the status to change before it returns a response.
Response
Example response
Step 3. View the details of the payment
To check if the processor approved or declined the payment, send a GET request to the Payments endpoint.
Request parameters
To create the body of your request, use the following parameters:
Path parameters
Example request
Response fields
If your request is successful, we return the details of the payment.
Response
Example response
Before you test your integration
To test your integration with a payment device, first complete the following tasks:
- Get the serial number of the payment device.
- Connect the payment device to the internet.
Test cases
Create a payment instruction using options that you configured in the gateway
Step 1. Create a payment instruction
Use our gateway to configure the surcharging options, tip options, and tax amounts.
Note: If you’re unsure about how to configure these options, contact your Payroc Integration Engineer.
Send a POST request to the Devices test endpoint:
https://api.uat.payroc.com/v1/devices/{serialNumber}/payment-instructions
Example request
Step 2. Retrieve the status of the payment instruction
Send a GET request to the Payment Instructions test endpoint:
https://api.uat.payroc.com/v1/payment-instructions/{paymentInstructionId}
If the status of the payment instruction is inProgress
, our gateway waits up to a minute for the status to change before it returns a response. Send GET requests until the value for status changes to completed
.
Note: If the status of the payment instruction is failed
or canceled
, contact your Payroc Integration Engineer.
Example response
Step 3. Retrieve the status of the payment instruction
Send a GET request to the Payment test endpoint:
https://api.uat.payroc.com/v1/payments/{paymentId}
Use the paymentID that you received in the response from Step 2.
Example response
Create a payment instruction that overrides the values that you configured in the gateway
Step 1. Create a payment instruction
Send a POST request to the Devices test endpoint:
https://api.uat.payroc.com/v1/devices/{serialNumber}/payment-instructions
Example request
Step 2. Retrieve the status of the payment instruction
Send a GET request to the Payment Instructions test endpoint:
https://api.uat.payroc.com/v1/payment-instructions/{paymentInstructionId}
If the status of the payment instruction is inProgress
, our gateway waits up to a minute for the status to change before it returns a response. Send GET requests until the value for status changes to completed
.
Note: If the status of the payment instruction is failed
or canceled
, contact your Payroc Integration Engineer.
Example response
Step 3. Retrieve the status of the payment instruction
Send a GET request to the Payment test endpoint:
https://api.uat.payroc.com/v1/payments/{paymentId}
Use the paymentID that you received in the response from Step 2.
Example response