Cancels or refunds a payment.

POST /cancelOrRefund

Cancels a payment if it has not been captured yet, or refunds it if it has already been captured. This is useful when it is not certain if the payment has been captured or not (for example, when using auto-capture).

Do not use this request for payments that involve (multiple) partial captures.

For more information, refer to Cancel or refund.

application/json

Body

  • This field contains additional data, which may be required for a particular modification request.

    The additionalData object consists of entries, each of which includes the key and value. For more information on possible key-value pairs, refer to the ModificationRequest.additionalData section.

  • merchantAccount string Required

    The merchant account that is used to process the payment.

  • The amount that needs to be captured/refunded. Required for /capture and /refund, not allowed for /cancel. The currency must match the currency used in authorisation, the value must be smaller than or equal to the authorised amount.

    Hide modificationAmount attributes Show modificationAmount attributes
    • currency string Required

      The three-character ISO currency code.

      Minimum length is 3, maximum length is 3.

    • value integer(int64) Required

      The payable amount that can be charged for the transaction.

      The transaction amount needs to be represented in minor units according to the following table.

  • The original merchant reference to cancel.

  • originalReference string Required

    The original pspReference of the payment to modify. This reference is returned in:

    • authorisation response
    • authorisation notification
  • Optionally, you can specify your reference for the payment modification. This reference is visible in Customer Area and in reports. Maximum length: 80 characters.

  • splits array[object]

    The details of how the payment should be split when distributing a payment to a Marketpay Marketplace and its Accounts.

    Hide splits attributes Show splits attributes
    • account string

      The account to which this split applies.

      Required if the type is MarketPlace.

    • amount object Required

      The amount of this split.

      Hide amount attributes Show amount attributes
      • currency string

        The three-character ISO currency code.

        If this value is not provided, the currency in which the payment is made will be used.

        Minimum length is 3, maximum length is 3.

      • value integer(int64) Required

        The payable amount that can be charged for the transaction.

        The transaction amount needs to be represented in minor units according to the following table.

    • A description of this split.

    • The reference of this split. Used to link other operations (e.g. captures and refunds) to this split.

      Required if the type is MarketPlace.

    • type string Required

      The type of this split.

      Permitted values: Default, PaymentFee, VAT, Commission, MarketPlace, Verification.

      Values are Commission, Default, MarketPlace, PaymentFee, VAT, or Verification.

  • The transaction reference provided by the PED. For Point-of-sale integrations only.

  • Unique terminal ID for the PED that originally processed the request. For Point-of-sale integrations only.

Responses

  • 200

    OK - the request has succeeded.

    Hide response attributes Show response attributes object
    • This field contains additional data, which may be returned in a particular modification response.

    • Adyen's 16-character string reference associated with the transaction/request. This value is globally unique; quote it when communicating with us about this request.

    • response string

      Indicates if the modification request has been received for processing.

      Values are [capture-received], [cancel-received], [refund-received], or [cancelOrRefund-received].

  • 401

    Unauthorized - authentication required.

  • 403

    Forbidden - insufficient permissions to process the request.

  • 422

    Unprocessable Entity - a request validation error.

  • 500

    Internal Server Error - the server could not process the request.

POST /cancelOrRefund
curl \
 -X POST https://pal-test.adyen.com/pal/servlet/Payment/v40/cancelOrRefund \
 -H "Content-Type: application/json" \
 -d '{"additionalData":{},"merchantAccount":"string","modificationAmount":{"currency":"string","value":42},"originalMerchantReference":"string","originalReference":"string","reference":"string","splits":[{"account":"string","amount":{"currency":"string","value":42},"description":"string","reference":"string","type":"Commission"}],"tenderReference":"string","uniqueTerminalId":"string"}'
Request example
{
  "additionalData": {},
  "merchantAccount": "string",
  "modificationAmount": {
    "currency": "string",
    "value": 42
  },
  "originalMerchantReference": "string",
  "originalReference": "string",
  "reference": "string",
  "splits": [
    {
      "account": "string",
      "amount": {
        "currency": "string",
        "value": 42
      },
      "description": "string",
      "reference": "string",
      "type": "Commission"
    }
  ],
  "tenderReference": "string",
  "uniqueTerminalId": "string"
}
Request examples
{
  "additionalData": {},
  "merchantAccount": "string",
  "modificationAmount": {
    "currency": "string",
    "value": 42
  },
  "originalMerchantReference": "string",
  "originalReference": "string",
  "reference": "string",
  "splits": [
    {
      "account": "string",
      "amount": {
        "currency": "string",
        "value": 42
      },
      "description": "string",
      "reference": "string",
      "type": "Commission"
    }
  ],
  "tenderReference": "string",
  "uniqueTerminalId": "string"
}
Response examples (200)
{
  "additionalData": {},
  "pspReference": "string",
  "response": "[capture-received]"
}
Response examples (200)
{
  "additionalData": {},
  "pspReference": "string",
  "response": "[capture-received]"
}