Search code examples
phppaypalpaypal-adaptive-payments

Setting options for adaptive payment, receiver cannot be null


Here is my request object for setting payment option.

SetPaymentOptionsRequest Object
(
    [requestEnvelope] => RequestEnvelope Object
        (
            [detailLevel] => 
            [errorLanguage] => en_US
        )

    [payKey] => AP-0MG8529097707340X
    [initiatingEntity] => 
    [displayOptions] => 
    [shippingAddressId] => 
    [senderOptions] => 
    [receiverOptions] => Array
        (
            [0] => ReceiverOptions Object
                (
                    [description] => 
                    [customId] => 
                    [invoiceData] => InvoiceData Object
                        (
                            [item] => Array
                                (
                                    [0] => InvoiceItem Object
                                        (
                                            [name] => my Item
                                            [identifier] => 1
                                            [price] => 138
                                            [itemPrice] => 69
                                            [itemCount] => 2
                                        )

                                )

                            [totalTax] => 
                            [totalShipping] => 
                        )

                    [receiver] => ReceiverIdentifier Object
                        (
                            [email] => [email protected]
                            [phone] => 
                        )

                    [referrerCode] => 
                )

        )

)

I followed the sdk example but I get this error response

SetPaymentOptionsResponse Object
(
    [responseEnvelope] => ResponseEnvelope Object
        (
            [timestamp] => 2013-02-16T05:38:38.298-08:00
            [ack] => Failure
            [correlationId] => f17a8e24e1375
            [build] => 4992011
        )

    [error] => Array
        (
            [0] => ErrorData Object
                (
                    [errorId] => 580022
                    [domain] => PLATFORM
                    [subdomain] => Application
                    [severity] => Error
                    [category] => Application
                    [message] => Invalid request parameter: receiverOption.receiver(0).email
                    [exceptionId] => 
                    [parameter] => Array
                        (
                            [0] => ErrorParameter Object
                                (
                                    [name] => 
                                    [value] => receiverOption.receiver(0).email
                                )

                            [1] => ErrorParameter Object
                                (
                                    [name] => 
                                    [value] => [email protected]
                                )

                        )

                )

        )

)

If I don't set the email the error becomes Invalid request parameter: receiver cannot be null
Edit: Here and here you have some reference. Maybe you see something I didn't.


Solution

  • I was facing the same problem and found out that you need to provide a valid email address for receiver for the SetPaymentOptions call to succeed.

    In my case I'm using chained payments and I use the email of the primary receiver.