Notifications

This page describes how our Notifications work and what they include.

Workflow actions often call external providers. Those calls can take time or fail, so Payrails sends a notification to your server when each action finishes.

Configure your server for receiving notifications before you continue.

Every notification uses the same envelope:

  • event: Type of event that happened.
  • time: Date and time of the event.
  • details: Event-specific details.
  • workspaceId: Workspace identifier.
  • eventTrigger: Reason the event was triggered. One of api, action, or external.

Event types

The following events trigger notifications during a workflow.

Event typeDescriptionExample
executionCreatedA new execution started for a workflow, such as a payment for an order.An execution for order 3573894940903 started.
executionActionRequestedA specific action, such as authorization, was requested for an execution.A request authorized a payment for €12.50 with a credit card.
ruleEngineExecutedThe rule engine evaluated rules for a transaction to determine provider or payment priorities.A rule evaluated the customer's country (DE) and operating system (ios) for provider selection.
executionActionCompletedA specific action in the workflow completed successfully.A card authorization processed successfully.
executionActionUpdatedA previously requested action changed status or result, such as an authorization moving from pending to success.An authorization moved to a successful state.
networkOffersEnrollmentCompletedA payment instrument enrolled successfully in a network offers program.A Visa card enrolled in a rewards program during a transaction.

Structure of the details object

The details object has a small set of top-level envelope fields. Most payment-specific fields — operationType, operationResult, authorizationCode, acquirerReference, providerReference, paymentInstrument, threeDS, and others — sit inside each entry of the paymentComposition array.

📘

The actionId in each notification matches the one returned in the response to the action you performed on the execution.

Top-level details fields

FieldTypeDescriptionExample
actionEnumType of action that was completed.One of: authorize, confirm, capture, cancel, refund.
actionIdUUIDIdentifier of the action, also returned when the action started."b0c28520-eca0-4be6-8771-99c43144bdaf"
actionMetaObjectMeta fields for this specific action. Different from execution.meta, which is set when the execution is created."actionMeta": { "customer": { "deliveryAddress": "Street A ****" } }
successBooleanWhether the full action succeeded.true
errorsArrayErrors for the action. Populated when success is false. See errors.[]
executionObjectSummary of the execution. See execution details.*
amountAmountTotal amount of the execution. With multiple payments, this is the sum. Each paymentComposition entry carries its own per-payment amount.{ "currency": "EUR", "value": "10" }
paymentCompositionArrayPayment attempts in the execution. Present on payment workflows. See paymentComposition details.*
payoutCompositionArrayPayout attempts in the execution. Present on payout workflows in place of paymentComposition. Same structure as paymentComposition, with the equivalent payout-side fields.*

execution details

FieldTypeDescriptionExample
idUUIDIdentifier of the execution. Use this ID with the Get an execution by ID API."b0c28520-eca0-4be6-8771-99c43144bdaf"
workflowCodeStringCode of the workflow that ran."payment-acceptance"
merchantReferenceStringMerchant-specific identifier for the execution."order-12345"
holderReferenceStringMerchant-specific identifier for the holder that owns the execution."user-12345"
holderIdUUIDIdentifier of the holder. Use this ID with the Get a holder by ID API."b0c28520-eca0-4be6-8771-99c43144bdaf"
metaObjectMeta fields supplied with the execution as context.{}

The execution.providerReference field is deprecated. Use paymentComposition[i].providerReference instead.

paymentComposition details

Each entry in paymentComposition represents one payment attempt within the execution.

