A
A
antonshell2015-10-23 16:40:15
PHP
antonshell, 2015-10-23 16:40:15

ebay api. How to get Buyer email?

Hello.
Does anyone know how to get buyer's email via ebay api? And is it possible in principle?
I am developing a web application that should receive data from Ebay.
I'm interested in the list of orders, I'm trying to get a list of users from it.
Using php-sdk:
https://github.com/davidtsadler/ebay-sdk-php
Using Trading Api, GetOrders method:
developer.ebay.com/devzone/xml/docs/Reference/ebay...
Sample code:

public function getOrders(){
        $service = $this->getTradingService();

        $args = array(
            //"OrderStatus"   => "Completed",
            "OrderStatus"   => "All",
            "SortingOrder"  => "Ascending",
            "OrderRole"     => "Seller",

            //"CreateTimeFrom"   => new \DateTime('2015-01-01'),
            "CreateTimeFrom"   => new \DateTime('2000-01-01'),
            "CreateTimeTo"   => new \DateTime(),
        );

        $request = new Types\GetOrdersRequestType($args);
        $request->RequesterCredentials = new Types\CustomSecurityHeaderType();
        $request->RequesterCredentials->eBayAuthToken = $this->userToken;
        $request->IncludeFinalValueFee = true;
        $request->Pagination = new Types\PaginationType();
        $request->Pagination->EntriesPerPage = 100;
        $pageNum = 1;

        $orders = [];

        do {
            $request->Pagination->PageNumber = $pageNum;

            $response = $service->getOrders($request);

            if (isset($response->Errors)) {

                $message = '';

                foreach ($response->Errors as $error) {
                    $message .= $error->ShortMessage;
                }

                throw new Exception($message);
            }

            if ($response->Ack !== 'Failure' && isset($response->OrderArray)) {
                foreach ($response->OrderArray->Order as $order) {
                    $orders[] = $order->toArray();
                }
            }

            $pageNum += 1;
        }
        while(isset($response->OrderArray) && $pageNum <= $response->PaginationResult->TotalNumberOfPages);

        return $orders;
}

It works fine, I receive the order, delivery address, etc.
But the email of the buyer can not be obtained in any way.
$orders[0]['ShippingAddress']['ExternalAddressID']
Empty line.
$orders[0]['TransactionArray']['Transaction'][0]['Buyer']['Email']

String value "Invalid Request"
Sinned on sdk, tried to do the same through a Post request, the same result.
Tried through the GetUser method - everything is the same.
It appears to be related to ebay's privacy policy.
But, in theory, for completed orders, it should be possible to receive an email.
Has anyone experienced something similar?
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2015-10-23
@dimonchik2013

GetUserContactDetails returns all available contact information except street address and email address. Sellers who wish to send an email to bidders should use AddMemberMessagesAAQToBidder.
although at one time
eBay® only stores the buyer email address in their system for 15 days. If you download shipments from their system that are older than 15 days, you will see "Invalid Request".
check on a recent order, if not the second - then the first

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question