---
description: Description of the Webhooks used in TurinPay
---

# Webhooks

Webhooks are used for TurinPay to communicate events to external applications

### Invoice paid event

This event will be emited when an _Invoice_ associated to a _Payment Intent_ has been successfully paid in the system, and the funds have been transfered in the account wallet of the turinpay.

To capture this event, you need to implement server with a **POST** Api Rest event in a endpoint. This endpoint is defined in the _notificationUrl_ field in the creation of the Payment Intent.

The data that you will receive is detailed below:

```json
{
	"app_name": "turinpay-gql-backend",
	"package_name": "turinpay-gql-backend",
	"package_version": "0.20.0",
	"payload": {
		"transactionId": "ln_28aae4fe-6325-4710-b85a-cc6757e8b72d",
		"type": "DEPOSIT_FROM_LIGHTNING",
		"amount": 29590,
		"currency": "SAT",
		"description": "The description of your product",
		"userId": "6fce6fcc-21f1-4788-a504-8f07b3a26ac5",
		"metadata": {
			"lightningInfo": {
				"request": "lnbcrt295900n1p3s72ajpp5ghuec29neh5tk2luwfnk93f8aajyx4d8dc4l0hq4x42fwrt4sa6sdqlg3hku6m90ysykmmwvusyxmm4de68y7gcqzpgxqrpcgsp57hy5s80n4kqsdyt05wlcx7ttxq336hclldw2sc5qcczpql76qv0q9qyyssq306c6ats98l4jes4m4qsy4vv4ze0c8ddhct9zv7hfqh90pvredesw6sv8dl23dtgjadzettg7m3q07epujnjrtxaqrdrqpe0t3nldjqqn70kv0"
			},
			"operationalData": {
				"purpose": "DEPOSIT"
			}
		},
		"domainApp": "TurinPay",
		"executionEnvironment": "SANDBOX_ENVIRONMENT",
		"date": "2022-08-31T09:36:52.423Z",
		"invoice": {
			"_id": "28aae4fe-6325-4710-b85a-cc6757e8b72d",
			"createdAt": "2022-08-31T09:36:50.210Z",
			"executionEnvironment": "SANDBOX_ENVIRONMENT",
			"invoiceDetail": {
				"_id": "28aae4fe-6325-4710-b85a-cc6757e8b72d",
				"amount": 29590,
				"description": "The description of your product",
				"status": "PAID",
				"onMempool": false,
				"expiresOn": 1661940410202,
				"chainAddress": "bcrt1qz5n33sj9ff8y82rk9jc9ppgcnlq6yawl8vj6j2",
				"chainEstimatedFee": 7050,
				"chainRequest": "bcrt1qz5n33sj9ff8y82rk9jc9ppgcnlq6yawl8vj6j2?amount=0.0002959",
				"request": "lnbcrt295900n1p3s72ajpp5ghuec29neh5tk2luwfnk93f8aajyx4d8dc4l0hq4x42fwrt4sa6sdqlg3hku6m90ysykmmwvusyxmm4de68y7gcqzpgxqrpcgsp57hy5s80n4kqsdyt05wlcx7ttxq336hclldw2sc5qcczpql76qv0q9qyyssq306c6ats98l4jes4m4qsy4vv4ze0c8ddhct9zv7hfqh90pvredesw6sv8dl23dtgjadzettg7m3q07epujnjrtxaqrdrqpe0t3nldjqqn70kv0",
				"domainApp": "TurinPay",
				"executionEnvironment": "SANDBOX_ENVIRONMENT",
				"paymentIntentId": "05180735-935b-4af9-827f-12b16f63f5ab"
			},
			"modifiedAt": "2022-08-31T09:36:50.210Z",
			"orderId": "orderId",
			"paymentIntentDetail": {
				"_id": "05180735-935b-4af9-827f-12b16f63f5ab",
				"active": true,
				"createdAt": "2022-08-31T09:36:46.772Z",
				"currency": "EUR",
				"description": "The description of your product",
				"endDate": "2032-12-31T11:00:00.000Z",
				"executionEnvironment": "SANDBOX_ENVIRONMENT",
				"initDate": "2022-06-01T10:00:00.000Z",
				"invoiceExpirationTimeMin": 30,
				"multipleInvoicesAllowed": false,
				"notificationUrl": "http://localhost:3000/chargeWebhook",
				"onlyLN": false,
				"orderId": "af7c1fe6-d669-414e-b066-e9733f0de7a8",
				"price": 5.99,
				"userId": "6fce6fcc-21f1-4788-a504-8f07b3a26ac5"
			}
		}
	}
}
```
