Search code examples
phpebay-api

eBay API Platform Notifications - I'm not receiving all the ones I want


I'm using the eBay API and am trying to receive the following notifications:

  • ItemSold
  • FixedPriceTransaction
  • EndOfAuction

However, the only notification I receive is 'FixedPriceTransaction'.

The code I'm using to 'set' what notifications I receive, looks like this:

    $opts = array(
        'ApplicationDeliveryPreferences' => array(
            'ApplicationEnable'  => 'Enable',
            'ApplicationURL'     => 'http://my.domain/ebay_notifications.php',
        ),
        'UserDeliveryPreferenceArray' => array(
            'NotificationEnable' => array(
                'EventType'   => 'ItemSold',
                'EventEnable' => 'Enable'
            ),
            'NotificationEnable' => array(
                'EventType'   => 'EndOfAuction',
                'EventEnable' => 'Enable'
            ),
            'NotificationEnable' => array(
                'EventType'   => 'FixedPriceTransaction',
                'EventEnable' => 'Enable'
            )      
        )
    );

Any idea what I'm doing wrong?


Solution

  • Schoolboy error on my account.

    The 'UserDeliveryPreferanceArray' array contains multiple arrays.

    All of them have the same key title: 'NotificationEnable'

    This means only the last one is used - the one containing the 'FixedPriceNotification' event.

    To remedy this, make each 'notification event' part of an indexed array:

    'NotificationEnable' => array(
    
                    1   =>  array(
                        'EventType'   => 'ItemSold',
                        'EventEnable' => 'Enable' 
                    ),
    
                    2   =>  array(
                        'EventType'   => 'EndOfAuction',
                        'EventEnable' => 'Enable' 
                    ),
    
                    3   =>  array(
                        'EventType'   => 'FixedPriceTransaction',
                        'EventEnable' => 'Enable' 
                    )
                )
    

    Happy days.