PrimeiroPay
Search…
Webhook Integration Guide

Notification content and structure

The notification body contains the type of notification and its payload.
1
{
2
"type": [notification_type],
3
"action": [status],
4
"payload": [content]
5
}
Copied!
Parameter
Description
Format
Required
type
Type of the notification
    PAYMENT This type of notification is sent when a payment is created or updated in the system.
    REGISTRATION This type of notification is sent when a registration is created or deleted.
    RISK This type of notification is sent when a risk transaction is created or deleted.
(PAYMENT|REGISTRATION|RISK)
required
action
Indicator of status change. This field is available only if the type is REGISTRATION.
    CREATED when registration has been created.
    UPDATED when registration has been updated.
    DELETED when registration has been deleted.
(CREATED|UPDATED|DELETED)
conditional
payload
Content of the notification. If the notification type is payment or registration, the payload's content will be identical to the response you received on the payment or registration.
JSON
required

Example - payment

1
{
2
"type":"PAYMENT",
3
"payload":{
4
"id":"8a829449515d198b01517d5601df5584",
5
"paymentType":"PA",
6
"paymentBrand":"VISA",
7
"amount":"92.00",
8
"currency":"EUR",
9
"presentationAmount":"92.00",
10
"presentationCurrency":"EUR",
11
"descriptor":"3017.7139.1650 OPP_Channel ",
12
"result":{
13
"code":"000.100.110",
14
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'"
15
},
16
"authentication":{
17
"entityId":"8a8294185282b95b01528382b4940245"
18
},
19
"card":{
20
"bin":"420000",
21
"last4Digits":"0000",
22
"holder":"Jane Jones",
23
"expiryMonth":"05",
24
"expiryYear":"2018"
25
},
26
"customer":{
27
"givenName":"Jones",
28
"surname":"Jane",
29
"merchantCustomerId":"jjones",
30
"sex":"F",
31
32
},
33
"customParameters":{
34
"SHOPPER_promoCode":"AT052"
35
},
36
"risk":{
37
"score":"0"
38
},
39
"buildNumber":"[email protected] 12:20:39 +0000",
40
"timestamp":"2015-12-07 16:46:07+0000",
41
"ndc":"8a8294174b7ecb28014b9699220015ca_66b12f658442479c8ca66166c4999e78"
42
}
43
}
Copied!

Example - registration

1
{
2
"type":"REGISTRATION",
3
"action": "CREATED",
4
"payload":{
5
"id":"8a82944a53e6a0150153eaf693584262",
6
"paymentBrand":"VISA",
7
"result":{
8
"code":"000.100.110",
9
"description":"Request successfully processed in 'Merchant in Integrator Test Mode'",
10
"randomField1315125026":"Please allow for new unexpected fields to be added"
11
},
12
"card":{
13
"bin":"420000",
14
"last4Digits":"0000",
15
"holder":"Jane Jones"
16
},
17
"authentication":{
18
"entityId":"8a8294174b7ecb28014b9699220015ca"
19
},
20
"redirect":{
21
"parameters":[
22
23
]
24
},
25
"risk":{
26
"score":""
27
},
28
"timestamp":"2016-04-06 09:45:41+0000",
29
"ndc":"8a8294174b7ecb28014b9699220015ca_b1539494024c411684b544574716e608"
30
}
31
}
Copied!

Example - risk

1
{
2
"type": "RISK",
3
"payload": {
4
"id": "8ac9a4a86461239601646522acb26523",
5
"referencedId": "8ac9a4a86461239601646522aaf96510",
6
"paymentType": "RI",
7
"paymentBrand": "VISA",
8
"presentationAmount": "0.0",
9
"result": {
10
"code": "000.000.000",
11
"description": "Transaction succeeded"
12
},
13
"card": {
14
"bin": "420000",
15
"last4Digits": "0000",
16
"holder": "Jane Jones",
17
"expiryMonth": "03",
18
"expiryYear": "2025"
19
},
20
"authentication": {
21
"entityId": "8a8294174b7ecb28014b9699220015ca"
22
},
23
"redirect": {
24
"parameters": []
25
},
26
"risk": {
27
"score": ""
28
},
29
"timestamp": "2018-07-04 11:52:08+0000",
30
"ndc": "8a8294174b7ecb28014b9699220015ca_b1539494024c411684b544574716e608"
31
}
32
}
Copied!
The content of notification is encrypted to protect data from fraud attempts. When converting human-readable string to hexadecimal format, we use UTF-8.
Parameter
Description
Encryption algorithm
AES
Key
[secret of listener] (64-character-long hexadecimal string in configuration)
Key length
256 bits (32 bytes)
Block mode
GCM
Padding
None
Initialization vector
In HTTP header (X-Initialization-Vector)
Authentication tag
In HTTP header (X-Authentication-Tag)
Format of body: Hexadecimal Format of Initialization Vector: Hexadecimal
Example
1
Payload
2
{"type": "PAYMENT"}
3
4
Payload in Hexadecimal (after getting bytes in UTF-8)
5
7B2274797065223A20225041594D454E54227D
6
7
Key in Hexadecimal
8
000102030405060708090A0B0C0D0E0F000102030405060708090A0B0C0D0E0F
9
10
Initialization-Vector (Hexadecimal)
11
3D575574536D450F71AC76D8
12
13
Authentication-Tag (Hexadecimal)
14
19FDD068C6F383C173D3A906F7BD1D83
15
16
Encrypted value in Hexadecimal
17
F8E2F759E528CB69375E51DB2AF9B53734E393
Copied!

Responding to Notifications

When your service receives a webhook notification, it must return a 2xx HTTP status code. Otherwise, the webhook service considers the notification delivery as failed, and will retry to send the notification later.

Protocol Details

Protocol
HTTPS (HTTP is allowed on test systems only)
HTTP method
POST
Content type
text(text/plain)
Last modified 1yr ago