Skip to main content

Request to Pay via QR Code API testing playbook

The Request to Pay via QR Code API offers a simulated environment designed to strengthen integration, development, and testing through a stateless mock service.

This guide offers a comprehensive mock test data along with a variety of examples to cover different scenarios and interactions with the Request to Pay API. It also helps you trigger specific responses and test error scenarios.

Before you begin

To execute a test payment request, you will need the test credentials provided during the onboarding process.

Test failure scenarios

To simulate payment request failure outcome, use the specified test data when sending POST requests to the Request to Pay API status endpoints.

Due dated QR Code generation with interest and penalty amount missing

  • Scenario: Due dated QR Code generation with interest and penalty amount missing
  • Type: Error
  • Endpoint: /receivables/request-to-pay/v1/payment-requests

Request

Due dated QR Code generation with interest and penalty amount missing
Json
{
  "country": "BR",
  "request": {
    "debtor": {
      "name": "JOÃO DA SILVA RIBEIRO",
      "address": {
        "type": "ADDR",
        "addressLines": [
          "AV PAULISTA 200"
        ],
        "city": "SÃO PAULO",
        "state": "SP",
        "postalCode": "01311900",
        "country": "BR"
      },
      "email": {
        "address": "joao.silva@gmail.com",
        "type": "PRIMARY"
      },
      "taxInformation": {
        "taxPayerCategory": "INDIVIDUAL",
        "taxId": "81877226220"
      }
    },
    "creditor": {
      "account": {
        "schemeName": {
          "proprietary": "CNPJ"
        },
        "alternateAccountIdentifier": "70204587000136"
      }
    },
    "expirationType": "DUE_DATE",
    "paymentAmount": "150.00",
    "currency": "BRL",
    "paymentDueDate": "2024-11-01",
    "reference": "Invoice for energy bill-123456",
    "additionalInformation": [
      {
        "valueType": "Obs",
        "text": "QR with Due Date - Test interest and penalty missing"
      }
    ],
    "interestType": "PERCENTAGE_PER_DAY",
    "discountType": "PERCENTAGE_TO_DATE",
    "discountParameters": {
      "cutOffDetails": [
        {
          "percentage": "2.00",
          "cutOffDate": "2024-10-15"
        }
      ]
    },
    "penaltyType": "FIXED_AMOUNT",
    "reductionType": "FIXED_AMOUNT",
    "reductionParameters": {
      "amount": "20.00"
    },
    "gracePeriod": "30"
  },
  "requestMethodType": "QR_CODE",
  "requestMethod": {
    "qrCodeType": "DYNAMIC",
    "contentType": "IMAGE",
    "correctionLevel": "MEDIUM",
    "imageWidth": 400
  }
}

Response

Due dated QR Code generation with interest and penalty amount missing response
Json
{
    "traceId": "10877634987276541234098776451432",
    "requestId": "cdfff5c4-8d60-9482-9656-d16baf4c2620",
    "httpStatus": 400,
    "title": "Invalid data.",
    "context": [
        {
            "code": "10001",
            "message": "Mandatory value missing.",
            "location": "BODY",
            "field": "$.request.penaltyParameters"
        },
        {
            "code": "10001",
            "message": "Mandatory value missing.",
            "location": "BODY",
            "field": "$.request.interestParameters"
        }
    ]
}

Due dated QR Code generation with interest (missing days type) and penalty

  • Scenario: Due dated QR Code generation with interest (missing days type) and penalty
  • Type: Error
  • Endpoint: /receivables/request-to-pay/v1/payment-requests

Request

Due dated QR Code generation with interest (missing days type) and penalty
Json
{
  "country": "BR",
  "request": {
    "debtor": {
      "name": "JOÃO DA SILVA RIBEIRO",
      "address": {
        "type": "ADDR",
        "addressLines": [
          "AV PAULISTA 200"
        ],
        "city": "SÃO PAULO",
        "state": "SP",
        "postalCode": "01311900",
        "country": "BR"
      },
      "email": {
        "address": "joao.silva@gmail.com",
        "type": "PRIMARY"
      },
      "taxInformation": {
        "taxPayerCategory": "INDIVIDUAL",
        "taxId": "81877226220"
      }
    },
    "creditor": {
      "account": {
        "schemeName": {
          "proprietary": "CNPJ"
        },
        "alternateAccountIdentifier": "70204587000136"
      }
    },
    "expirationType": "DUE_DATE",
    "paymentAmount": "150.00",
    "currency": "BRL",
    "paymentDueDate": "2024-11-01",
    "reference": "Invoiceforenergybill-123456",
    "additionalInformation": [
      {
        "valueType": "Obs",
        "text": "QR with Due Date - Test interest without days indicated"
      }
    ],
    "interestType": "PERCENTAGE_PER_DAY",
    "interestParameters": {
      "percentage": "5.00"
    },
    "discountType": "PERCENTAGE_TO_DATE",
    "discountParameters": {
      "cutOffDetails": [
        {
          "percentage": "2.00",
          "cutOffDate": "2024-10-15"
        }
      ]
    },
    "penaltyType": "FIXED_AMOUNT",
    "penaltyParameters": {
      "amount": "16.50"
    },
    "reductionType": "FIXED_AMOUNT",
    "reductionParameters": {
      "amount": "20.00"
    },
    "gracePeriod": "30"
  },
  "requestMethodType": "QR_CODE",
  "requestMethod": {
    "qrCodeType": "DYNAMIC",
    "contentType": "IMAGE",
    "correctionLevel": "MEDIUM",
    "imageWidth": 400
  }
}

