PayByCloud

Before you can run live payments, we require you to run our test cases to make sure that you have correctly integrated against our API.
Note: If you have any issues when you run our test cases, email our integrations team at [email protected].

Before you begin

To help you with testing, we provide you with:
  • Test environment
  • Test cards
  • Test values
You should also review our testing recommendations.

Test environment

Send your requests to our test environment: Test environment base URI: https://api.uat.payroc.com/v1
Important: Use only test cards in our test environment.

Authenticating your requests

Use our test Identity Service to generate a Bearer token to include in the header of your requests. To generate your Bearer token, complete the following steps:
  1. Include your API key in the x-api-key parameter in the header of a POST request.
  2. Send your request to https://identity.uat.payroc.com/authorize.
Note: You need to generate a new Bearer token before the previous Bearer token expires.

Example request

curl --location --request POST 'https://identity.uat.payroc.com/authorize' --header 'x-api-key: <api key>'

Example response

If your request is successful, we return a response that contains your Bearer token, information about its scope, and when it expires.
{
"access_token": "eyJhbGc....adQssw5c",
"expires_in": 3600,
"scope": "service_a service_b",
"token_type": "Bearer"
}

Example request header

curl -H "Authorization: Bearer <access token>"

Test cards

Important: Use only test cards in our test environment.
Card schemeCard numberVerification
Visa4761 7300 0000 0011Online only
Mastercard5413 3300 8960 4111Online only
Visa4761 7310 0000 0043Online or offline
Mastercard5413 3300 8960 4111Online or offline
Visa4761 7310 0000 0043Online or offline
Mastercard5413 3300 8960 4111Online or offline

Test values

To return a specific response from the gateway, change the value in the amount parameter to end in one of the following values:
ValueResponseExample
01Declined501
02Referral1002
03CVV failure1403
Any otherAuthorized4541

Testing recommendations

When you test your integration, we recommend that you do the following:
  • Test error scenarios – To check that your integration can handle errors, run scenarios that produce errors. For example, test that your integration can handle the response when the value for a request parameter is in the wrong format.
  • Follow PCI DSS – To help protect the payment data, make sure that your integration complies with PCI DSS.
  • Test all card types – If your integration accepts multiple card types, test your integration with each card type. For example, if your integration accepts EBT cards, you should test with an EBT card.
  • Refresh tokens for authenticationBearer tokens expire after a fixed period. Test your integration to make sure that it can correctly refresh Bearer tokens.

Test cases

We provide you with test cases for the following:
Note: For some test cases you need to adjust the gateway settings, for example, to display a tip prompt. If you need help to adjust the gateway settings, contact your Payroc Integration Engineer.

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
{
"operator": "jbloggs",
"processingTerminalId": "1021",
"order": {
"orderId": "4fd4-99bc",
"currency": "USD",
"amount": 1000,
"orderBreakdown": {
"subtotalAmount": 1000
}
},
"customizationOptions": {
"entryMethod": "deviceRead"
},
"autoCapture": true,
"processAsSale": false
}

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
{
"paymentInstructionId": "3743a9165d134678a9100ebba3b29597",
"status": "completed",
"link": {
"rel": "payment",
"method": "GET",
"href": "https://api.payroc.com/v1/payments/DD6ZDQU7L2"
}
}

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
{
"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 protected]",
"phone": "+353891234567",
"notificationLanguage": "en"
},
"autoCapture": true,
"processAsSale": false
}

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
{
"operator": "XYZ",
"terminal": 1021,
"order": {
"orderId": "TestPBC-123",
"description": "Payment Instruction",
"currency": "USD",
"totalAmount": 12100,
"orderBreakdown": {
"subtotalAmount": 12100,
"surcharge": {
"bypass": "true"
},
"taxes": [
{
"name": "TAX10",
"rate": 10.0
}
],
"tip": {
"percentage": 10,
"type": "PERCENTAGE"
}
}
},
"customizationOptions": {
"entryMethod": "DEVICE_READ"
},
"autoCapture": true,
"processAsSale": false
}

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
{
"paymentInstructionId": "3743a9165d134678a9100ebba3b29597",
"status": "completed",
"link": {
"rel": "payment",
"method": "GET",
"href": "https://api.payroc.com/v1/payments/DD6ZDQU7L2"
}
}

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
{
"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 a refund instruction for when the card isn’t present

Step 1. Create a refund instruction

Send a POST request to the Devices test endpoint: https://api.uat.payroc.com/v1/devices/{serialNumber}/refund-instructions Example request
{
"operator": "jbloggs",
"processingTerminalId": "1021",
"order": {
"orderId": "4fd4-99bc",
"currency": "USD",
"amount": 1000
},
"customizationOptions": {
"entryMethod": "manualEntry"
}
}

Step 2. Retrieve the status of the refund instruction

Send a GET request to the Refund Instructions test endpoint: https://api.uat.payroc.com/v1/refund-instructions/{refundInstructionId} If the status of the refund 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 refund instruction is failed or canceled, contact your Payroc Integration Engineer.
Example response
{
"refundInstructionId": "3743a9165d134678a9100ebba3b29597",
"status": "completed",
"link": {
"rel": "refunds",
"method": "GET",
"href": "https://api.payroc.com/v1/refunds/DD6ZDQU7L27"
}
}

Step 3. Retrieve the status of the refund instruction

Send a GET request to the Refunds test endpoint: https://api.uat.payroc.com/v1/refunds/{refundId} Use the refundID that you received in the response from Step 2. Example response
{
"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"
}
}