Примеры webhook-оповещений

Для секретного ключа = "secret_key" и оповещения:

content-type: "application/json"
signature: "e970dee7309c7793d2ef33e991c9603487a35eaa26c1f159a2fdad1c049671ffc4b8e887e2eb52c2cdbfc495ec528130d25575a0ecff386aad8096e20094003c"

{
  "event": "order.created",
  "event_date": "2021-08-13T09:16:35+03:00",
  "order_id": 5555555,
  "order_name": "A0005555555",
  "status": "not paid",
  "external_id": "TEST12025",
  "create_date": "2021-08-13T09:16:35+03:00",
  "pay_date": "",
  "currency": "RUB",
  "locale": "ru_RU",
  "order_detail_url": "https://shop.checkout.softline.ru/order/status/5555555/1a97507",
  "customer": {
    "country": "RU",
    "type": "physical",
    "email": "customer@mail.ru",
    "first_name": "Иван",
    "last_name": "Петров",
    "phone": "",
    "vat_number": "",
    "company_name": "",
    "company_billing_address": "",
    "company_delivery_address": ""
  },
  "product": {
    "id": 111111,
    "vendor_code": "",
    "sku": "",
    "business_segment": "",
    "name": "Demo",
    "price": "100.00",
    "quantity": 1,
    "discount_percent": "",
    "discount_amount": "",
    "vat_amount": "0.00",
    "amount": "100.00",
    "margin": "90.00"
  },
  "payment": {
    "payment_method": "CreditCard",
    "payment_system_name": "Bank Card",
    "card_type": "",
    "card_last_4": null,
    "card_expiration_date": "",
    "is_card_expired": false,
    "is_installment_payment": false
  },
  "document_part": "1-of-1"
}
  • Выполните конкатенацию секретного ключа и значений параметров из тела запроса по шаблону:
    [secret key];[event];[order_id];[create_date];[payment_method];[currency];[customer.email]
    Результат:
secret_key;order.created;5555555;2021-08-13T09:16:35+03:00;CreditCard;RUB;customer@mail.ru
  • Примените SHA-512 hash-функцию к полученной строке.
    Результат:
