How do you get the shipping address back from an Adaptive Payment API call? - paypal

How are you supposed to get the shipping info back from a Parallel Payment, using PayPal's Adaptive API system? Normally it would just get passed back as payer_country, etc - when the IPN script is requested. However, this doesn't seem to be the case.
Here are the params being passed in when the IPN script is called:
transaction[0].amount
transaction[0].id
verify_sign
transaction[1].receiver
reverse_all_parallel_payments_on_error
transaction[1].pending_reason
transaction[0].pending_reason
transaction[1].id_for_sender_txn
transaction[0].invoiceId
payment_request_date
test_ipn
cancel_url
charset
return_url
transaction[0].status_for_sender_txn
ipn_notification_url
transaction[1].is_primary_receiver
transaction[1].status
transaction_type
transaction[1].amount
transaction[0].status
log_default_shipping_address_in_transaction
transaction[0].receiver
status
transaction[0].id_for_sender_txn
action_type
fees_payer
pay_key
transaction[1].status_for_sender_txn
transaction[0].paymentType
transaction[1].invoiceId
transaction[1].id
sender_email
notify_version
transaction[1].paymentType
transaction[0].is_primary_receiver
If I then do a PaymentDetails API call, I get back stuff like:
$VAR1 = {
'currencyCode' => 'USD',
'responseEnvelope' => {
'correlationId' => '9944330ab9a8c',
'timestamp' => '2014-04-07T06:08:16.094-07:00',
'ack' => 'Success',
'build' => '10273932'
},
'status' => 'COMPLETED',
'senderEmail' => 'andy.aaaa#ultranerds.co.uk',
'cancelUrl' => 'http://somesite.net/paypal/cancel.html',
'paymentInfoList' => {
'paymentInfo' => [
{
'pendingRefund' => 'false',
'receiver' => {
'accountId' => 'NY3AD33DD739C',
'email' => 'andy-xxx#ultranerds.com',
'amount' => '65.00',
'invoiceId' => '1022',
'primary' => 'false',
'paymentType' => 'GOODS'
},
'transactionId' => '8E1114341X895213Y',
'senderTransactionStatus' => 'COMPLETED',
'senderTransactionId' => '5EV71352C33256006',
'transactionStatus' => 'COMPLETED',
'refundedAmount' => '0.00'
},
{
'pendingRefund' => 'false',
'receiver' => {
'accountId' => 'YYP5C69YWCMKE',
'email' => 'andy.yyy#gmail.com',
'amount' => '15.00',
'invoiceId' => '1023',
'primary' => 'false',
'paymentType' => 'GOODS'
},
'transactionId' => '68H86656UP574062X',
'senderTransactionStatus' => 'COMPLETED',
'senderTransactionId' => '2XW88939LK1112523',
'transactionStatus' => 'COMPLETED',
'refundedAmount' => '0.00'
}
]
},
'feesPayer' => 'EACHRECEIVER',
'actionType' => 'CREATE',
'ipnNotificationUrl' => 'http://somesite.net/paypal/test_ipn.cgi',
'sender' => {
'useCredentials' => 'false',
'accountId' => 'B74RBM5F6SLZG',
'email' => 'andy.aaa#ultranerds.co.uk'
},
'returnUrl' => 'http://somesite.net/paypal/success.html',
'payKey' => 'AP-4EK17906VB6613533',
'reverseAllParallelPaymentsOnError' => 'false'
};
As you can see, there is no reference to the delivery address at all. How are you supposed to get that info back?
UPDATE: Mmm ok, so it looks like GetShippingAddresses is what I need - but for some reason its coming back with nothing in when I call it:
{"requestEnvelope":{"errorLanguage":"en_US","detailLevel":"ReturnAll"},"key":"AP-1B1377463N9785350"} /GetShippingAddresses_API_Operation/
...simply returns:
{
'responseEnvelope' => {
'correlationId' => '3a4443aed09c9',
'timestamp' => '2014-04-07T06:40:35.460-07:00',
'ack' => 'Success',
'build' => '10273932'
}
}
I'm a bit baffled as to why its doing that. Any suggestions?
I found a quote here:
http://go.developer.ebay.com/devzone/articles/using-paypals-adaptive-payments-and-google-app-engine-build-online-market-python-part-3
Unfortunately, although this follows the process recommended by
PayPal's documentation, it doesn't work. There's currently a bug in
PayPal's Adaptive Payments implementation. For a traditional payment,
the shipping address is not collected; for embedded payments, the
GetShippingAddresses call does not return the shipping address.
PayPal has acknowledged the bug and indicated that it expects to have
this fixed in April 2011. If you need shipping addresses right now,
the recommendation is to collect them on your site rather than relying
on the PayPal API.
That was from 2011... but is this still the case??
Sorry to bump - but has anyone got any suggestions?

