I'm trying to use the PayPal Adaptive Payments Payment API. I am trying to test the API with my own email address, but I get an error specifying the sender by email. I'm wondering how to determine my own account ID to try that way?
I'm referring to the account id here: https://developer.paypal.com/docs/classic/api/adaptive-payments/PaymentDetails_API_Operation/
I get the error: "The email address [email protected] is invalid. It may not be registered in PayPal's system yet"
when trying to pay by my email. When I log in with PayPal my email address is correct. My account is verified with a bank account, credit card, and debit card connected.
Here is my code:
require 'paypal-sdk-adaptivepayments'
PayPal::SDK.configure(
:mode => "sandbox", # Set "live" for production
:app_id => "HIDDEN",
:username => "HIDDEN",
:password => "HIDDEN",
:signature => "HIDDEN" )
@api = PayPal::SDK::AdaptivePayments.new
# Build request object
@pay = @api.build_pay({
:actionType => "PAY",
:cancelUrl => "http://localhost:3000/samples/adaptive_payments/pay",
:currencyCode => "USD",
:feesPayer => "SENDER",
:ipnNotificationUrl => "http://localhost:3000/samples/adaptive_payments/ipn_notify",
:receiverList => {
:receiver => [{
:amount => 1.0,
:email => "[email protected]" }] },
:returnUrl => "http://localhost:3000/samples/adaptive_payments/pay" })
#@pay.sender.email = "[email protected]"
@pay.sender.accountId = 23434
# Make API call & get response
puts @pay.inspect
@response = @api.pay(@pay)
# Access response
if @response.success?
puts 'responsepayKey'
@response.payKey
puts 'url to complete payment'
@api.payment_url(@response) # Url to complete payment
else
puts 'error'
puts @response.error[0].message
puts @response.error[1].parameter.value
end