Receipts for payments
Receipts reflect the status of mutual settlements between you and the user, confirming that the user has made the payment, and you in turn have provided them with the payment subject, for example, goods. If payment and delivery of the goods are separated in time, for example, when the goods are delivered by courier, you will need to generate an additional receipt when dispatching the goods.
 
General scenario
  1. Select the scenario for sending the receipt.
  2. Create a payment receipt in the request for creating a payment or as a separate request (depending on the selected scenario for sending the receipt).
  3. If the payment receipt contains goods with prepayment, create a transaction completion receipt when dispatching the goods.
 
Payment receipt in the request for creating a payment
If you send receipts using one of the following scenarios: Payment and receipt at the same time or Payment after receipt, data for creating the receipt must be sent during payment creation and partial capture (if you use two-stage payments).
 
Payment creation
To generate a receipt for a processed payment, create a payment  and specify the 
receipt
object in the request along with the data for online sales register.
If you’re going to accept a payment from a legal entity via Sberbank Business Online, you don’t need to send the 
receipt
object with the data for the receipt.
Example of a request for payment with receipt parameters
cURL
PHP
Python
curl https://payment.yandex.net/api/v3/payments \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "amount": {
          "value": "600.00",
          "currency": "RUB"
        },
        "confirmation": {
          "type": "redirect",
          "return_url": "https://www.merchant-website.com/return_url"
        },
        "receipt": {
          "customer": {
            "full_name": "Ivanov Ivan Ivanovich",
            "phone": "79000000000"
          },
          "items": [
            {
              "description": "Product name 1",
              "quantity": "2.00",
              "amount": {
                "value": "250.00",
                "currency": "RUB"
              },
              "vat_code": "2",
              "payment_mode": "full_prepayment",
              "payment_subject": "commodity"
            },
            {
              "description": "Product name 2",
              "quantity": "1.00",
              "amount": {
                "value": "100.00",
                "currency": "RUB"
              },
              "vat_code": "2",
              "payment_mode": "full_prepayment",
              "payment_subject": "commodity"
            }
          ]
        }
      }'
The created payment object  will be returned in response. You can find out whether or not the receipt is created by the 
receipt_registration
parameter value. If something goes wrong, use your online sales register to generate the receipt manually.
Example of the response body
JSON
{
  "id": "227cf565-000f-5000-8000-1c9d1c6000fb",
  "status": "succeeded",
  "paid": true,
  "amount": {
    "value": "600.00",
    "currency": "RUB"
  },
  "authorization_details": {
    "rrn": "10000000000",
    "auth_code": "000000"
  },
  "captured_at": "2018-05-03T10:17:31.487Z",
  "created_at": "2018-05-03T10:17:09.337Z",
  "metadata": {},
  "payment_method": {
    "type": "bank_card",
    "id": "227cf565-000f-5000-8000-1c9d1c6000fb",
    "saved": false,
    "card": {
      "first6": "411111",
      "last4": "1111",
      "expiry_month": "01",
      "expiry_year": "2020",
      "card_type": "Visa",
      "issuer_country": "RU",
      "issuer_name": "Sberbank"
    },
    "title": "Bank card *1111"
  },
  "receipt_registration": "pending",
  "recipient": {
    "account_id": "100001",
    "gateway_id": "1000001"
  },
  "refundable": true,
  "refunded_amount": {
    "value": "600.00",
    "currency": "RUB"
  }
}
If after the user’s payment the status changes to 
canceled
, Yandex.Checkout will automatically send the data for generating a refund receipt to the online sales register.
 
Partial capture
If you process payments in two stages, partial capture will result in two new receipts: one for the refund of the previous payment, the other for the payment with corrected details. So if you want to partially capture a payment, send the receipt object with the data for generating a new receipt in the request for capture .
Example of request with a partial capture
cURL
PHP
Python
curl https://payment.yandex.net/api/v3/payments/:id/capture \
  -X POST \
  -u <Shop ID>:<Secret Key> \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "amount": {
          "value": "500.00",
          "currency": "RUB"
        },
        "receipt": {
          "customer": {
            "full_name": "Ivanov Ivan Ivanovich",
            "phone": "79000000000"
          },
          "items": [
            {
              "description": "Product name 1",
              "quantity": "2.00",
              "amount": {
                "value": "250.00",
                "currency": "RUB"
              },
              "vat_code": "2",
              "payment_mode": "full_prepayment",
              "payment_subject": "commodity"
            }
          ]
        }
      }'
If you capture the total amount, don’t send the data for the receipt.
 
Payment receipt in a separate request
If you send receipts by the Receipt after payment scenario, data for generating the receipt must be sent in a separate request.
In this case, request for creating the payment must not include the 
receipt
object. In response to the request containing the 
receipt
object Yandex.Checkout will return an error.
Payment receipts must be created for payments waiting for your capture (payment object with
waiting_for_capture
status) or successful payments (payment object with
succeeded
status).
 
Receipt creation
To create a payment receipt, send a request for creating a receipt  to Yandex.Checkout. In this request, specify payment ID (
payment_id
) that you’re generating the receipt for, the 
type
parameter with the 
payment
value, and other necessary parameters. и другие необходимые параметры.
Example of request for creating a receipt separately from payment
cURL
PHP
Python
curl https://payment.yandex.net/api/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" : "7100000000",
          "inn" : "6321000014"
        },
        "payment_id": "24b94598-000f-5000-9000-1b68e7b15f3f",
        "type": "payment",
        "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"
            }
          }
        ]
      }'
Yandex.Checkout will send you the receipt object  in response.
Example of the response body
JSON
{
  "id": "rt_1da5c87d-0984-50e8-a7f3-8de646dd9ec9",
  "type": "payment",
  "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"
      }
    }
  ]
}
 
Partial capture
If you process payments in two stages, then after the partial capture you must generate two new receipts: refund receipt for the initial payment (full amount) and payment receipt with amended data.
In this case, request for capture  should be sent without the 
receipt
object.
If you capture the entire amount, you need to create one payment receipt after the payment status changes to 
waiting_for_capture
.
 
Transaction completion receipt
Transaction completion is only required if you have accepted a prepayment or advance payment for products. Method and procedure for generating the transaction completion receipt are not dependent on the selected scenario for sending the receipts.
To generate a transaction completion receipt, send a request for creating a payment receipt  (
type
with the 
payment
value). All products in this receipt must include the “Full Payment” payment method attribute. Specify all completed settlements in the 
settlements
object: for example, if there were several partial prepayments, you will need to list each of them with the “Prepayment (advance)” settlement type.
Example of request for creating a receipt
cURL
PHP
Python
curl https://payment.yandex.net/api/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" : "79211234567",
          "inn" : "6321341814"
        },
        "payment_id": "24b94598-000f-5000-9000-1b68e7b15f3f",
        "type": "payment",
        "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"
            }
          }
        ]
      }'
The receipt object  will be sent in response.
JSON
{
  "id": "rt_1da5c87d-0984-50e8-a7f3-8de646dd9ec9",
  "type": "payment",  
  "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"
      }
    },
  ]
}
 
See also
Payment processDeclined paymentsGenerating receipts for refundsReference for receipt parameter values