Search code examples
paypalpaypal-adaptive-payments

Chained payment cannot be completed


I'd like to think I'm just missing something obvious here, but I can't seem to get a chained payment to complete (using the PHP SDK in the sandbox). I am able to get a successful response, and when I redirect the user to PayPal the transaction details show up fine, but when the user attempts to complete the payment they get the dreaded error:

Your payment can't be completed. Please return to the participating website and try again.

What's frustrating is that I've dumped the request data that is being sent, and compared it to the data in the example given in the documentation and tweaked my request until they were effectively identical, and still no dice. I'm also not seeing anything at all on any of the accounts to indicate that payment was attempted, pending or failed.

This is what's being sent:

requestEnvelope.errorLanguage=en_US
&clientDetails.ipAddress=127.0.0.1
&clientDetails.applicationId=APP-80W284485P519543T
&actionType=PAY
&cancelUrl=http%3A%2F%2Fdomain.com%2Fpaypal%2Fcancel
&currencyCode=USD
&feesPayer=EACHRECEIVER
&memo=Test+Payment
&receiverList.receiver(0).amount=3.25
&receiverList.receiver(0).email=merchant%40domain.com
&receiverList.receiver(0).primary=1
&receiverList.receiver(1).amount=1.5
&receiverList.receiver(1).email=seller%40domain.com
&senderEmail=buyer%40domain.com
&returnUrl=http%3A%2F%2Fdomain.com%2Fpaypal%2Freturn

And the response looks fine to me:

PayPal\Types\AP\PayResponse Object
(
    [responseEnvelope] => PayPal\Types\Common\ResponseEnvelope Object
        (
            [timestamp] => 2013-07-28T23:25:52.676-07:00
            [ack] => Success
            [correlationId] => bf1ba2c8a50d4
            [build] => 6941298
        )

    [payKey] => AP-XXXXXXXXXXXXXXXXC
    [paymentExecStatus] => CREATED
    [payErrorList] => 
    [paymentInfoList] => 
    [sender] => 
    [defaultFundingPlan] => 
    [warningDataList] => 
    [error] => 
)

I also tried setting the action type to PAY_PRIMARY since I am specifying a primary recipient, and that's ideally what I'm after anyways.

UPDATE: Seeing as I still have not received a response on the ticket I opened with PayPal regarding this, and nobody has commented on this question, I did some further testing. If I generate the same request with the API explorer, the transaction completes normally. But the exact same request fails through the API. I have verified (by copying and pasting the generated headers and request body) that the only differences between the request generated by the API Explorer and the SDK code are as follows:

  • The headers created by the explorer have a space between the name and values
  • The API Explorer does not include the application ID
  • My API call does include the application ID in both the header and request body

The SDK API call still does not work if I remove the application ID reference, which was added in an attempt to solve this issue to begin with.

I do not understand why the payment generated by the SDK (which is provided by PayPal) fails to complete, yet the exact call works fine when the explorer calls it. Any help or advice would be appreciated.


Solution

  • So after nearly a month of fighting this issue with PayPal's merchant technical support (most of the time not getting any responses at all) and waiting nearly two weeks for a response on an escalation, it turns out the issue stems from the SDK configuration.

    Although throughout the API docs and SDK code the Application ID is referenced as applicationId, apparently the SDK requires it to be entered in the config file as acct1.AppId instead. I only discovered this after coming across this wiki page on configuring the SDK, which didn't even exist 24 hours ago.

    Once I updated my config, I was able to authorize the payment without error.