Response

Due dated QR Code generation with interest (missing days type) and penalty response
Json
{
    "traceId": "10877634987276541234098776451432",
    "requestId": "c60fea26-d0fc-9701-92c0-6b8563b86f10",
    "httpStatus": 400,
    "title": "Invalid data.",
    "context": [
        {
            "code": "10001",
            "message": "Mandatory value missing.",
            "location": "BODY",
            "field": "$.request.interestParameters.days"
        }
    ]
}

Immediate QR Code generation with invalid duration format

  • Scenario: Immediate QR Code generation with invalid expiration format
  • Type: Error
  • Endpoint: /receivables/request-to-pay/v1/payment-requests

Request

Immediate QR Code generation with invalid expirationType format
Json
{
  "country": "BR",
  "request": {
    "debtor": {
      "name": "JOÃO DA SILVA RIBEIRO",
      "taxInformation": {
        "taxPayerCategory": "INDIVIDUAL",
        "taxId": "81877226220"
      }
    },
     "creditor": {
      "account": {
        "schemeName": {
          "proprietary": "CNPJ"
        },
        "alternateAccountIdentifier": "info@jpmchase.com"
      }
     },
    "expirationType": "IMMEDIATE2",
    "duration": "1800",
    "paymentAmount": "150.00",
    "currency": "BRL",
    "isAmountAdjustable": false,
    "reference": "QR associated to checkout cart 5423645",
    "additionalInformation": [
      {
        "valueType": "Obs",
        "text": "Immediate QR - Test invalid expirationType"
      }
    ]
  },
  "requestMethodType": "QR_CODE",
  "requestMethod": {
    "qrCodeType": "DYNAMIC",
    "contentType": "IMAGE",
    "correctionLevel": "MEDIUM",
    "imageWidth": 400
  }
}

Response

Immediate QR Code generation with invalid expirationType format response
Json
{
    "traceId": "10877634987276541234098776451432",
    "requestId": "78e6c06a-e6ec-9e0e-bd34-dc2aacdd7992",
    "httpStatus": 400,
    "title": "Invalid data.",
    "context": [
        {
            "code": "10104",
            "message": "Invalid value for expirationType. Value for field must be one of the following: DUE_DATE, IMMEDIATE.",
            "location": "BODY",
            "field": "$.request.expirationType"
        }
    ]
}

Immediate QR Code generation with invalid characters on tax id

  • Scenario: Immediate QR Code generation with invalid duration format
  • Type: Error
  • Endpoint: /receivables/request-to-pay/v1/payment-requests

Request

Immediate QR Code generation with invalid duration format
Json
{
  "country": "BR",
  "request": {
    "debtor": {
      "name": "JOÃO DA SILVA RIBEIRO",
      "taxInformation": {
        "taxPayerCategory": "INDIVIDUAL",
        "taxId": "81877226220"
      }
    },
     "creditor": {
      "account": {
        "schemeName": {
          "proprietary": "CNPJ"
        },
        "alternateAccountIdentifier": "info@jpmmorgan.com"
      }
     },
    "expirationType": "IMMEDIATE",
    "duration": "-1",
    "paymentAmount": "150.00",
    "currency": "BRL",
    "isAmountAdjustable": false,
    "reference": "QR associated to checkout cart 5423645",
    "additionalInformation": [
      {
        "valueType": "Obs",
        "text": "Immediate QR - Test invalid duration"
      }
    ]
  },
  "requestMethodType": "QR_CODE",
  "requestMethod": {
    "qrCodeType": "DYNAMIC",
    "contentType": "IMAGE",
    "correctionLevel": "MEDIUM",
    "imageWidth": 400
  }
}

Response

Immediate QR Code generation with invalid duration format response
Json
{
    "traceId": "10877634987276541234098776451432",
    "requestId": "0fb40d12-0108-9492-93a2-d8ea1fa96555",
    "httpStatus": 400,
    "title": "Invalid data.",
    "context": [
        {
            "code": "10100",
            "message": "Value must be an integer between 1 and 999999",
            "location": "BODY",
            "field": "$.request.duration"
        }
    ]
}

Next Steps

Go to the API specification to review and try out all of the Request to Pay via QR Code endpoints.