Notifications

Last changes: 04-03-2024

Webhook Notification

Introduction

This section covers how webhooks are used to notify about events that happen in SmartPay.
Some events, like transaction status change, are not the result of a direct API request. Webhooks solve these problem by letting you provide a URL to which we will send a notification anytime such an event happens.

The "Notification Target URL" will receive a JSON payload depending on the notification type. Based on your integration requirements the notification service has to be turned on.
Please contact Customer Support to check your setup configuration.

Authentication Options

Any of the below authentication methods can be selected for the corresponding Merchant key:

Authentication TypeBehavior

No Authentication

No authentication information is sent in the requests to the "Notification Target URL".

Basic Authentication

The authentication is done by specifying a Username and Password under the
"Notification Service Settings". These fields are used for basic authentication
for every call made to the "Notifications Target URL".

Notification Format

 

The "Notification Target URL" will receive a JSON payload respecting the below form

FieldTypeFormatDescription
idStringstring

Contains the payment transaction identifier

Example: "c200b3fd-4960-4cd8-918c-5919013ce769"

createdAtStringyyyy-MM-dd'T'HH:mm:ss.SS'ZTime of the creation of the event:
Example: 2021-05-26T14:29:05.994Z
originString

Possible values:

"api", "widget", "automated"

Origin triggering the event: an API call, an action performed on the Widget or an event triggered by SmartPay backend
eventType

String

Enum:

"updated"

Description of the event type

objectIdStringUUID

In case of a payment status change, it contains SmartPay transactionId
In case of a refund status change, it contains SmartPay refundId
Example: "4f6e528d-1438-43ee-9835-a17c05c34429"

 

objectTypeString

 Enum:

"payment"

"refund"

"prepayment"

Type of the event, mainly differentiating between "refund" and other transaction status changes under "payment". "prepayment" type provides prepayment specific status changes.
 
metadataDictionarykey, value pairs

Optional object (exists for specific use cases only e.g. pre-payment)
Additional Ids and details linked to the notification:
"metadata": {

      "reconciliationId": 102957125651

}

List of the available notifications

objectType

origin

Description

payment"automated"Created every time when SmartPay payment transaction status gets changed. Usefull for tracking the statuses of asynchronoiusly processed payments or payment modifications initiated not through the SmartPay API, e.g from Merchant Panel. For security reasons only transaction id is provided into the notification body. To get the actual payment status Get Payment Status api should be used. As a 'transactionId' value required by Get Payment Status api use 'id' value received in notification.

Example:
Payment notification:
{
  "id": "c200b3fd-4960-4cd8-918c-5919013ce769", 
  "createdAt": "2021-10-01T08:42:28.637Z",
  "origin": "automated",
  "eventType": "status.updated",
  "objectId": "c200b3fd-4960-4cd8-918c-5919013ce769", 
  "objectType": "payment"
}
refund"automated"

Created every time when SmartPay refund status gets changed. Usefull for tracking the statuses of asynchronoiusly processed refunds or refunds initiated not through the SmartPay API, e.g from Merchant Panel. For security reasons actual refund status is not provided in the norification data, only refund and transaction identifiers are provided in 'objectId' 'id' fields respectively.

To get the actual refund status use Get Payment Status API to retrieve transaction status and all modifications made to it by passing 'id' value provided as 'transactionId'. To determine the refund which has triggered the notification get first modification element with 'modificationData'/'type' equal to 'REFUND' and  'modificationData'/'refundId' equal to 'objectId' value received in notification. Read 'status' value from the found modification element for actual refund status.

Example

Refund notification:

{
  "id": "c200b3fd-4960-4cd8-918c-5919013ce769",
  "createdAt": "2021-10-01T08:42:28.637Z",
  "origin": "automated",
  "eventType": "status.updated",
  "objectId": "4f6e528d-1438-43ee-9835-a17c05c34429",
  "objectType": "refund"
}

Get Payment Status Api:

[GET] <base_url>/payment/status/c200b3fd-4960-4cd8-918c-5919013ce769

