I'm just replying in order to help someone struggling with this issue while still using PHP SDK or API v1. One of the reasons why related_resources -> sale -> state may still be pending is because the order should be approved manually by the buyer in the buyer sandbox dashboard. So you have to change that setting and make Review Payment > Off. Actually you can find this setting when you login with developer account, list you app/sandboxes and select the one you want to change the settings. There should be a setting called 'Review Payment' and turn that off. In my case the setting was already off, I just have to turn it on and turn it off again and voila after executing the payment the related_resources -> sale -> state became 'completed'.
... View more