Paypal IPN sending 'pending' with 'multi-currency' as reason? - php

I am using the Paypal IPN to take payments from my website. The website is only in development at the moment and so I set up a Sandbox site to test and I've been taking payments very successfully in GBP currency (my country of residences currency) with a test account registered in the UK.
However, I want the site to detect a visitors country of origin and allow them to purchase in their own currency. So I accessed the site via a US based proxy. The site used dollars as the currency and I logged into the Paypal sandbox with an account I had set up as US based.
However my return from Paypal has the following:
[payment_status] => Pending
[pending_reason] => multi_currency
[mc_gross] => 4.99
[protection_eligibility] => Eligible
[address_status] => confirmed
[payer_id] => X7QACLK8F7L9Q
[address_street] => 1 Main St
[payment_date] => 13:54:37 Feb 18, 2015 PST
[payment_status] => Pending
[address_country_code] => US
[notify_version] => 3.8
[payer_status] => verified
[address_country] => United States
[num_cart_items] => 1
[address_city] => San Jose
[payment_type] => instant
[address_state] => CA
[pending_reason] => multi_currency
[txn_type] => cart
[mc_gross_1] => 4.99
[mc_currency] => USD
[residence_country] => US
[test_ipn] => 1
[payment_gross] => 4.99
The purchases aren't registering on the site as the payment_status isn't complete (quite correctly). Anyone know the reason for this?

Right I've finally worked out what the issue was and managed to resolve this so thought I would post an answer to my own question in order that it may help people in future.
Firstly log in to your Sandbox Developer Site (where you set up all your fake accounts etc).
https://developer.paypal.com/developer
We need to be logged in to this site in order to be able to then log in to the Sandbox Paypal Business Account.
Leave yourself logged in to the Sandbox Developer Site above and open a new tab and go to the Sandbox Paypal Business Login:
Sandbox Business Login
Now you'll probably see your "pending" transactions in the list. You can choose to "Accept" a pending transaction and the next page will allow you to alter your payment recieving preferences.
I ticked the radio box "Yes, accept and convert them to British Pounds" in answer to what to do with payments from a different currency.
That sorted it for me. Hope it helps someone else along the way.
Thanks to the other posters for their help on this as well. It helped me get to the bottom of it.

Please try to follow the instructions below to turn off the Payment Review function for your Sandbox account:
Go to PayPal Developer Website
Log in to your developer account
Click Applications
Click Sandbox accounts
Click on to the email address that you would like to turn off the Payment Review option and click Profile after it expand
Click Settings
And select Off for the Payment review.
Click Close
!!! Make sure you are doing this on your PayPal SandBox Merchant Account!

Login at your main PayPal account (not sandbox), go to Seller preferences and click on update Block payments.

As of 2019, it's nightmare to use PayPal tutorial links because they changed the structure of their website without proper redirection of old links.
To accept payments made in difference currencies and marked as unclaimed/pending due to multi_currency, you've 2 options :
Go to https://www.paypal.com/listing/transactions and manually accept the transaction
You'll then be presented with
options to accept and create balance in X currency:
Go directly to https://www.paypal.com/cgi-bin/webscr?cmd=_profile-pref, which should redirect you to https://www.paypal.com/businessmanage/preferences/payments, and choose to automatically accept and convert future payments as follows:

Just remove multi currency from your paypal sandbox settings.
Login to your proper sandbox account. (I have find that first time i remove multicurrency for my different sandbox account)
From Settings, go to "My Money / wallet" section.
And keep only one currency which you use in your application. Remove other currencies.

Related

PayPal Pro setup Error 10548

while paypal test checkout. I got an error mentioned below.
[TIMESTAMP] => 2017-09-22T09:01:00Z
[CORRELATIONID] => 8d454e5592202
[ACK] => Failure
[VERSION] => 65.1
[BUILD] => 36082234
[L_ERRORCODE0] => 10548
[L_SHORTMESSAGE0] => Invalid Configuration
[L_LONGMESSAGE0] => This transaction cannot be processed. The merchant's account is not able to process transactions.
[L_SEVERITYCODE0] => Error
[AMT] => 10.00
[CURRENCYCODE] => USD
I has checked for all stack answers and youtube tutorials.
I has created sandbox business account for us country, added balance, upgraded to pro, on modal in settings tab: PayPal Credit- on, login with pal - all these steps are done. copy the credential under api tab and pasted them to code you provide.
But while make payments. I got the above mentioned errors. Any help will be appreciated. Thanks!
Your account where it calls the API should be upgrade to PRO before you make the DoDirectPayment API.
This error usually occurs if you don't have a business account. You must have a business PayPal account within a PayPal Payments Pro-enabled country to use the Direct Payment API. The absence of a home or customer service phone number on your PayPal account can also trigger this error.
Solution
If you have a business account and you get this error, check your PayPal account profile and make sure it includes a home phone number or a customer service phone number. Update your profile if necessary.
https://www.paypal-knowledge.com/infocenter/index?page=content&id=FAQ1147&actp=LIST

