The handlePaymentStateChangedNotification method of the Payment Service Listener API is called by PaymentService whenever a change in a payment state occurs (for configured payment states only). This is usually the case when:

Example handlePaymentStateChangedNotificationRequest for notifying a Visa Deposit in AuthorisedByProvider state:

<?xml version="1.0" encoding="utf-8"?>
	<payment xsi:type="paymentWithPaymentAccount">
			<value>VISA Deposit</value>
		<amount currencyCode="EUR">15.0000</amount>
				<detail xsi:type="keyStringValuePair">
				<detail xsi:type="keyStringValuePair">
		<baseAmount currencyCode="EUR">15.0000</baseAmount>
			<detail xsi:type="keyStringValuePair">
			<detail xsi:type="keyIntValuePair">

Example handlePaymentStateChangedNotificationResponse to the notification of a Visa Deposit in AuthorisedByProvider state:

<?xml version="1.0" encoding="utf-8"?>
<handlePaymentStateChangedNotificationResponse                                               xmlns=""                                     xmlns:xsi=""                                   xmlns:xsd="">
  <resultMessage />


Handling of Notifications triggered after payment initiation

Only after processing the handlePaymentStateChangedNotificationRequest should the merchant proceed with further actions e.g. deliver a product or crediting money to a customer balance.


Notification retries

The notification may be sent several times (e.g. 3 times), depending on the handlePaymentStateChangedNotificationResponse returned by the merchant.

The Merchant System must be able to find out whether it already processed the Payment State Notification; e.g.:

  • If the merchantTransactionID is not recognized, and the payment method is Bank Transfer Deposit, then the merchant should accept the Payment State Notification (respond with resultCode = 0) and process the payment transaction
  • If the merchantTransactionID is not recognized, then the merchant should reject the Payment State Notification (respond with resultCode = 3):
    • If the Payment State Notification was already received with the same merchantTransactionID, the same paymentID and the same, then this means that a duplicate notification has been received; the merchant should accept the Payment State Notification (respond with resultCode = 0) to stop further notifications but not perform any processing
    • If the Payment State Notification was already received with a different paymentID, it means that more than one payment was processed for that merchantTransactionID; the merchant should accept the Payment State Notification (respond with resultCode = 0) and process the payment accordingly.

For further details see handlePaymentStateChangedNotification.


Waiting for the Notification (Redirect Integration) to arrive

Because of its asynchronous nature, the Payment State Notification (handlePaymentStateChangedNotificationRequest) can be sent in case of payment initiation with Redirect Integration also after the customer has been redirected to the merchant website; the Merchant System should refresh the page several times until the Payment State Notification has been received and the payment status can be confirmed.

The following diagram illustrates the necessary processing steps for PaymentStateChangedNotification:


Refer to Payment Methods for a list of payment methods and their corresponding states indicating credit/debit or reversal.

The following properties of the handlePaymentStateChangedNotificationRequest.payment element must be considered:

merchantTransactionIDGenerated by the merchant and passed to PaymentService
paymentIDGenerated by PaymentService and returned to the merchant
amount (including the currencyCode)The amount processed by PaymentService
state.definitionThe state reached by the payment
creationTypeDescribes how the payment was created (see Creation Types).

The relationship between merchant transactions and payments is one-to-many, which means that there can be several paymentIDs associated with the same merchantTransactionID in PaymentService, e.g.


Cases when this can happen:

  • A customer enters wrong credit card data in the Payment Method Detail Page hosted by PXP Financial. After receiving an error he corrects the data and retriggers the payment, without going back to the merchant website in between (which means that the same merchantTransactionID is used). In this case there will be 2 payments in PaymentService – one in state Refused, and one in state AuthorisedByProvider
  • All recurring payments will have the same merchantTransactionID and different paymentIDs
  • Refunds have the same merchantTransactionID as the original payment (that one the refund was created for) and different paymentIDs. This has to be especially considered for partial refunds where it is possible to have more transactions with the same merchantTransactionID
  • A user manipulates the HTTP POST parameters and duplicates the transaction (with a certain merchantTransactionID).


Amount and currency check

In case the merchant has already defined the amount before redirecting the user to the PXP Financial Hosted Payment Pages, the pre-logged amount + currency (stored in merchant's database before making the request to PXP Financial) must be compared with the amount + currency coming in handlePaymentStateChangedNotificationRequest.


Idempotent handling of duplicate notifications

Duplicate payment notifications (same merchantTransactionID, same paymentID, same payment.state.definition) should be handled in an idempotent way, which means that the same response should be returned as for the original notification.


Notifications in invalid order

In case notifications for payment states arrive in invalid order, these should be reported back as an error (e.g. Cancelled before AuthorisedByProvider for card deposits).


Result codes

ResultCode = 0 indicates that the notification was successfully processed by the merchant. All other codes indicate that the merchant cannot process a message. Choose the appropriate resultCode in case of an error.