{
    "reconciliationReferenceId": "CQm1sOcWIOO2tChSCbfQL",
    "description": "JPMMPS*SMARTPAY*Zvx2v0l3Uk",
    "paymentStatus": "CAPTURED",
    "creationDate": "2021-10-01T08:36:30.794Z",
    "lastStatusDate": "2021-10-01T08:42:28.517Z",
    "transactionOverview": {
        "amount": 10.08,
        "currencyCode": "EUR",
        "transactionId": "c200b3fd-4960-4cd8-918c-5919013ce769",
        "paymentMethod": "CARDS"
    },
    "modifications": [
        {
            "modificationData": {
                "type": "CAPTURE",
                "modificationId": "CPT-USnqEheOjT",
                "reconciliationReferenceId": "CQm1sOcWIOO2tChSCbfQL"
            }
            "status": "CAPTURED",
            ...
        },
        {
            "modificationData": {
                "type": "REFUND",
                "modificationId": "da4c3ddc-5279-45a1-b60f-8d0802591fff",
                "refundId": "4f6e528d-1438-43ee-9835-a17c05c34429",
                "reconciliationReferenceId": "FLg5GWlukm0rUq5SwJfs3"
            },

            "status": "REFUNDED",
            ...
        }
    ],
    "statusHistory": [
        ...
    ],
    "carrierNumber": "someapmail@email.com"
}

prepayment"automated"

Triggered when certain actions hapened to prepayment transaction. Additional information is provided in "metadata" section of the notification body. To distinguish between prepayment notification types, read "notificationType" value in the "metadata" object. There are five types of notifications can be triggered for prepayment transactions:

  • Payment Recognized
  • Payment Reminder
  • Underpaid Transaction Expiration
  • Unpaid Transaction Expiration
  • Overpayment

Payment Recognized

This type of notifications is sent when a prepayment transaction was payed by the consumer and settled amount is matched to the transaction amount.

{   
    "id" : "bc66ec9f-6b24-4b45-ac18-da294c962ac7",
    "createdAt" : "2022-10-21T14:56:49.442Z",
    "origin" : "automated",
    "eventType" : "payment.info",
    "objectId" : "bc66ec9f-6b24-4b45-ac18-da294c962ac7",
    "objectType" : "prepayment",
    "metadata" : {     
        "underpaidAmount" : "10.08 EUR",
        "notificationType" : "TransactionPaymentRecognized"   
    } 
}

Payment Reminder

This type of notifications is sent to remind of the prepayment transaction is expiring soon. Expiration date is provided in the metadata section of the notification body.  

{
    "id": "4390653d-de91-4aa0-b14b-966490b0e843",
    "createdAt": "2022-10-20T15:11:26.717Z",
    "origin": "automated",
    "eventType": "payment.info",
    "objectId": "4390653d-de91-4aa0-b14b-966490b0e843",
    "objectType": "prepayment",
    "metadata": {
        "underpaidAmount": "230.26 EUR",
        "notificationType": "TransactionPaymentReminder",
        "expirationDate": "2022-10-23"
    }
}

Underpaid Transaction Expiration

This type of notifications is sent when the invoice related to a transaction expires while not fully paid. Payed amount has been refunded to the consumer's acount. The 'refund' object type notification is provided as well, where the refunded amount can be identified (see 'refund' type explanation above).

{
    "id": "01919ef0-c361-456b-a60a-d4543a5504cf",
    "createdAt": "2022-10-20T14:57:47.723Z",
    "origin": "automated",
    "eventType": "status.updated",
    "objectId": "01919ef0-c361-456b-a60a-d4543a5504cf",
    "objectType": "prepayment",
    "metadata": {
        "notificationType": "UnderpaidTransactionExpiration"
    }
}

Unpaid Transaction Expiration

This type of notifications is sent when the invoice related to a prepayment transaction expires while not paid.

{
    "id": "4d9e7253-6428-424e-90c8-2632f4b65e49",
    "createdAt": "2022-10-20T14:29:46.959Z",
    "origin": "automated",
    "eventType": "status.updated",
    "objectId": "4d9e7253-6428-424e-90c8-2632f4b65e49",
    "objectType": "prepayment",
    "metadata": {
        "notificationType": "UnpaidTransactionExpiration"
    }
}

Overpayment

Triggered when underlying payment was captured by the bank, but settled amount was greater than originally requested. Overpayed amount has been refunded to the consumer's acount. Once overpayed refund is completed, the 'refund' object type notification is provided as well, where the refunded amount can be identified (see 'refund' type explanation above).

{
    "id": "74300431-5d2e-480b-ada6-dab5750357a0",
    "createdAt": "2022-10-20T14:01:41.760Z",
    "origin": "automated",
    "eventType": "payment.info",
    "objectId": "74300431-5d2e-480b-ada6-dab5750357a0",
    "objectType": "prepayment",
    "metadata": {
        "notificationType": "TransactionOverpayment"
    }
}

 

 

For the full list of SmartPay transaction statuses, please refer to this section.