FieldTypeDescriptionExample
successBooleanWhether the operation succeeded.true
errorsArrayErrors for the operation. Populated when success is false. See errors.[]
operationTypeEnumType of operation. Usually matches the action type. See operation types."Authorize"
operationResultEnumPayrails-mapped result for the operation. See result codes."Success"
operationResultProviderDetailsObjectRaw provider fields used to derive operationResult. Populated on failed operations. See provider-specific details.{}
integrationTypeEnumIntegration used to communicate with the provider."api"
paymentMethodCodeStringPayment method used."card"
captureModeEnumCapture mode for the payment. One of Instant, Delayed."Instant"
paymentInstrumentIdUUIDIdentifier of the stored instrument. Returned when storeInstrument is true. Full data in paymentInstrument."a4a7ed2d-bdcc-46a3-a9f2-701b5d7924b0"
paymentInstrumentObjectThe instrument used for the operation. See paymentInstrument structure.{}
paymentInstrumentTokenObjectThe token used for this operation. One entry from paymentInstrument.tokens[]. See tokens structure.{}
paymentInstrumentTokenIdUUIDIdentifier of the token used for this operation."a4a7ed2d-bdcc-46a3-a9f2-701b5d7924b0"
storeInstrumentBooleanWhether the operation requested storing the instrument for future use.true
paymentIdUUIDIdentifier of the payment attempt in Payrails. Use with the Get payment by ID API."b0c28520-eca0-4be6-8771-99c43144bdaf"
amountAmountAmount for this payment attempt. Differs from details.amount when an execution has multiple payments.{ "currency": "EUR", "value": "10" }
providerIdUUIDIdentifier of the provider used."b0c28520-eca0-4be6-8771-99c43144bdaf"
providerConfigIdUUIDIdentifier of the provider configuration used. Use with the Provider config by ID API."b0c28520-eca0-4be6-8771-99c43144bdaf"
providerObjectSummary of the provider used. For full provider details, use the Get provider by ID API.{}
providerConfigObjectProvider configuration for this operation. Contains an additionalData object with the custom key-value data set on the provider configuration.{ "additionalData": { ... } }
providerReferenceStringIdentifier of the top-level payment in the provider. For Stripe, the pi_* value; for Adyen, the pspReference."pi_3QtlWTG5MqUZQUfk0udJAwfX"
operationProviderReferenceStringIdentifier of this specific operation in the provider. Equals providerReference at authorize for most providers. Diverges on operations that get their own reference, such as a Stripe refund (re_*)."operation-12345"
providerResponseAdditionalFieldsObjectProvider-specific response data requested for your integration. Empty by default. To add fields, contact your Payrails representative.{}
authorizationCodeStringAcquirer authorization code, when the payment was authorized. See the acquirer field availability note."50"
acquirerReferenceStringAcquirer Reference Number (ARN) assigned to the payment. See the acquirer field availability note."1233524535345"
retrievalReferenceStringRetrieval Reference Number (RRN) assigned to the payment. See the acquirer field availability note."8657867867867"
acquirerMIDStringMerchant Identifier (MID) on the acquirer that processed the payment. See the acquirer field availability note."245243"
acquirerAccountCodeStringAccount code on the acquirer that processed the payment. See the acquirer field availability note."MI21"
acquirerCountryCodeStringCountry code on the acquirer that processed the payment. See the acquirer field availability note."NL"
accountFundingTransactionBooleanWhether the payment was an Account Funding Transaction, such as loading a prepaid card, topping up a wallet, or person-to-person funding. See the acquirer field availability note.false
threeDSObject3DS authentication parameters. Populated only when 3DS ran. Absent when threeDSMode is Skip. See 3D Secure.{}

Acquirer field availability

The acquirer fields acquirerReference, retrievalReference, acquirerMID, acquirerAccountCode, acquirerCountryCode, accountFundingTransaction, and authorizationCode are populated only when the provider returns them. Coverage varies by provider.

If a field your integration needs is missing and the provider does return it, contact your Payrails representative.

paymentInstrument structure

The paymentInstrument object describes the instrument used for the operation.