Ok, well I got my answer - but unfortunately its not what I was hoping for:
Yes, unfortunately this feature is only available for embedded payment
flow.
https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/ht_ap-embeddedPayment-curl-etc/
If you're using embedded payment flow, then you can retrieve the
address on their PayPal account by passing in
senderOptions.requireShippingAddressSelection = true during
SetPaymentOption API call. You can then retrieve it via
GetShippingAddresses API call.
So it looks like really what I need to do, is ask the user to provide their shipping information BEFORE sending them to paypal, then storing it. Not ideal - but I guess you just have to work with what you got!

Related

Non Primary receiver not receiving payments

I am trying to test the Paypal Delayed Chained Payment API's.
There are two receivers 'A' and 'B', A is a primary receiver (US) and B is the second receiver (MX) when I release the payment using the Execute API the second receiver is not receiving the payment but the payments are being deducted from the buyer and primary accounts.
I am adding the request array below.
[
'actionType' => 'PAY_PRIMARY',
'clientDetails' => [
'applicationId' => 'APP-80W284485P519543T',
'ipAddress' => '127.0.0.1'
],
'currencyCode' => 'USD',
'feesPayer' => 'EACHRECEIVER',
'memo' => 'Example',
'receiverList' => [
'receiver' => [
[
'email' => 'A-Primary#appinventiv.com',
'primary' => true,
'amount' => 25,
],
[
'email' => 'B-Second#appinventiv.com',
'primary' => false,
'amount' => 20,
]
]
],
'requestEnvelope' => [
'errorLanguage' => 'en_US'
],
'returnUrl' => 'http://localhost/hairInferno/success.php',
'cancelUrl' => 'http://localhost/hairInferno/success.php'
];
Adaptive Payments was discontinued in December 2017 and no new APP IDs are generated for use in the live environment, so I'd drop this integration pattern
You could look around the PayPal for Partners documentation, but I'm not sure whether any of this would be available to you: https://developer.paypal.com/docs/partners/
Something with Payouts might be the best interim solution: https://developer.paypal.com/docs/payouts/

Get PayPal transaction ID through data served by PayPal IPN (with REST API, not classic)

