Notifications
If you want to keep track of payment and refund statuses, you can subscribe to notifications (webhook, callback).
Notifications are useful for cases when the API object changes without your participation, for example, if the user needs to confirm the payment, the payment process might take from a few minutes to several hours. Instead of sending periodic GET requests  for the duration of this period, you can just wait for a Yandex.Checkout notification to learn about the status.
 Available events
At the moment, Yandex.Checkout sends out notifications for the following events:
EventDescription
payment.waiting_for_capturepayment status changed to 
waiting_for_capture
payment.succeededpayment status changed to 
succeeded
payment.canceledpayment status changed to 
canceled
refund.succeededrefund status changed to 
succeeded
Yandex.Checkout will send you a notification as soon as a payment or refund changes to required status.
More about payment statuses
 Configuration
If you want to receive notifications from Yandex.Checkout, subscribe to them in the Merchant Profile. Specify the URL for notifications and events you want to track in the Integration — HTTP-notifications section.
URL for notifications should begin with https, meaning your website is protected by the SSL certificate. Any certificate is applicable, whether self-signed or issued by the certificate authority.
Minimum SSL/TLS version is TLS v1.2
 For partners
If you’re taking part in the Yandex.Checkout partnership program, you’ll need to subscribe to notifications via API.
Create a webhook object  for every event you want to track by specifying the event you want to subscribe to as well as the URL for notifications in the request .
You’ll need to create a separate set of webhooks for each OAuth token.
Example of request for creating webhook object
cURL
PHP
Python
curl https://payment.yandex.net/api/v3/webhooks \
  -X POST \
  -H 'Authorization: Bearer <oauth_token>' \
  -H 'Idempotence-Key: <Idempotence Key>' \
  -H 'Content-Type: application/json' \
  -d '{
        "event": "payment.succeeded",
        "url": "https://www.merchant-website.com/notification_url"
      }'
Example of the response body
JSON
{
  "id": "wh-e44e8088-bd73-43b1-959a-954f3a7d0c54",
  "event": "payment.succeeded",
  "url": "https://www.merchant-website.com/notification_url"
}
You can view the list of created webhooks  and remove  the ones you don’t need.
Notifications will only be sent for objects created by your app.
 Implementation
After an event you’re subscribed to occurs, a notification will be sent to the URL that you specified during configuration. The notification will contains all the details of the object relevant at the time of the event.
Example of the payment.waiting_for_capture notification body
JSON
{
  "type": "notification",
  "event": "payment.waiting_for_capture",
  "object": {
    "id": "22d6d597-000f-5000-9000-145f6df21d6f",
    "status": "waiting_for_capture",
    "paid": true,
    "amount": {
      "value": "2.00",
      "currency": "RUB"
    },
    "authorization_details": {
      "rrn": "10000000000",
      "auth_code": "000000"
    },
    "created_at": "2018-07-10T14:27:54.691Z",
    "description": "Order No. 72",
    "expires_at": "2018-07-17T14:28:32.484Z",
    "metadata": {},
    "payment_method": {
      "type": "bank_card",
      "id": "22d6d597-000f-5000-9000-145f6df21d6f",
      "saved": false,
      "card": {
        "first6": "555555",
        "last4": "4444",
        "expiry_month": "07",
        "expiry_year": "2021",
        "card_type": "MasterCard",
      "issuer_country": "RU",
      "issuer_name": "Sberbank"
      },
      "title": "Bank card *4444"
    },
    "refundable": false,
    "test": false
  }
}
You will need to confirm that you’ve received the notification. Reply with
200
HTTP code. Yandex.Checkout will ignore everything specified in the body or header of the response. Responses containing any other HTTP codes are considered invalid, and Yandex.Checkout will continue sending out the notification for the next 24 hours following the moment when the event occurred.
 Notification authentication
You can check the authenticity of a notification, for example, by the object status or IP address. This will help you defend yourself against attacks based on fake notifications.
 Object status authentication
Check the current status of the object to ensure that the status in the notification is up-to-date.
 IP authentication
Check the IP address that the notification was sent from. Yandex.Checkout can send notifications from any of the following IP addresses:
  • 185.71.76.0/27
  • 185.71.77.0/27
  • 77.75.153.0/25
  • 77.75.154.128/25
  • 2a02:5180:0:1509::/64
  • 2a02:5180:0:2655::/64
  • 2a02:5180:0:1533::/64
  • 2a02:5180:0:2669::/64
 Processing via SDKs
You can process notifications using our server SDKs:
  1. Obtain data from a POST request made by Yandex.Checkout.
  2. Create a notification class object depending on the event.
  3. Obtain the Payment object.
Example of processing notifications using an SDK
PHP
Python
// Obtain data from a POST request made by Yandex.Checkout.

<?php
    $source = file_get_contents('php://input');
    $requestBody = json_decode($source, true);
?>

// Create a notification class object depending on the event
// NotificationSucceeded, NotificationWaitingForCapture,
// NotificationCanceled,  NotificationRefundSucceeded

<?php
    use YandexCheckout\Model\Notification\NotificationSucceeded;
    use YandexCheckout\Model\Notification\NotificationWaitingForCapture;
    use YandexCheckout\Model\NotificationEventType;

    try {
      $notification = ($requestBody['event'] === NotificationEventType::PAYMENT_SUCCEEDED)
        ? new NotificationSucceeded($requestBody)
        : new NotificationWaitingForCapture($requestBody);
    } catch (Exception $e) {
        // Processing errors
    }
?>

// Obtain the Payment object

<?php
    $payment = $notification->getObject();
?>
 See also
Obtaining payment informationUsing SDKsPayment’s lifecycle