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. Create a payment receipt for a payment.
  2. If the payment receipt contains goods with prepayment, create a transaction completion receipt when dispatching the goods.
 Payment receipt
Data for receipt creation must be transferred when you create a payment or make partial capture (if you’re using 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, you don’t need to send the data for creating a receipt. Create a simple payment with the Sberbank Business Online payment method.
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.
 Transaction completion receipt
Transaction completion is only required if you have accepted a prepayment or advance payment for products.
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.00",
      "amount": {
        "value": "250.00",
        "currency": "RUB"
      },
      "vat_code": "2",
      "payment_mode": "full_payment",
      "payment_subject": "commodity"
    },
    {
      "description": "Product name 2",
      "quantity": "1.00",
      "amount": {
        "value": "100.00",
        "currency": "RUB"
      },
      "vat_code": "2",
      "payment_mode": "full_payment",
      "payment_subject": "commodity"
    }
  ],
  "settlements": [
    {
      "type": "prepayment",
      "amount": {
        "value": "600.00",
        "currency": "RUB"
      }
    },
  ]
}
 See also
Payment processDeclined paymentsReceipts for refundsReference for receipt parameter values