FieldTypeDescription
idUUIDIdentifier of the instrument in Payrails.
holderIdUUIDIdentifier of the holder that owns the instrument.
paymentMethodStringPayment method of the instrument, such as card or applePay.
statusEnumCurrent status of the instrument, such as created, enabled, or disabled.
displayNameStringHuman-readable name for the instrument, such as Visa **** 1111.
descriptionStringDescription of the instrument.
fingerprintUUIDSystem-wide unique identifier of the instrument. Two holders that store the same card share a fingerprint. Use for analytics or fraud signals, not for payments.
defaultBooleanWhether this instrument is the default for the holder.
futureUsageStringIntended future use, such as CardOnFile.
merchantReferenceStringMerchant-supplied reference for the instrument, when provided at creation.
networkTransactionReferenceStringNetwork Transaction Reference (NTR) used for MIT scenarios. Populated when the provider returns it.
createdAtStringWhen the instrument was created.
updatedAtStringWhen the instrument was last updated.
dataObjectMethod-specific data. Structure varies by paymentMethod. For cards, see the table below.
tokensArrayTokens associated with the instrument. See tokens structure.
metaObjectAdditional metadata for the instrument.

For cards, paymentInstrument.data contains:

FieldTypeDescription
binStringBank Identification Number (first digits of the card).
suffixStringLast four digits of the card.
networkStringCard network, such as visa or mastercard.
networkDisplayNameStringDisplay name of the network, such as Mastercard.
expiryMonthStringCard expiry month.
expiryYearStringCard expiry year.
holderNameStringCardholder name. Present only when supplied at instrument creation, either via the SDK or in createExecution.
emailStringCardholder email. Present only when supplied at instrument creation.
billingAddressObjectBilling address. Present only when supplied at instrument creation.
binLookupObjectIssuer information derived from the BIN.

The binLookup object contains:

FieldTypeDescription
binStringThe BIN that was looked up.
networkStringCard network identified by the BIN.
localNetworkStringLocal card network where applicable, such as cartesBancaires, mada, or bancontact.
issuerStringName of the issuing bank or institution.
issuerCountryObjectIssuing-country code and name.
typeStringCard type, such as CREDIT or DEBIT.
typeDetailsStringFurther detail on card type, such as personal or commercial.
segmentStringCard segment, such as gold or business.
isNetworkTokenBooleanWhether the card credential is a network token rather than a PAN.

tokens structure

Each entry in paymentInstrument.tokens[] describes a token associated with the instrument.

FieldTypeDescription
typeEnumToken type. Common values: psp (provider-side token, such as Stripe pm_*), vault (Payrails vault token), network (network token).
referenceStringToken identifier in the corresponding system.
metaObjectProvider-specific context stored with the token. For provider tokens, typically includes holderReference (the provider-side customer reference, such as Stripe cus_*).

Provider-specific details

To process a requested action, Payrails calls the external provider in its expected format and maps the response to a unified result.

Payrails extracts and maps the most important fields to unified fields and result codes. Two fields preserve the provider context:

  • operationProviderReference — identifier of the operation in the provider's system.
  • operationResultProviderDetails — provider fields used to derive operationResult. Populated on failures.

The following extract shows how Payrails reached the InsufficientBalance result based on three fields from Hyperpay's response. The message field contains the provider's human-readable description of the decline reason.

{
  "operationResult": "InsufficientBalance",
  "operationResultProviderDetails": {
    "message": "transaction declined (amount exceeds credit)",
    "additionalData": {
      "result.code": "800.100.155",
      "resultDetails.ExtendedDescription": "No sufficient funds",
      "resultDetails.response.acquirerMessage": ""
    }
  }
}

The keys in additionalData are JSON Paths to fields in the provider response. Hyperpay's response looked like this:

{
  "result": {
    "code": "800.100.155",
    "description": "transaction declined (amount exceeds credit)"
  },
  "resultDetails": {
    "ExtendedDescription": "No sufficient funds",
    "clearingInstituteName": "MADA via Postilion",
    "ConnectorTxID1": "90002550",
    "ConnectorTxID3": "|51|1008|929292||81374134||",
    "ConnectorTxID2": "299630|1231231232|123123123",
    "AcquirerResponse": "51"
  }
}

