Search code examples
phpcodeigniterpaypal-adaptive-payments

Paypal and AngellEye Library: You must specify only one primary receiver and at least one secondary receiver


I am using AngellEye Library to send a test payment to a single receiver in Paypal. I was able to successfully request an adaptive payment authorization but is getting an error whenever I send a payment:

Array
(
    [Errors] => Array
        (
            [0] => Array
                (
                    [Receiver] => 
                    [Category] => Application
                    [Domain] => PLATFORM
                    [ErrorID] => 579008
                    [ExceptionID] => 
                    [Message] => You must specify only one primary receiver and at least one secondary receiver
                    [Parameter] => 1
                    [Severity] => Error
                    [Subdomain] => Application
                )

        )

    [Ack] => Failure
    [Build] => 10273932
    [CorrelationID] => 91304768d2d3b
    [Timestamp] => 2014-04-20T22:06:56.756-07:00
    [PayKey] => 
    [PaymentExecStatus] => 
    [RedirectURL] => 
    [XMLRequest] => ReturnAllen_USPAYhttp://mydomain.com/user?tab=financialAPP-80W284485P519543T1Seller112.198.82.212USDEACHRECEIVERCraftersHub.Com Affiliate PaymentPA-3YM23894VM185730A10000.00usb_1329725429_biz@[email protected]://mydomain.com/paypal/[email protected]@mydomain.com1398056815
    [XMLResponse] => 2014-04-20T22:06:56.756-07:00Failure91304768d2d3b10273932579008PLATFORMApplicationErrorApplicationYou must specify only one primary receiver and at least one secondary receiver1
)

The parameters I am sending to pay is below:

Array
(
    [PayRequestFields] => Array
        (
            [ActionType] => PAY
            [CancelURL] => http://mydomain.com/user?tab=financial
            [CurrencyCode] => USD
            [FeesPayer] => EACHRECEIVER
            [IPNNotificationURL] => 
            [Memo] => mydomain.com Affiliate Payment
            [Pin] => 
            [PreapprovalKey] => PA-3YM23894VM185730A
            [ReturnURL] => http://mydomain.com/paypal/[email protected]
            [ReverseAllParallelPaymentsOnError] => 1
            [SenderEmail] => [email protected]
            [TrackingID] => 1398056815
        )

    [ClientDetailsFields] => Array
        (
            [CustomerID] => 1
            [CustomerType] => Seller
            [GeoLocation] => 
            [Model] => 
            [PartnerName] => 
        )

    [Receivers] => Array
        (
            [0] => Array
                (
                    [Amount] => 10000.00
                    [Email] => [email protected]
                    [InvoiceID] => 1398056815
                    [PaymentType] => SERVICE
                    [PaymentSubType] => 
                    [Phone] => Array
                        (
                            [CountryCode] => 
                            [PhoneNumber] => 
                            [Extension] => 
                        )

                    [Primary] => 1
                )

        )

    [SenderIdentifierFields] => Array
        (
            [UseCredentials] => 
        )

    [AccountIdentifierFields] => Array
        (
            [Email] => [email protected]
            [Phone] => Array
                (
                    [CountryCode] => 
                    [PhoneNumber] => 
                    [Extension] => 
                )

        )

)

Can anybody point out how I could accomplish this? Thanks.


Solution

  • u need to change [FeesPayer] => sender and [Primary] => 'false' . this tells the api that there is only one sender and one receiver. check here https://developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIntro/ for more info try this :

         Array
         (
           [PayRequestFields] => Array
         (
            [ActionType] => PAY
            [CancelURL] => http://example.com/user?tab=financial
            [CurrencyCode] => USD
            [FeesPayer] => sender
            [IPNNotificationURL] => 
            [Memo] => example.com Affiliate Payment
            [Pin] => 
            [PreapprovalKey] => PA-3YM23894VM185730A
            [ReturnURL] => http://example.com/paypal/[email protected]
            [ReverseAllParallelPaymentsOnError] => 1
            [SenderEmail] => [email protected]
            [TrackingID] => 1398056815
        )
    
    [ClientDetailsFields] => Array
        (
            [CustomerID] => 1
            [CustomerType] => Seller
            [GeoLocation] => 
            [Model] => 
            [PartnerName] => 
        )
    
    [Receivers] => Array
        (
            [0] => Array
                (
                    [Amount] => 10000.00
                    [Email] => [email protected]
                    [InvoiceID] => 1398056815
                    [PaymentType] => SERVICE
                    [PaymentSubType] => 
                    [Phone] => Array
                        (
                            [CountryCode] => 
                            [PhoneNumber] => 
                            [Extension] => 
                        )
    
                    [Primary] => 'false'
                )
    
        )
    
    [SenderIdentifierFields] => Array
        (
            [UseCredentials] => 
        )
    
    [AccountIdentifierFields] => Array
        (
            [Email] => [email protected]
            [Phone] => Array
                (
                    [CountryCode] => 
                    [PhoneNumber] => 
                    [Extension] => 
                )
    
        )
    

    )