Skip to main content

Change or cancel a payment request

In this tutorial, you will learn how to use the Request to Pay via QR Code API to update or cancel a payment request. By the end of this tutorial, you will know how to:

  • Update a payment request
  • Cancel a payment request
  • Interpret the responses

Before you begin

To use the Request to Pay API, you will need:

  • registered and fully onboarded Developer Account on the J.P. Morgan Payments Developer Portal.
  • An active project that provides you with the credentials used to make a request. 

Update a Payment Request

If you need to modify an existing payment request, you can use the Payment Request endpoint. You can update the payment request details using a client provided Payment Request ID or J.P. Morgan generated Payment Request ID.

Send a request

Send a PUT request to the /payments-requests/{id} endpoint, specifying the Payment Request ID in the path parameter. Here's an example:

Example of updating a payment request
curl --request PUT \
  --url https://api-mock.payments.jpmorgan.com/receivables/request-to-pay/v1/payment-requests/05df6aaa4fea44128795a1d42b5e3e45 \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'If-Match: ' \
  --data '{
  "country": "AU",
  "request": {
    "debtor": {
      "name": "string",
      "address": {
        "type": "ADDR",
        "addressLines": [
          "string"
        ],
        "city": "string",
        "state": "string",
        "postalCode": "string",
        "country": "AU"
      },
      "email": {
        "address": "string",
        "type": "PRIMARY"
      },
      "taxInformation": {
        "taxpayerCategory": "INDIVIDUAL",
        "taxId": "string"
      }
    },
    "creditor": {
      "account": {
        "schemeName": {
          "proprietary": "CPF"
        },
        "alternateAccountIdentifier": "string"
      },
      "name": "string",
      "shortName": "string",
      "address": {
        "type": "ADDR",
        "addressLines": [
          "string"
        ],
        "city": "string",
        "state": "string",
        "postalCode": "string",
        "country": "AU"
      },
      "taxInformation": {
        "taxpayerCategory": "INDIVIDUAL",
        "taxId": "string"
      }
    },
    "expirationType": "IMMEDIATE",
    "paymentDueDate": "2019-08-24",
    "duration": 0,
    "gracePeriod": 0,
    "currency": "AUD",
    "paymentAmount": "10.50",
    "isAmountAdjustable": false,
    "interestType": "NOT_APPLICABLE",
    "interestParameters": {
      "days": "CALENDAR_DAYS",
      "amount": "10.50",
      "percentage": "10.50"
    },
    "discountType": "NOT_APPLICABLE",
    "discountParameters": {
      "days": "CALENDAR_DAYS",
      "cutOffDetails": [
        {
          "cutOffDate": "2019-08-24",
          "percentage": "10.50",
          "amount": "10.50"
        }
      ],
      "percentage": "10.50",
      "amount": "10.50"
    },
    "penaltyType": "NOT_APPLICABLE",
    "penaltyParameters": {
      "amount": "10.50",
      "percentage": "10.50"
    },
    "reductionType": "NOT_APPLICABLE",
    "reductionParameters": {
      "amount": "10.50",
      "percentage": "10.50"
    },
    "reference": "string",
    "additionalInformation": [
      {
        "valueType": "Obs",
        "text": "This bill can be paid after the due date"
      }
    ]
  },
  "requestMethodType": "NONE",
  "requestMethod": {
    "qrCodeType": "STATIC",
    "paymentLinkId": "string",
    "contentType": "IMAGE",
    "correctionLevel": "MEDIUM",
    "imageWidth": 400
  }
}'

Confirm the response

A successful response will return a payload with the updated payment request confirmation and QR code details. Here's an example:

Example of updating a payment request response
Json
{
  "id": "stringstringstringstringstringst",
  "revisionNumber": 0,
  "country": "AU",
  "request": {
    "debtor": {
      "name": "string",
      "address": {
        "type": "ADDR",
        "addressLines": [
          "string"
        ],
        "city": "string",
        "state": "string",
        "postalCode": "string",
        "country": "AU"
      },
      "email": {
        "address": "string",
        "type": "PRIMARY"
      },
      "taxInformation": {
        "taxpayerCategory": "INDIVIDUAL",
        "taxId": "string"
      }
    },
    "creditor": {
      "account": {
        "schemeName": {
          "proprietary": "CPF"
        },
        "alternateAccountIdentifier": "string"
      },
      "name": "string",
      "shortName": "string",
      "address": {
        "type": "ADDR",
        "addressLines": [
          "string"
        ],
        "city": "string",
        "state": "string",
        "postalCode": "string",
        "country": "AU"
      },
      "taxInformation": {
        "taxpayerCategory": "INDIVIDUAL",
        "taxId": "string"
      }
    },
    "expirationType": "IMMEDIATE",
    "paymentDueDate": "2019-08-24",
    "duration": 0,
    "gracePeriod": 0,
    "currency": "AUD",
    "paymentAmount": "10.50",
    "isAmountAdjustable": false,
    "interestType": "NOT_APPLICABLE",
    "interestParameters": {
      "days": "CALENDAR_DAYS",
      "amount": "10.50",
      "percentage": "10.50"
    },
    "discountType": "NOT_APPLICABLE",
    "discountParameters": {
      "days": "CALENDAR_DAYS",
      "cutOffDetails": [
        {
          "cutOffDate": "2019-08-24",
          "percentage": "10.50",
          "amount": "10.50"
        }
      ],
      "percentage": "10.50",
      "amount": "10.50"
    },
    "penaltyType": "NOT_APPLICABLE",
    "penaltyParameters": {
      "amount": "10.50",
      "percentage": "10.50"
    },
    "reductionType": "NOT_APPLICABLE",
    "reductionParameters": {
      "amount": "10.50",
      "percentage": "10.50"
    },
    "reference": "string",
    "additionalInformation": [
      {
        "valueType": "Obs",
        "text": "This bill can be paid after the due date"
      }
    ]
  },
  "requestMethodType": "NONE",
  "requestMethod": {
    "image": "string",
    "mimeType": "image/png",
    "imageWidth": 0,
    "paymentLink": {
      "id": "253f67f3-b640-44cb-aabd-2cc348b52678",
      "expirationType": "IMMEDIATE",
      "country": "AU",
      "url": "http://example.com",
      "createdAt": "2019-08-24T14:15:22Z",
      "paymentRequestId": "stringstringstringstringstringst"
    },
    "text": "string",
    "qrCodeType": "STATIC"
  },
  "createdAt": "2019-08-24T14:15:22Z",
  "updatedAt": "2019-08-24T14:15:22Z",
  "expiresAt": "2019-08-24T14:15:22Z",
  "status": "ACTIVE",
  "settlementSummary": {
    "payment": {
      "endToEndId": "string",
      "currency": "AU",
      "amount": "10.50",
      "interest": "10.50",
      "penalty": "10.50",
      "discount": "10.50",
      "reduction": "10.50"
    },
    "returns": [
      {
        "id": "string",
        "referenceId": "string",
        "currency": "AU",
        "amount": "10.50",
        "type": "USER_REQUEST"
      }
    ]
  }
}

Cancel a Payment Request

If you no longer need to keep a payment request active, cancel the request using the Payment Request endpoint.

Send a request

Send a POST request to the /payments-requests/{id}/cancel endpoint and specify the Payment Request ID in the path parameter. Here's an example:

Example of cancelling a payment request
curl --request POST \
  --url https://api-mock.payments.jpmorgan.com/receivables/request-to-pay/v1/payment-requests/1062ad7dee5c4611962733d4ce5cf9c9/cancel \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --data '{
  "reason": "testing qr code deletion",
  "metaData": [
    {
      "valueType": "example",
      "text": "sampleText"
    }
  ]
}'

Confirm the response

A successful response will return a payload with a confirmation message. Here's an example:

Example of cancelling a payment request response
Json
{
  "message": "Payment request cancelled successfully"
}

Bulk Requests

Bulk requests allow you to update multiple payment requests asynchronously using the /payment-requests/bulk/{id} endpoint. For more information see the Request to Pay via QR Code API specification.

Learn how to create a payment request.