PayPal pro error

I have created buyer and seller account from PayPal developer site.
Account type: Buisness-pro
And fill all right api detail's but this error is coming:-
Array
(
[TIMESTAMP] => 2016-12-15T12:43:12Z
[CORRELATIONID] => a9537857c6865
[ACK] => Failure
[VERSION] => 65.1
[BUILD] => 24616352
[L_ERRORCODE0] => 10501
[L_SHORTMESSAGE0] => Invalid Configuration
[L_LONGMESSAGE0] => This transaction cannot be processed due to an invalid merchant configuration
.
[L_SEVERITYCODE0] => Error
[AMT] => 10.00
[CURRENCYCODE] => USD
)
{"status":0}
Business-Pro can actually mean one of two things.
Website Payments Pro 3.0 - This is what uses the DoDirectPayment API
Payments Pro 2.0 - This uses the PayFlow API
In your case it looks like you're approved for "Pro" so you're trying to use the DoDirectPayment API, but the error you're getting means that particular API is still not enabled on your account.
This could mean that you simply cannot use DDP on your account, or it could mean PayPal simply didn't activate it for you since PayFlow would be the assumed gateway. Technically, 2.0 should support both of those APIs.
If you call PayPal and let them know you already have DDP fully integrated and ready to go based on the fact that you had "Pro" enabled, and you would rather not re-develop everything in PayFlow due to time / cost restrictions, they will probably go ahead and enable DDP for you so that this error will go away.
Or, you could go ahead and use the PayFlow API instead. It looks like you might possibly be using my PayPal PHP SDK..?? If so, you could get PayFlow setup instead of DDP within a matter of minutes. If not, I recommend you take a look at it for future reference. It supports pretty much every PayPal API they offer and greatly simplifies things.
If you're interested in more details on this you can check out my article on The History of PayPal Payments Pro.

Paypal merchant paying facilitator

I have set up a sandbox test case whereby I allow merchants to link and grant express checkout permission to my facilitator account, coupled with a second page where end users can purchase items from the merchants accounts. The problem I am having is that on completion of an express checkout, the facilitator is receiving all the money instead of the merchant. The merchant receives the credit card payment but immediately pays the facilitator the full amount.
Using this guide: https://devtools-paypal.com/guide/expresscheckout/php?interactive=OFF&env=sandbox
I have then created an express checkout on behalf of the merchant account.
Auth details:
'mode' => 'sandbox',
'acct1.UserName' => 'dev-facilitator...',
'acct1.Password' => 'dev-facilitator_pw...',
'acct1.Signature' => 'dev-facilitator...',
'acct1.AppId' => 'APP-80W284485P519543T',
'acct1.accessToken' => $merchant_token,
'acct1.tokenSecret' => $merchant_secret
My code looks very similar to the example, with the assumption that the PaymentDetailsType passed through to DoExpressCheckoutPayment is that same as received from GetExpressCheckoutDetails
Everything appears to be working correctly except that when the users completes the payment the merchants paypal ends up looking like:
Purchase From, dev-facilitator, Completed, Details, -$250 NZD
Transfer From, Credit Card , Completed, Details, $250 NZD
With the final result being:
Dev-facilitator balance: $250 NZD
Dev-merchant balance: $0 NZD
I'm not sure where in the express checkout setup I should be specifying the kind of invoice the merchant should file against the facilitator in relation to the express checkout.
I can provide further code snippets if required.
It appears the core of my problem is the fact that accessToken and tokenSecret are ignored if acct1.Subject is not also supplied (The email associated with the accessToken).
The second thing that caused confusion is that I was not paying attention to what account my buyer action was being performed against... Logging into my merchant account changed the cookies that I was using in the other tab for doing the express checkout. Thus the merchant account ended up being the buyer, and the facilitator the merchant... The Purchase From, Transfer From, was just the way credit card transactions are shown: IE first the credit card gets converted into paypal money and then that is used in the paypal purchase transaction.
Thus,
'mode' => 'sandbox',
'acct1.UserName' => 'dev-facilitator...',
'acct1.Password' => 'dev-facilitator_pw...',
'acct1.Signature' => 'dev-facilitator...',
'acct1.AppId' => 'APP-80W284485P519543T',
'acct1.Subject' => $merchant_email,
'acct1.accessToken' => $merchant_token,
'acct1.tokenSecret' => $merchant_secret
Is what I should have supplied.