To include more provider-specific fields in your notifications, contact your Payrails representative to add them to providerResponseAdditionalFields inside each paymentComposition entry.

For the full raw request and response sent to a provider, use the Get Payment Operation Logs endpoint.

errors details

Notifications describe errors at two levels:

  • The top-level errors array describes the overall action result.
  • The errors array inside each paymentComposition entry describes the errors for that specific payment attempt. This separation matters most for workflows that generate multiple payments per execution.

For the structure of each error item, see error structure.

Examples

Success

{
   "action":"authorize",
   "actionId":"9a72c5a3-8894-435f-aea6-8b305a4dc29f",
   "actionMeta":{
      "customer":{
         "deliveryAddress":"Street A ******"
      }
   },
   "amount":{
      "currency":"EUR",
      "value":"24.00"
   },
   "execution":{
      "holderReference":"customer123",
      "holderId":"9d113e2a-35a0-40e1-828b-35a18ac35b41",
      "id":"f8c36786-008d-4352-a0cf-b799955dbfc2",
      "merchantReference":"order_3573894940903",
      "meta":{
         "order":{
            "reference":"order_3573894940903"
         },
         "customer":{
            "reference":"1231905323475",
            "country":{
               "code":"DE"
            }
         },
         "clientContext":{
            "ipAddress":"217.110.239.132",
            "osType":"ios"
         }
      },
      "workflowCode":"payment-acceptance"
   },
   "paymentComposition":[
      {
         "operationType":"Authorize",
         "amount":{
            "currency":"EUR",
            "value":"24.00"
         },
         "integrationType":"api",
         "operationResult":"Success",
         "operationProviderReference":"pi_3QtlWTG5MqUZQUfk0udJAwfX",
         "providerId":"5eb08624-ecce-4cbc-9a8a-61d484172815",
         "providerConfigId":"1e308624-e5ce-4cvc-9a8a-61d482172817",
         "providerReference":"pi_3QtlWTG5MqUZQUfk0udJAwfX",
         "paymentId":"c9e1a8ea-a0de-42bd-bcfd-46d3f437b5fe",
         "paymentInstrumentId":"b8fe6271-5d71-4d28-b8e8-89e64acc0c49",
         "storeInstrument":true,
         "captureMode":"Instant",
         "paymentMethodCode":"card",
         "accountFundingTransaction":false,
         "acquirerMID":"245243",
         "acquirerReference":"1233524535345",
         "retrievalReference":"8657867867867",
         "authorizationCode":"50",
         "acquirerAccountCode":"MI21",
         "acquirerCountryCode":"NL",
         "success":true,
         "provider":{
            "id":"5eb08624-ecce-4cbc-9a8a-61d484172815",
            "name":"checkout",
            "displayName":"Checkout.com",
            "type":"Payment",
            "status":"active",
            "createdAt":"2021-01-05T10:20:00.000Z",
            "updatedAt":"2022-06-14T11:50:00.000Z"
         },
         "threeDS":{
            "authenticationValue":"AAABAVIREQAAAAAAAAAAAAAAAAA=",
            "challenged":true,
            "dsTransId":"5ed5d1d0-982f-45f4-97a1-68651ac429d0",
            "eci":"05",
            "enrolled":"Y",
            "exemptionApplied":"none",
            "exemptionIndicator":"none",
            "transStatus":"Y",
            "version":"2.2.0"
         },
         "paymentInstrument":{
            "id":"b8fe6271-5d71-4d28-b8e8-89e64acc0c49",
            "holderId":"788c7c09-a490-4603-915a-e2a957a6cca1",
            "createdAt":"2022-04-22T17:53:36.814Z",
            "updatedAt":"2022-04-22T17:53:36.814Z",
            "paymentMethod":"card",
            "displayName":"Visa **** 1111",
            "description":"Personal card.",
            "fingerprint":"739abff0-406a-4d32-8cfb-701e12be5848",
            "status":"created",
            "futureUsage":"CardOnFile",
            "networkTransactionReference":"987654321234567",
            "data":{
               "network":"visa",
               "networkDisplayName":"Visa",
               "bin":"411111",
               "suffix":"1111",
               "expiryMonth":"10",
               "expiryYear":"2026",
               "holderName":"John Doe",
               "binLookup":{
                  "bin":"411111",
                  "network":"visa",
                  "issuer":"EXAMPLE BANK N.A.",
                  "type":"CREDIT",
                  "typeDetails":"personal",
                  "issuerCountry":{"code":"US","iso3":"USA","name":"UNITED STATES OF AMERICA"}
               }
            },
            "meta":{
               "communityCode":"GAP",
               "userKey":"9890124569"
            },
            "tokens":[
               {
                  "type":"psp",
                  "reference":"provider-token",
                  "meta":{
                     "holderReference":"provider-customer-reference"
                  }
               }
            ]
         }
      }
   ],
   "success":true
}