The PayPal IPN serves the following data:
'mc_gross' => '715.80',
'protection_eligibility' => 'Eligible',
'address_status' => 'unconfirmed',
'item_number1' => '',
'payer_id' => 'UCTG7GEULVxxx',
'tax' => '0.00',
'address_street' => 'Pl 2270',
'payment_date' => '00:35:08 Jul 31, 2014 PDT',
'payment_status' => 'Completed',
'charset' => 'windows-1252',
'address_zip' => '26492',
'mc_shipping' => '0.00',
'mc_handling' => '0.00',
'first_name' => 'Benny',
'mc_fee' => '8.94',
'address_country_code' => 'SE',
'address_name' => 'Benny Andersxxx',
'notify_version' => '3.8',
'custom' => '',
'payer_status' => 'verified',
'business' => 'paypal#xxx.com',
'address_country' => 'Sweden',
'num_cart_items' => '1',
'mc_handling1' => '0.00',
'address_city' => 'Klippan',
'verify_sign' => 'AiJvJDl-VyZzRT4Hq0qB1wSjgCgGAvdLxvQHk79AHsO0AjdeWvSwxxx',
'payer_email' => 'benny.anderxxx#xxx.com',
'mc_shipping1' => '0.00',
'tax1' => '0.00',
'txn_id' => '1M112630L55146xxx',
'payment_type' => 'instant',
'last_name' => 'Andersxxx',
'address_state' => '_0_',
'item_name1' => 'Order xxx.com 2014-07-31',
'receiver_email' => 'paypal#xxx.com',
'payment_fee' => '',
'quantity1' => '1',
'receiver_id' => '4AMCEP9BMPxxx',
'txn_type' => 'cart',
'mc_gross_1' => '715.80',
'mc_currency' => 'EUR',
'residence_country' => 'SE',
'transaction_subject' => '',
'payment_gross' => '',
'ipn_track_id' => '354021aeaxxx',
Is it possible getting through the information above to the transaction id which is required in quite a lot of other API transactions?
Actually, I'm trying to execute a refund via this call:
https://api.paypal.com/v1/payments/sale/{transactionId}/refund
However, I'm still missing the correct ID here and meanwhile I don't have any more ideas how to collect this transaction id (I guess it should look like ""PAY-PT597110X687430LKGECATA") ....
Please keep in mind that I'm using the REST API and not the classic API.
Edit: I don't know why, but every time I edit this article and add a "Hello" at the beginning, it is being deleted after saving :-( Sorry!
The transaction id is found on this line
'txn_id' => '1M112630L55146xxx',
You would need to call this URL with REST (sandbox URL shown, adjust for Live as needed)
https://api.sandbox.paypal.com/v1/payments/refund/1M112630L55146xxx
You can see more details in the API reference
Just got a message from PayPal that refunds are only partially available wioth REST API. I'll now try it with Classic API...
However, it didn't work with the txn_id # Machavity

PayPal address_override integration to PayPal Express Checkout

I'm trying to set up PayPal address_override at my shop checkout as my customers have already filled in their delivery details.
I'm using express checkout, and following on from reading the documentation here: https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/formbasics/
I've got the following basic set up added into my working express checkout code (perl file):
# -- build the request for Paypal
my $response = $useragent->post($api_endpoint,
[
'METHOD' => 'SetExpressCheckout',
'VERSION' => '3.0',
'PWD' => $API_PASSWORD,
'USER' => $API_USERNAME,
'SIGNATURE' => $API_SIGNATURE,
'Amt' => $amount,
'PAYMENTACTION' => 'Sale',
'ReturnUrl' => $returnurl,
'CANCELURL' => $cancelurl,
'CURRENCYCODE' => $API_CURRENCYCODE,
'address_override' => '1',
'address1' => $d_address1,
'address2' => $d_address2,
'city' => $d_city,
'country' => $country,
'zip' => $d_post_code
]
);
However this isn't overriding the address when I get through to my PayPal account, it's still just showing my stored addresses.
I've read this post:
Paypal | Website Payment Standard | Adddress Override
And this one:
Paypal Address Override not working
Hopefully someone can show me where I'm going wrong, or if I've missed a step! Any help appreciated.
I may be wrong here but that API link you've pasted doesn't look like it's the same API that the rest of your code sample is using?
Searching for SetExpressCheckout leads to this page: https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
I think you need to use the ADDROVERRIDE parameter instead of address_override and whatever else you need from that page.

Paypal sandbox, all my GBP transactions are becoming USD transactions

I'm having a currency problem with Paypal Sandbox.
I'm testing recurring payments for my site using the sandbox
(digital goods, express checkout)
Everything is working as expected.
The user clicks on pay.
The user is transfered to paypal express checkout login.
The paypal login screen shows the correct amount in the correct currency e.g. £10
The user logs in (authenticates the transaction)
The payment is successful and the user returns to our site.
Lovely. It all works as I would expect.
However, when I log into the merchant sandbox account to check the activity, all of the £xx payments my test user made are now in $xx (USD)
How can I fix this, or does Sandbox only support USD and this will go away if I go live?
I have tried changing the currency in my request (i.e. setting PAYMENTREQUEST_0_CURRENCYCODE = something else) - that changes the currency in the payment page login, but regardless, all payments still come through as USD in the merchant login.
I have GBP, Euro and USD setup as currencies in my merchant account.
A request looks like this (except all keys are converted to UC before sending the request to PayPal).
'L_PAYMENTREQUEST_0_AMT0' => '10.00',
'paymentaction' => 'Sale',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'GBP',
'l_billingtype0' => 'RecurringPayments',
'returnUrl' => 'http://site.com',
'brandname' => 'Name',
'L_PAYMENTREQUEST_0_DESC0' => 'GoPro 10',
'allownote' => 0,
'l_billingagreementdescription0' => 'goPro 10.',
'PAYMENTREQUEST_0_ITEMAMT' => '10.00',
'cancelUrl' => 'http://site.com/payment/cancel/7',
'PAYFLOWCOLOR' => '518daf',
'PAYMENTREQUEST_0_AMT' => '10.00',
'L_PAYMENTREQUEST_0_ITEMCATEGORY0' => 'Digital',
'HDRIMG' => 'http://site.com/images/logo230x95.png',
'MAXFAILEDPAYMENTS' => 0,
'L_PAYMENTREQUEST_0_NAME0' => '10',
'noshipping' => 1,
'L_PAYMENTREQUEST_0_NUMBER0' => 'CR7',
'L_PAYMENTREQUEST_0_QTY0' => 1,
The response form paypay is "Success", however if I perform a
GetRecurringPaymentsProfileDetails
Then the result from paypal is in USD. E.g.
'totalbillingcycles' => '0',
'trialamtpaid' => '0.00',
'autobilloutamt' => 'NoAutoBill',
'ack' => 'Success',
'desc' => 'Gift or use 110 points per month and receive 70% revenue share with goPro 10.',
'numcyclesremaining' => '0',
'amt' => '10.00',
'maxfailedpayments' => '0',
'nextbillingdate' => '2012-11-22T10:00:00Z',
'regularbillingperiod' => 'Day',
'aggregateamt' => '0.00',
'subscribername' => 'name',
'regulartotalbillingcycles' => '0',
'billingperiod' => 'Day',
'outstandingbalance' => '0.00',
'status' => 'Active',
'regularamtpaid' => '0.00',
'taxamt' => '0.00',
'regulartaxamt' => '0.00',
'failedpaymentcount' => '0',
'regularshippingamt' => '0.00',
'profileid' => 'I-616GDHNKDXKL',
'timestamp' => '2012-11-22T12:28:26Z',
'regularbillingfrequency' => '1',
'version' => '95.0',
'finalpaymentduedate' => '1970-01-01T00:00:00Z',
'build' => '4181146',
'numcyclescompleted' => '0',
'correlationid' => 'c3fc55a117agh',
'shippingamt' => '0.00',
'regularcurrencycode' => 'USD',
'regularamt' => '10.00',
'aggregateoptionalamt' => '0.00',
'profilestartdate' => '2012-11-22T00:00:00Z',
'billingfrequency' => '1',
'currencycode' => 'USD',
Is there something obvious I'm missing?
Ah, I asked too early, it seems that the field
PAYMENTREQUEST_0_CURRENCYCODE is ignored (I'm not sure why - it's documented)
You must use
CURRENCYCODE = GBP (which is documented as deprecated).

FedEx: Authentication Failed with test account

I'm trying to integrate FedEx with my application. I created a test account.
When I send RateRequest I got a response Authentication Failed (code is 1000).
I use v10 of Fedex Rate service. For SOAP I use Savon ruby gem.
Here is code I use:
require 'rubygems'
require 'savon'
TEST_URL = 'https://wsbeta.fedex.com:443/web-services/rate'
client = Savon::Client.new do
wsdl.document = File.expand_path("../rate_wsdl.xml", __FILE__)
wsdl.endpoint = TEST_URL
end
client.request "RateRequest" do
soap.body = {
'WebAuthenticationDetail' => {'Key' => KEY, 'Password' => PASSWORD},
'ClientDetail' => {'AccountNumber' => ACCOUNT_NUMBER, 'MeterNumber' => METER_NUMBER},
'RequestedShipment' => {
'PackagingType' => 'FODEX_BOX',
'Shipper' =>
{'Address' => {'PostalCode' => '90210', 'CountryCode' => 'US', 'Residential' => 'true'}
},
'Recipient' =>
{'Address' => {'PostalCode' => 'KIP 1J1', 'CountryCode' => 'CA', 'Residential' => 'true'}
},
'RateRequestTypes' => 'ACCOUNT',
'PackageCount' => '1',
'RequestedPackages' => {
'Weight' => {'Units' => 'LB', 'Value' => '7.5'},
'Dimensions' => {'Length' => '15', 'Width' => '10', 'Height' => '5', 'Units' => 'IN'}
}
#'LabelSpecification' => ''
}
}
end
I googled a lot about it. Some people had the same problem. People say it can be caused because of lack of permission of address validation, but I can't find how I can disable it if so.
I am sure that all credentials are OK (account number, meter number, key, password).
Also I tried "https://wsbeta.fedex.com:443/web-service" for endpoint url as well.
Figured out of was wrong. I sent invalid SOAP request. Thanks to SOAPUI tool, it helped me to validate my request.