YooMoney API
Guides
Old versions of the API
Help
Sign up for YooMoney
Receipts for refunds
If you use the YooMoney solution for 54-FZ, you must send a refund receipt after a payment is refunded.
 
Refund receipt sent with the refund
Use this method if you send data for generating the receipt using one of the following scenarios: Payment and receipt at the same time or Payment after receipt.
If you make a full refund, you don’t need to transfer data for the receipt. YooMoney will send the data for registering the receipt to your online sales register as soon as the refund is created .
If you’re making a partial refund, send the information about the returned products in the receipt object when creating a refund .
Example of a request for partial refund with the receipt data
cURL
PHP
Python
curl https://api.yookassa.ru/v3/refunds \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "payment_id": "<Refunded payment ID>",
        "amount": {
          "value": "600.00",
          "currency": "RUB"
        },
        "receipt": {
          "customer" : {
            "full_name" : "Ivanov Ivan Ivanovich",
            "email" : "email@email.ru",
            "phone" : "79000000000",
            "inn" : "6321000014"
          },
          "items": [
            {
              "description": "Product name 1",
              "quantity": "2.00",
              "amount": {
                "value": "250.00",
                "currency": "RUB"
              },
              "vat_code": "2"
            },
            {
              "description": "Product name 2",
              "quantity": "1.00",
              "amount": {
                "value": "100.00",
                "currency": "RUB"
              },
              "vat_code": "2"
            }
          ]
        }
      }'
As soon as the refund is created, YooMoney will send the receipt registration data to your online sales register.
Refund receipt in a separate request
In the Receipt after payment scenario, you control the process of sending the receipt manually by sending the data for creating them in a separate request.
The refund receipt for full or partial refund is created in the same manner as the payment receipt, but instead of the payment ID (payment_id) you must specify the refund ID (refund_id), as well as the refund value in the type parameter. You can create up to 30 receipts for one refund.
Example of request for creating a refund receipt
cURL
PHP
Python
curl https://api.yookassa.ru/v3/receipts \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "customer": {
          "full_name": "Ivanov Ivan Ivanovich",
          "email": "email@email.ru",
          "phone": "79000000000",
          "inn": "6321000014"
        },
        "refund_id": "216749f7-0016-50be-b000-078d43a63ae4",
        "type": "refund",
        "send": "true",
        "items": [
          {
            "description": "Product name 1",
            "quantity": "2.00",
            "amount": {
              "value": "250.00",
              "currency": "RUB"
            },
            "vat_code": "2",
            "payment_mode": "full_payment",
            "payment_subject": "commodity",
            "country_of_origin_code": "CN"
          },
          {
            "description": "Product name 2",
            "quantity": "1.00",
            "amount": {
              "value": "100.00",
              "currency": "RUB"
            },
            "vat_code": "2",
            "payment_mode": "full_payment",
            "payment_subject": "commodity",
            "country_of_origin_code": "CN"
          }
        ],
        "settlements": [
          {
            "type": "prepayment",
            "amount": {
              "value": "600.00",
              "currency": "RUB"
            }
          }
        ]
      }'
In response, YooMoney will send you the receipt object  in its current status.
Example of the response body
JSON
{
  "id": "rt_1da5c87d-0984-50e8-a7f3-8de646dd9ec9",
  "type": "refund",
  "refund_id": "216749f7-0016-50be-b000-078d43a63ae4",
  "status": "pending",
  "items": [
    {
      "description": "Product name 1",
      "quantity": 2.000,
      "amount": {
        "value": "250.00",
        "currency": "RUB"
      },
      "vat_code": "2",
      "payment_mode": "full_payment",
      "payment_subject": "commodity",
      "country_of_origin_code": "CN"
    },
    {
      "description": "Product name 2",
      "quantity": 1.000,
      "amount": {
        "value": "100.00",
        "currency": "RUB"
      },
      "vat_code": "2",
      "payment_mode": "full_payment",
      "payment_subject": "commodity",
      "country_of_origin_code": "CN"
    }
  ],
  "settlements": [
    {
      "type": "prepayment",
      "amount": {
        "value": "600.00",
        "currency": "RUB"
      }
    }
  ]
}
If the payment that you created the payment receipt for was partially captured or, for some reason, canceled (payment object with the canceled status), you will need to generate the refund receipt independently.
To do that, send a request for creating a refund receipt  to YooMoney by sending the type parameter with the refund value and the ID of the cancelled or partially captured payment (payment_id).
Example of request
cURL
PHP
Python
curl https://api.yookassa.ru/v3/receipts \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "customer": {
          "full_name": "Ivanov Ivan Ivanovich",
          "email": "email@email.ru",
          "phone": "79000000000",
          "inn": "6321000014"
        },
        "payment_id": "24b94598-000f-5000-9000-1b68e7b15f3f",
        "type": "refund",
        "send": "true",
        "items": [
          {
            "description": "Product name 1",
            "quantity": "2.00",
            "amount": {
              "value": "250.00",
              "currency": "RUB"
            },
            "vat_code": "2",
            "payment_mode": "full_payment",
            "payment_subject": "commodity",
            "country_of_origin_code": "CN"
          },
          {
            "description": "Product name 2",
            "quantity": "1.00",
            "amount": {
              "value": "100.00",
              "currency": "RUB"
            },
            "vat_code": "2",
            "payment_mode": "full_payment",
            "payment_subject": "commodity",
            "country_of_origin_code": "CN"
          }
        ],
        "settlements": [
          {
            "type": "prepayment",
            "amount": {
              "value": "600.00",
              "currency": "RUB"
            }
          }
        ]
      }'
Example of the response body
JSON
{
  "id": "rt_1da5c87d-0984-50e8-a7f3-8de646dd9ec9",
  "type": "refund",
  "payment_id": "24b94598-000f-5000-9000-1b68e7b15f3f",
  "status": "pending",
  "items": [
    {
      "description": "Product name 1",
      "quantity": 2.000,
      "amount": {
        "value": "250.00",
        "currency": "RUB"
      },
      "vat_code": "2",
      "payment_mode": "full_payment",
      "payment_subject": "commodity",
      "country_of_origin_code": "CN"
    },
    {
      "description": "Product name 2",
      "quantity": 1.000,
      "amount": {
        "value": "100.00",
        "currency": "RUB"
      },
      "vat_code": "2",
      "payment_mode": "full_payment",
      "payment_subject": "commodity",
      "country_of_origin_code": "CN"
    }
  ],
  "settlements": [
    {
      "type": "prepayment",
      "amount": {
        "value": "600.00",
        "currency": "RUB"
      }
    }
  ]
}
Memo on preparing data for receipts
Make sure that you are specifying the correct data for receipts in the receipt object:
  • the receipt object is specified only in requests for partial refunds;
  • all required parameters are included;
  • the quantity of goods does not exceed the quantity indicated in the registered receipt;
  • the refund amount in amount matches the total amount of returned products in the receipt object (to determine the amount of returned products, multiply quantity by amount for each product and add the resulting values for all products);
  • all amounts in the receipt are positive.
If something goes wrong, YooMoney will return an error.
See also