Failure

{
  "action": "authorize",
  "actionId": "d31d96a5-979b-4f0b-bc31-a20e820e1816",
  "amount": {
    "currency": "EUR",
    "value": "24.00"
  },
  "errors": [
    {
      "id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
      "code": "workflow.action.failed",
      "detail": "The execution of the requested workflow action failed",
      "docUrl": "https://docs.payrails.com/docs/error-codes#workflow.action.failed",
      "reason": {
        "category": "Instrument",
        "result": "BlockedInstrument",
        "source": "Customer",
        "detail": "LostInstrument"
      }
    }
  ],
  "execution": {
    "holderReference": "customer123",
    "holderId": "9d113e2a-35a0-40e1-828b-35a18ac35b41",
    "id": "f8c36786-008d-4352-a0cf-b799955dbfc2",
    "merchantReference": "order_3573894940903",
    "meta": {
      "order": { "reference": "order_3573894940903" },
      "customer": { "reference": "1231905323475", "country": { "code": "DE" } },
      "clientContext": { "ipAddress": "217.110.239.132", "osType": "ios" }
    },
    "workflowCode": "payment-acceptance"
  },
  "paymentComposition": [
    {
      "errors": [
        {
          "id": "a24bc325-3929-4d9d-9c08-b3aa532685b7",
          "code": "workflow.action.failed",
          "detail": "The execution of the requested workflow action failed",
          "docUrl": "https://docs.payrails.com/docs/error-codes#workflow.action.failed",
          "reason": {
            "category": "Instrument",
            "result": "BlockedInstrument",
            "source": "Customer",
            "detail": "LostInstrument"
          }
        }
      ],
      "operationResult": "BlockedInstrument",
      "operationResultDetail": "LostInstrument",
      "operationResultProviderDetails": {
        "additionalData": {
          "result.code": "800.100.999",
          "resultDetails.extendedDescription": "Lost instrument"
        },
        "message": "the instrument is marked as lost"
      },
      "operationType": "Authorize",
      "success": false,
      "amount": { "currency": "EUR", "value": "24.00" },
      "integrationType": "api",
      "operationProviderReference": "provider-reference-example",
      "providerId": "5eb08624-ecce-4cbc-9a8a-61d484172815",
      "providerConfigId": "1e308624-e5ce-4cvc-9a8a-61d482172817",
      "paymentId": "c9e1a8ea-a0de-42bd-bcfd-46d3f437b5fe",
      "paymentInstrumentId": "a4a7ed2d-bdcc-46a3-a9f2-701b5d7924b0",
      "storeInstrument": true,
      "paymentMethodCode": "card",
      "paymentInstrument": {
        "tokens": [
          {
            "type": "psp",
            "reference": "provider-token",
            "meta": { "holderReference": "provider-customer-reference" }
          }
        ]
      }
    }
  ],
  "success": false
}

Did this page help you?