e970dee7309c7793d2ef33e991c9603487a35eaa26c1f159a2fdad1c049671ffc4b8e887e2eb52c2cdbfc495ec528130d25575a0ecff386aad8096e20094003c
  • Проверьте, что полученный результат совпадает с подписью в HTTP заголовке оповещения.
{
  "event": "order.created",
  "event_date": "2021-08-13T09:16:35+03:00",
  "order_id": 5555555,
  "order_name": "A0005555555",
  "status": "not paid",
  "external_id": "TEST12025",
  "create_date": "2021-08-13T09:16:35+03:00",
  "pay_date": "",
  "currency": "RUB",
  "locale": "ru_RU",
  "order_detail_url": "https://shop.checkout.softline.ru/order/status/5555555/1a97507",
  "customer": {
    "country": "RU",
    "type": "physical",
    "email": "customer@mail.ru",
    "first_name": "Иван",
    "last_name": "Петров",
    "phone": "",
    "vat_number": "",
    "company_name": "",
    "company_billing_address": "",
    "company_delivery_address": ""
  },
  "product": {
    "id": 111111,
    "vendor_code": "",
    "sku": "",
    "business_segment": "",
    "name": "Demo",
    "price": "100.00",
    "quantity": 1,
    "discount_percent": "",
    "discount_amount": "",
    "vat_amount": "0.00",
    "amount": "100.00",
    "margin": "90.00"
  },
  "payment": {
    "payment_method": "CreditCard",
    "payment_system_name": "Bank Card",
    "card_type": "",
    "card_last_4": null,
    "card_expiration_date": "",
    "is_card_expired": false,
    "is_installment_payment": false
  },
  "document_part": "1-of-1"
}
{
  "event": "order.payment.succeeded",
  "event_date": "2021-08-13T09:20:05+03:00",
  "order_id": 5555555,
  "order_name": "A0005555555",
  "status": "paid",
  "external_id": "TEST12025",
  "create_date": "2021-08-13T09:16:35+03:00",
  "pay_date": "2021-08-13T09:20:05+03:00",
  "currency": "RUB",
  "locale": "ru_RU",
  "order_detail_url": "https://shop.checkout.softline.ru/order/status/5555555/1a97507",
  "customer": {
    "country": "RU",
    "type": "physical",
    "email": "customer@mail.ru",
    "first_name": "Иван",
    "last_name": "Петров",
    "phone": " ",
    "vat_number": "",
    "company_name": "",
    "company_billing_address": "",
    "company_delivery_address": ""
  },
  "product": {
    "id": 111222,
    "vendor_code": "",
    "sku": "",
    "business_segment": "",
    "name": "Demo",
    "price": "100.00",
    "quantity": 1,
    "discount_percent": "",
    "discount_amount": "",
    "vat_amount": "0.00",
    "amount": "100.00",
    "margin": "95.00"
  },
  "payment": {
    "payment_method": "CreditCard",
    "payment_system_name": "Bank Card",
    "card_type": "Visa",
    "card_last_4": "1234",
    "card_expiration_date": "12/2026",
    "is_card_expired": false,
    "is_installment_payment": false
  },
  "additional_data": [{
      "name": "referer2",
      "value": "test"
    }, {
      "name": "referer3",
      "value": "TEST12025"
    }
  ],
  "document_part": "1-of-1"
}
{
  "event": "order.payment.failed",
  "event_date": "2021-08-13T09:18:05+03:00",
  "order_id": 5555555,
  "order_name": "A0005555555",
  "status": "not paid",
  "external_id": "TEST12025",
  "create_date": "2021-08-13T09:16:35+03:00",
  "pay_date": "",
  "currency": "RUB",
  "locale": "ru_RU",
  "order_detail_url": "https://shop.checkout.softline.ru/order/status/5555555/1a97507",
  "customer": {
    "country": "RU",
    "type": "physical",
    "email": "customer@mail.ru",
    "first_name": "Иван",
    "last_name": "Петров",
    "phone": "",
    "vat_number": "",
    "company_name": "",
    "company_billing_address": "",
    "company_delivery_address": ""
  },
  "product": {
    "id": 111111,
    "vendor_code": "",
    "sku": "",
    "business_segment": "",
    "name": "Demo",
    "price": "100.00",
    "quantity": 1,
    "discount_percent": "",
    "discount_amount": "",
    "vat_amount": "0.00",
    "amount": "100.00",
    "margin": "90.00"
  },
  "payment": {
    "payment_method": "CreditCard",
    "payment_system_name": "Bank Card",
    "payment_error_code": "AS102",
    "payment_error_description": "Отказ в авторизации. Недостаточно средств.",
    "card_type": "",
    "card_last_4": null,
    "card_expiration_date": "",
    "is_card_expired": false,
    "is_installment_payment": false
  },
  "additional_data": [{
      "name": "referer2",
      "value": "test"
    }, {
      "name": "referer3",
      "value": "TEST12025"
    }
  ],
  "document_part": "1-of-1"
}

Выполнен возврат оплаты (product.returned)

{
  "event": "product.returned",
  "event_date": "2022-08-14T09:16:35+03:00",
  "order_id": 6666666,
  "order_name": "A0006666666",
  "status": "deleted",
  "external_id": "TEST12025",
  "create_date": "2021-08-13T09:16:35+03:00",
  "pay_date": "2021-08-13T09:20:05+03:00",
  "currency": "RUB",
  "locale": "ru_RU",
  "order_detail_url": "https://shop.checkout.softline.ru/order/status/6666666/1a97507",
  "customer": {
    "country": "RU",
    "type": "physical",
    "email": "customer@mail.ru",
    "first_name": "Иван",
    "last_name": "Петров",
    "phone": "",
    "vat_number": "",
    "company_name": "",
    "company_billing_address": "",
    "company_delivery_address": ""
  },
  "product": {
    "id": 111111,
    "vendor_code": "",
    "sku": "",
    "business_segment": "",
    "name": "Demo",
    "price": "100.00",
    "quantity": 1,
    "discount_percent": "",
    "discount_amount": "",
    "vat_amount": "0.00",
    "amount": "100.00",
    "margin": "95.00",
  },
  "payment": {
    "payment_method": "CreditCard",
    "payment_system_name": "Bank Card",
    "card_type": "Visa",
    "card_last_4": "1234",
    "card_expiration_date": "12/2026",
    "is_card_expired": false,
    "is_installment_payment": false
  },
  "return": {
    "type": "returned",
    "reason": "test order",
    "date": "2022-08-14T09:16:35+03:00"
  },
  "additional_data": [{
      "name": "referer2",
      "value": "test"
    }, {
      "name": "referer3",
      "value": "TEST12025"
    }
  ],
  "document_part": "1-of-1"
}