Sagepay Related Security Key Missing

I have found issues similar to this. But I wanted to explain my case as I haven't found a suitable answer.
I have my Ticketing System in which I have implemented Sage Pay. When I make a transaction it will get redirected to SagePay and the Transaction will be completed. Now If I want to refund the Payment I need to go to SagePay, login there, select the Order which has to refunded and then refund it. So instead I thought of implementing it in my Ticketing System. When the transaction is completed through SagePay a response code is generated which looks similar to this .
Array ( [VendorTxCode] => 14-11-04-16-19-30-8989049 [VPSTxId] => {8D7FC333-9979-DA1C-32E0-AAA2CC1A31FB} [Status] => OK [StatusDetail] => 0000 : The Authorisation was Successful. [TxAuthNo] => 164996 [AVSCV2] => SECURITY CODE MATCH ONLY [AddressResult] => NOTMATCHED [PostCodeResult] => NOTMATCHED [CV2Result] => MATCHED [GiftAid] => 0 [3DSecureStatus] => NOTCHECKED [CardType] => VISA [Last4Digits] => 0006 [DeclineCode] => 00 [Amount] => 10.00 [BankAuthCode] => 999777 )
Now in order to refund the transaction I need to have RelatedSecurityKey which is not being sent by SagePay. When I go to Sage Pay, get the Security Key and Hard code the value in my Refund API I am able to refund the Transaction. Is there any way to get the Security Key in my Ticketing System. If so how?
If you are using Server, you will get a security key as part of the response to the initial transaction registration post. You can then pass this back with the Refund posts as RelatedSecurityKey.
If you are using Form, you won't get this value sent back. In this instance, you could use the Reporting API to get the Security key (getTransactionDetail command) instead of logging into My Sage Pay.

Embedded Adaptive Payments for digital goods between 2 users - confused about the need for an IPN

I'm building a site for a client that wants to enable users on the site to put ebooks for sale, which can be bought by both site members and non-members. The site itself is not involved in the transaction at all.
I've gone with adaptive payments as that seems to facilitate "peer to peer" transactions between two users where the site is not involved and does not take a cut or any payment. I'm using the guide found at https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/integration-guide/APIntro/
Unfortunately the hosting uses php 5.2.17, which means I cant use the PHP API code on github, so i've had to roll my own using PHP. This isnt a problem, i've done similar many times before. I've managed to get the sandbox working the following way
user initiates purchase
my site makes a call to https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
with the following json encoded array :
$payload = array(
'actionType' => 'PAY',
'currencyCode' => $currencyCode,
'receiverList' => array(
'receiver' => array(
array(
'amount' => $amount,
'email' => $receiverEmail,
'paymentType' => "DIGITALGOODS"
)
)
),
'returnUrl' =>$successUrl,
'cancelUrl' => $cancelUrl,
'requestEnvelope' => array(
'errorLanguage' => 'en_US',
'detailLevel' => 'ReturnAll'
)
);
This gives me a pay ID
i then put into the form which submits to https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay
when the user clicks "Pay Now" the paypal light box pops up
if the payment is completed paypal returns me to my return url
i then display the download link
However when I look in the sandbox I see that The latest payments are under review ( apparently making my sandbox balance 10,000 has flagged me as a potential terrorist under australian law. go figure ) so this makes me think that perhaps I need to make an IPN, even though the developer documentation listed above makes no mention of it. The last thing i want to do is enable a download whos payment gets rejected.
So i guess my question is:
Is the fact that paypal called my return URL enough to allow the download of a digital good or should I setup an IPN and wait for paypal to hit it before authorising the download ?
PayPal is a PITA! And there's no argument about it.
Back to your question. You should verify if the payment when through when it calls your return URL. It should send you a token/transaction which you can query and check its payment status. Haven't used Adaptive Payments that much but you should always make sure a payment is completed before granting access.

Categories