user2507484
user2507484

Reputation: 43

PayPal Adaptive - Buyer Name?

Is it possible to obtain a buyer's first and last names in an IPN call after a PAY transaction? I've tried everything from a simple chained PAY call, to setting the payType to "CREATE" and then using the payKey to retrieve an address from the "setPaymentOptions" API by setting "requireShippingAddressSelection" to true. Neither has worked. The only information I receive about the buyer is their email address as "sender_email" and the amount paid, no matter how I make the call.

I've also tried the "getShippingAddresses" API and no luck there either. I couldn't find anything specific in the docs. Here is a sample IPN response, I've taken out the useless bits like the redirect URL's: transaction: '0': .is_primary_receiver: 'true' .id_for_sender_txn: TXN_CODE .receiver: RECEIVER_EMAIL .amount: USD 10.00 .status: Completed .id: TRANS_ID .status_for_sender_txn: Completed .paymentType: SERVICE .pending_reason: NONE '1': .paymentType: SERVICE .id_for_sender_txn: TXN_CODE .is_primary_receiver: 'false' .status_for_sender_txn: Completed .receiver: RECEIVER_EMAIL .amount: USD 10.00 .pending_reason: NONE .id: TRANS_ID .status: Completed log_default_shipping_address_in_transaction: 'false' action_type: CREATE charset: windows-1252 transaction_type: Adaptive Payment PAY notify_version: UNVERSIONED sender_email: SENDER_EMAIL fees_payer: EACHRECEIVER reverse_all_parallel_payments_on_error: 'false' pay_key: 'PAY_KEY' status: COMPLETED test_ipn: '1'

And to make the call:

pay_request = PaypalAdaptive::Request.new

data = {
"returnUrl" => "", 
"requestEnvelope" => {"errorLanguage" => "en_US"},
"currencyCode"=>"USD",  
"receiverList"=>{"receiver"=>[{"email"=>"", "amount"=>"10.00"},{"email"=>"", "amount"=>"10.00"}]},
"cancelUrl"=>"",
"actionType"=>"PAY",
"ipnNotificationUrl"=>""
}

pay_response = pay_request.pay(data)

//OTHER ATTEMPT: was to grab payKey here and try setting payment options with another request call, but that didn't work either

if pay_response.success?
  redirect_to pay_response.preapproval_paypal_payment_url
else
  puts pay_response.errors.first['message']
  redirect_to failed_payment_url
end

I thought maybe getting this line -> log_default_shipping_address_in_transaction: 'false' set to true would get me a name, but I can't change it from false no matter what I try. Anyone have any ideas of what is going on and whether it's even possible to get the buyer's name using PayPal Adaptive? I must be missing something very simple... Thanks!

Upvotes: 2

Views: 467

Answers (1)

Gerzie
Gerzie

Reputation: 2340

The only information returned for the sender from a transaction like this is the sender_email value.

Here is a link to our IPN guide, it has a section on the information returned in a Pay API call: https://www.paypalobjects.com/webstatic/en_US/developer/docs/pdf/ipnguide.pdf

Upvotes: 1

Related Questions