Method: cancelReferenceNumber
Stay organized with collections
Save and categorize content based on your preferences.
Cancels a reference number by invalidating it in the integrators system and preventing future payments.
Only a reference number that was previously created by calling generateReferenceNumber is subject to cancellation.
If the endpoint encounters an error while processing the request, the response body from this endpoint should be of type ErrorResponse
.
An example requests looks like:
{
"requestHeader": {
"protocolVersion": {
"major": 2
},
"requestId": "cmVxdWVzdDE",
"requestTimestamp": {
"epochMillis": "1481899949606"
},
"paymentIntegratorAccountId": "InvisiCashUSA_USD"
},
"generateReferenceNumberRequestId": "aW50ZWdyYXRvciB0cmFuc2FjdGlvbiBpZA"
}
An example response looks like:
{
"responseHeader": {
"responseTimestamp": {
"epochMillis": "1481907920760"
}
},
"result": {
"success": {}
}
}
HTTP request
POST https://www.integratorhost.example.com/integrator-base-path/refundable-one-time-payment-code-v2/cancelReferenceNumber
Request body
The request body contains data with the following structure:
JSON representation |
{
"requestHeader": {
object (RequestHeader )
},
"generateReferenceNumberRequestId": string
} |
Fields |
requestHeader |
object (RequestHeader )
REQUIRED: Common header for all requests.
|
generateReferenceNumberRequestId |
string
REQUIRED: requestId of the generateReferenceNumber which generated the number to be cancelled.
|
Response body
This method supports multiple return types. For additional information about what 4XX or 5XX HTTP status code to return with an ErrorResponse
, consult the ErrorResponse
object and HTTP status codes documentation.
Possible response messages |
HTTP 200 Status |
object (CancelReferenceNumberResponse )
|
HTTP 4XX / 5XX Status |
object (ErrorResponse )
|
CancelReferenceNumberResponse
Response object for the cancelReferenceNumber
method.
CancelReferenceNumberResult
Result of this cancelReferenceNumber
call.
JSON representation |
{
// Union field result can be only one of the following:
"success": {
object (Empty )
},
"referenceNumberAlreadyPaid": {
object (Empty )
}
// End of list of possible types for union field result .
} |
Fields |
Union field result . REQUIRED: Result of this cancelReferenceNumber call. result can be only one of the following: |
success |
object (Empty )
Reference number successfully cancelled.
|
referenceNumberAlreadyPaid |
object (Empty )
Reference number has already been paid. Google should expect a call to referenceNumberPaidNotification for this reference number soon.
|
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-29 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-29 UTC."],[[["\u003cp\u003eCancels a previously generated reference number, preventing future payments associated with it.\u003c/p\u003e\n"],["\u003cp\u003eUses a POST request to the \u003ccode\u003e/refundable-one-time-payment-code-v2/cancelReferenceNumber\u003c/code\u003e endpoint.\u003c/p\u003e\n"],["\u003cp\u003eRequires the \u003ccode\u003egenerateReferenceNumberRequestId\u003c/code\u003e of the original reference number in the request body.\u003c/p\u003e\n"],["\u003cp\u003eReturns a \u003ccode\u003eCancelReferenceNumberResponse\u003c/code\u003e indicating success or provides an \u003ccode\u003eErrorResponse\u003c/code\u003e for errors.\u003c/p\u003e\n"],["\u003cp\u003ePossible results include successful cancellation or notification that the reference number has already been paid.\u003c/p\u003e\n"]]],["This content outlines how to cancel a previously generated reference number via a `POST` request to a specific endpoint. The request body requires a `requestHeader` and the `generateReferenceNumberRequestId`. Successful cancellation returns a `CancelReferenceNumberResponse` with a `success` result. Errors are indicated by an `ErrorResponse`. The response can also include a `referenceNumberAlreadyPaid` result, meaning that it is already paid. Only reference numbers generated by the `generateReferenceNumber` call are eligible for cancellation.\n"],null,["# Method: cancelReferenceNumber\n\n- [HTTP request](#body.HTTP_TEMPLATE)\n- [Request body](#body.request_body)\n - [JSON representation](#body.request_body.SCHEMA_REPRESENTATION)\n- [Response body](#body.response_body)\n- [CancelReferenceNumberResponse](#CancelReferenceNumberResponse)\n - [JSON representation](#CancelReferenceNumberResponse.SCHEMA_REPRESENTATION)\n- [CancelReferenceNumberResult](#CancelReferenceNumberResult)\n - [JSON representation](#CancelReferenceNumberResult.SCHEMA_REPRESENTATION)\n\nCancels a reference number by invalidating it in the integrators system and preventing future payments.\n\nOnly a reference number that was previously created by calling [generateReferenceNumber](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/generateReferenceNumber) is subject to cancellation.\n\nIf the endpoint encounters an error while processing the request, the response body from this endpoint should be of type [`ErrorResponse`](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/ErrorResponse).\n\nAn example requests looks like: \n\n\n {\n \"requestHeader\": {\n \"protocolVersion\": {\n \"major\": 2\n },\n \"requestId\": \"cmVxdWVzdDE\",\n \"requestTimestamp\": {\n \"epochMillis\": \"1481899949606\"\n },\n \"paymentIntegratorAccountId\": \"InvisiCashUSA_USD\"\n },\n \"generateReferenceNumberRequestId\": \"aW50ZWdyYXRvciB0cmFuc2FjdGlvbiBpZA\"\n }\n\nAn example response looks like: \n\n\n {\n \"responseHeader\": {\n \"responseTimestamp\": {\n \"epochMillis\": \"1481907920760\"\n }\n },\n \"result\": {\n \"success\": {}\n }\n }\n\n### HTTP request\n\n`POST https://www.integratorhost.example.com/integrator-base-path/refundable-one-time-payment-code-v2/cancelReferenceNumber`\n\n### Request body\n\nThe request body contains data with the following structure:\n\n| JSON representation |\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"requestHeader\": { object (/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/RequestHeader) }, \"generateReferenceNumberRequestId\": string } ``` |\n\n| Fields ||\n|------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `requestHeader` | `object (`[RequestHeader](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/RequestHeader)`)` **REQUIRED**: Common header for all requests. |\n| `generateReferenceNumberRequestId` | `string` **REQUIRED** : `requestId` of the `generateReferenceNumber` which generated the number to be cancelled. |\n\n### Response body\n\nThis method supports multiple return types. For additional information about what 4XX or 5XX HTTP status code to return with an `ErrorResponse`, consult the `ErrorResponse` object and [HTTP status codes documentation](/pay/refundable-one-time-payment-code-v2/guides/connectivity/protocol-standards#http_status_codes).\n\n| Possible response messages ||\n|-----------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| HTTP 200 Status | `object (`[CancelReferenceNumberResponse](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/cancelReferenceNumber#CancelReferenceNumberResponse)`)` |\n| HTTP 4XX / 5XX Status | `object (`[ErrorResponse](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/ErrorResponse)`)` |\n\nCancelReferenceNumberResponse\n-----------------------------\n\nResponse object for the `cancelReferenceNumber` method.\n\n| JSON representation |\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { \"responseHeader\": { object (/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/ResponseHeader) }, \"result\": { object (/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/cancelReferenceNumber#CancelReferenceNumberResult) } } ``` |\n\n| Fields ||\n|------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `responseHeader` | `object (`[ResponseHeader](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/ResponseHeader)`)` **REQUIRED**: Common header for all responses. |\n| `result` | `object (`[CancelReferenceNumberResult](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/cancelReferenceNumber#CancelReferenceNumberResult)`)` **REQUIRED** : The result of this `cancelReferenceNumber` call. |\n\nCancelReferenceNumberResult\n---------------------------\n\nResult of this `cancelReferenceNumber` call.\n\n| JSON representation |\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ``` { // Union field `result` can be only one of the following: \"success\": { object (/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/Empty) }, \"referenceNumberAlreadyPaid\": { object (/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/Empty) } // End of list of possible types for union field `result`. } ``` |\n\n| Fields ||\n|------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Union field `result`. **REQUIRED** : Result of this `cancelReferenceNumber` call. `result` can be only one of the following: ||\n| `success` | `object (`[Empty](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/Empty)`)` Reference number successfully cancelled. |\n| `referenceNumberAlreadyPaid` | `object (`[Empty](/pay/refundable-one-time-payment-code-v2/payment-integrator-refundable-one-time-payment-code-api/Empty)`)` Reference number has already been paid. Google should expect a call to `referenceNumberPaidNotification` for this reference number soon. |"]]