• Resolved pydie

    (@pydie)


    Is there any way to get payer first_name and last_name from paypal and save as meta data in the woocommerce order?

    I need these data right after the paypal popup closes, in checkout page, before order-received page.

    Printing globals I’ve found this in class-wc-gateway-ppec-checkout-handler.php
    WC_Gateway_PPEC_Checkout_Handler::do_payment()

    PayPal_Checkout_Payer_Details::__set_state(array(
    'phone_number' => false,
    'email' => '[email protected]',
    'payer_id' => 'XDXC1ZWHHQN23',
    'payer_status' => 'verified',
    'country' => 'US',
    'business_name' => false,
    'first_name' => 'Alejandro',
    'last_name' => 'Buyer',
    'middle_name' => false,
    'suffix' => false,
    'billing_address' => false,
    )

    if I can access to this data from a hook would be great.

    php7, WooCommerce 3.6.5, WooCommerce PayPal Checkout Gateway 1.6.16, test enviroment with sandbox.
    Excuse me if the question is very silly, I’m a beginner in wordpress.

Viewing 4 replies - 1 through 4 (of 4 total)
  • melinda a11n

    (@melindahelt)

    Automattic Happiness Engineer

    Hi there!

    >I need these data right after the paypal popup closes, in checkout page, before order-received page.

    The data you found is coming from IPN (a request from PayPal to the website) very shortly after the order is processed and complete. And then the Woo order is updated with it, which seems to be what you are looking for: (see screenshot – https://cld.wthms.co/kWRg0z )

    If that is not what you want, then you could parse the billing data on the order to extract the name and email address of the payer. It comes from PayPal.

    For the IPN above, there’s also an action, woocommerce_paypal_express_checkout_valid_ipn_request that gets the PayPal request passed to it. You could hook into that action in their own code and do anything with it. But again, it’s not instantaneous.

    melinda a11n

    (@melindahelt)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

    Thread Starter pydie

    (@pydie)

    Hi Melinda, Sorry for the delay and thank you for your reply,
    yes, it works ??

    Can you provide any more details on how to access and use the customer info that is passed back from Paypal?

    You said “the Woo order is updated with it”, but when I look at orders using Paypal they only show the buyer’s email address, which is the only piece of information we require from them when checking out with Paypal. We would still like to have their first and last name, to show on the receipt.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Get customer name and email from Paypal.’ is closed to new replies.