Notifications for the refund are handled differently from the DirectCredit/DirectDebit, especially as there's no orderId for the refund, all notifications will refer to the original direct debit order, but you can distinguish the notifications by checking if the refund flag is available or not.
Immediately after the refund has been accepted for processing, a pending notification is sent to the NotificationURL for the original DirectDebit order.
{
"method": "pending",
"params": {
"uuid": "258a2184-2842-b485-23ca-293425152415",
"data": {
"orderid": "87654567",
"messageid": "98348932",
"notificationid": "4876513450",
"amount": "98.02",
"currency": "GBP",
"timestamp": "2010-01-20 14:42:04.675645+01",
"refund": "1"
},
"signature": "fVhjuMqbsH0Ku ... S16VbzRsw=="
},
"version": "1.1"
}
If the refund fails for some reason, a cancel notification will be sent. Note that this will only be sent if no money have been deducted on the account and treat this notification differently than a debit followed by a credit. Please make sure to check the refund flag on the notification.
{
"method": "cancel",
"params": {
"uuid": "258a2184-9021-b874-21ca-293425152415",
"data": {
"orderid": "87654567",
"messageid": "98348932",
"notificationid": "4876513450",
"refund":"1",
"attributes": {
"reason": "",
"details": "",
}
},
"signature": "F6+hjuMqbsH0Ku ... S16VbzRsw==",
},
"version": "1.1"
}
The debit notification for the refund is sent when a confirmation that the funds have left your account.
{
"method": "debit",
"params": {
"uuid": "258a2184-2842-b485-25ca-293525152425",
"data": {
"orderid": "87654567",
"messageid": "asdfasdasdf",
"notificationid": "9876543456",
"amount": "90.02",
"currency": "GBP",
"timestamp": "2010-01-20 14:42:04.675645+01",
"refund": "1",
"attributes": {
"reference": "TRLY80494-1001",
"statement": "TRLY80494-1001"
}
},
"signature": "D67hjuMqbsH0Ku ... S16VbzRsw==",
},
"version": "1.1"
}
If funds left the account, but later bank returned the funds, a credit notification is sent.
{
"method": "credit",
"params": {
"signature": "D67hjuMqbsH0Ku ... S16VbzRsw==",
"uuid": "258a2184-2842-b485-25ca-293525152425",
"data": {
"orderid": "87654567",
"messageid": "98348932",
"notificationid": "9876543456",
"amount": "90.02",
"currency": "GBP",
"timestamp": "2010-01-20 14:42:04.675645+01",
"refund": "1",
"attributes": {
"reference": "TRLY80494-1001",
"statement": "TRLY80494-1001"
}
}
},
"version": "1.1"
}