Receipts for refunds
This article describes the procedure of making refunds using the YooMoney solution for automatic registration of receipts in the Moi nalog service.
How it works
Upon a full refund of a payment, YooMoney will cancel the receipt in the Moi nalog service.
With a partial refund, YooMoney will cancel the old receipt and register a new receipt for the part of the order that remains after the return. The receipt data must be specified in the
receipt
object in the same request as the return data.If you created the payment before enabling auto-sending of receipts while returning it after you've activated the option, you will need to correct or cancel the receipt independently. It will not be possible to manage these receipts via the API.
Full refund
If you are making a full refund, you do not need to send the receipt data.
To make a refund, send a standard request for refund creation . Do not specify the
receipt
object.Example of the request for a full refund with 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 '{ "amount": { "value": "1000.00", "currency": "RUB" }, "payment_id": "<Refunded payment ID>" }'
During the refund, YooMoney will automatically cancel the payment receipt.
Partial refund
If you are making a partial refund, specify the
receipt
object with data for the receipt in the request for refund creation . You must specify the user's contact information (email or phone number) and data about the products and services that the user is returning.Product name (
item.description
) and price of a unit (item.amount
) must exactly match the data specified in the registered receipt. Why this is importantExample of the request for a partial refund with receipt data
cURL
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": "750.00", "currency": "RUB" }, "receipt": { "customer": { "email": "user@example.com" }, "items": [ { "description": "Spoon", "quantity": 10, "amount": { "value": "50.00", "currency": "RUB" }, "vat_code": 1 }, { "description": "Tea cup", "quantity": 1, "amount": { "value": "150.00", "currency": "RUB" }, "vat_code": 1 }, { "description": "Saucer", "quantity": 1, "amount": { "value": "100.00", "currency": "RUB" }, "vat_code": 1 } ] } }'
As soon as the refund is created, YooMoney will cancel the old receipt and create a new one with the data on the products remaining after the return.
You can find out if a receipt has been generated by the value of the
receipt_registration
parameter in the refund object and in the payment history of your YooMoney Merchant Profile. If something goes wrong, create a receipt manually in the Moi nalog service and send the link to the receipt to the user independently.Specifics of generating receipts for partial refunds
In the request for creating a refund, you specify the data about the returned products. To generate a new receipt for the remaining products, YooMoney will take the data that you provided for the refund and compare it with the data in the registered receipt.
If the product information matches, YooMoney will generate a detailed receipt: exclude the returned products and generate a new receipt with a detailed description of each item.
If YooMoney does not find any of the returned products in the original receipt, for example, due to a typo in the name, it will generate an overall receipt with one fixed position,
Order after return
, and the adjusted amount.Example
When making a payment, you provided the following information:
Name (description) | Amount | Quantity |
---|---|---|
Spoon | 50.00 | 10 |
Tea cup | 150.00 | 2 |
Saucer | 100.00 | 2 |
The total amount of the order is 1,000 rubles.
You want to return the cup and saucer. The total refund amount is 250 rubles, the total amount of the rest of the order is 750 rubles.
Example of correct data for the return
Name (description) | Amount | Quantity |
---|---|---|
Tea cup | 150.00 | 1 |
Saucer | 100.00 | 1 |
The names of the products are specified in the receipt registered in the Moi nalog service. In this case, YooMoney will generate a detailed receipt:
Name (description) | Amount | Quantity |
---|---|---|
Spoon | 50.00 | 10 |
Tea cup | 150.00 | 1 |
Saucer | 100.00 | 1 |
Example of invalid data for the return
Name (description) | Amount | Quantity |
---|---|---|
Teacup | 150.00 | 1 |
Saucer | 100.00 | 1 |
Some product names are different. In this case, YooMoney will generate a overall receipt:
Name (description) | Amount | Quantity |
---|---|---|
Order after the return | 750.00 | 1 |
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; - user's e-mail or phone number are provided (data is specified in the
customer
object); - for each product,
items
contains only thedescription
,amount
,quantity
,vat_code
parameters; there are no other parameters; - names of the products and the amount per unit of product fully match the data in the registered receipt;
- the quantity of goods does not exceed the quantity indicated in the registered receipt;
quantity
contains only integers (without dot and fractional part);vat_code
is1
everywhere;- the refund amount in
amount
matches the total amount of returned products in thereceipt
object (to determine the amount of returned products, multiplyquantity
byamount
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