Search code examples
phpiospaypalpaypal-adaptive-payments

Paypal Adaptive payment Pay key validation received from IOS


In our app we are using IOS MPL library to make the parallel payment. After I get the pay key from the IOS, when I tried to validate it using PHP app, it shows me the following error:

 [error] => Array
        (
            [0] => ErrorData Object
                (
                    [errorId] => 540031
                    [domain] => PLATFORM
                    [subdomain] => Application
                    [severity] => Error
                    [category] => Application
                    [message] => You do not have permission to get these payment details
                    [exceptionId] => 
                    [parameter] => 
                )

        )

But If I create a parallel payment using PHP Adaptive payment API, I am able to validate the paykey and get the correct receipt.


Also what I found is when I try to create the parallel payment in PHP it asks me for App ID, API Username, API Password and API signature. But when we use IOS MPL libarary it just asks for App ID. In sandbox mode we always use same APP ID - APP-80W284485P519543T, which is same for all(universal). Then how the app will know identify who has made the call?

When I create a payment in sandbox mode using PHP application, and try to validate the transaction using a different "API credentials", then I get the same error "You do not have permission to get these payment details", which I receive when we try to do with IOS Pay key.


Solution

  • Here is the reply I get from the Paypal: This is AP txn made through MPL sdk library from an iPhone app of the sender. The api caller is the sender.

    The receivers in the parallel payment are different.

    When one of receiver a/c made paymentdetails api call, he is the api caller for this call. So there are few restrictions on what info a api caller can view in paymentdetails api. The receiver a/c holder will be able to view only his leg of transaction since he is NOT the original api caller that created the payment key.

    That's why after paymentdetails API, you can only see the leg of your transaction information.


    Also I asked Paypal, if there is a way in MPL library to define the API credentials of the merchant which can be used while doing Adaptive payment instead of the sender's API. They said no, MPL library is not built like that.


    So finally, I have used IPN call to resolve the problem. Instead of updating the DB by validating the Pay key I get from the IOS device, what I did is: i have told the IOS developers to send the IPN url in Adaptive payment call. Then through the IPN url I update my database.