Paypal merchant paying facilitator - php

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.

Related

PayPal sandbox accounts don't show transactions

I'm trying to test my PayPal-Express checkout and it looks like it works fine, but after the redirects there are no transactions in both of the accounts.
I know there is a similar question, but my config has the right credentials.
What I have:
Lumen app
Omnipay extension
sandbox buyer account - status: complete
sandbox shop account - status: complete
The Omnipay lib is configured with the credentials (username, password, signature) of the sandbox shop account
The purchase script looks like this:
$gateway = Omnipay::gateway('paypal');
$response = Omnipay::purchase([
'currency' => 'EUR',
'amount' => '100.00',
'returnUrl' => 'http://localhost:8000/return',
'cancelUrl' => 'http://localhost:8000/cancel',
])->send();
$response->redirect();
It's doing the redirect to PayPal, PayPal accepts then the payment with the buyers sandbox account and redirects me back to the returnUrl but both of the accounts have no balance changes and no transactions visible on their dashboard.
You're using PayPal express checkout to accept payment from your buyers. PayPal express checkout completes the payment in the 2 below steps:
SetExpressCheckout API: It initiates the payment & redirects the buyer to PayPal for approval. To know more, click here
DoExpressCheckoutPayment API: It completes the express Checkout transaction and transfers the amount from the buyer to the Merchant PayPal business account. To know more, click here
To resolve your issue, please check your code & call DoExpressCheckoutPayment API to complete the transaction and deduct the amount from the buyer's account.
If the issue still persists, contact PayPal MTS for better assistance.

Checkout directly in Credit Card and disable the email and password input

I'm using PayPal express checkout to ensure users pay directly by credit card on a landing page, but there are 2 fields I wish to remove, that is 'email' and 'password, I tried to insert the code below:
'METHOD'=> 'SetExpressCheckout',
'LANDINGPAGE' => 'Billing',
'BUYEREMAILOPTINENABLE' => 0,
For some reason even after I disable BUYEREMAILOPTINENABLE, the fields still appear. I can't make them disappear.
I think you're confusing Express Checkout with Payments Standard. Express Checkout cannot take credit cards directly, only PayPal Account payments (which might come from a credit card but you can't tell that)
https://developer.paypal.com/docs/classic/express-checkout/integration-guide/ECGettingStarted/
The Express Checkout button gives buyers another way to pay, and it complements your existing payment solution. Online shoppers appreciate the convenience and security of PayPal, where they can pay with their PayPal balance, bank account, or credit card. The following web page shows the Express Checkout button side-by-side with an existing checkout button.
The option you're trying to set doesn't even do what you're describing
https://developer.paypal.com/docs/classic/api/merchant/SetExpressCheckout_API_Operation_NVP/
BUYEREMAILOPTINENABLE
(Optional) Enables the buyer to provide their email address on the PayPal pages to be notified of promotions or special events.

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

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.

PayPal Parellel payments and refunds

I have a question regarding Parallel payments and refunds. We are developing an application that sets up a Parallel payment, with ourselves as the My Store receiver and the provider of the service as the seller receiver. We provide a mechanism for the secondary receiver to refund the complete payment.
(source: ohozaa.com)
What we want to know is what happens when the seller receiver has no funds in their paypal account? From testing this in the sandbox and from what we've read, it seems that the seller receiver component of the refund becomes pending (we assume, as funds are pulled down from an associated bank account). Three things:
Has the My Store receiver paid the refund in full and is now waiting to get the payment from the seller receiver. Implying that, at this point in time, the My Store receiver is out of pocket?
What happens if funds cannot be pulled down from the seller receivers associated bank account?
What happens if we attempt a refund from an unverified user with no funds in their paypal account? Once again, does the My Store receiver pay the refund in full and hope to collect the seller receivers portion when they do have funds?
Unless I am misunderstanding the situation there are three possible questions/outcomes.
You submit a payment to pay mystore#test.com 10 dollars and seller1#test.com 90 dollars for a total of 100 dollars:
https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
'currencyCode' => 'USD',
'actionType' => 'PAY',
'receiverList.receiver(0).email' => 'mystore#test.com',
'receiverList.receiver(0).amount' => '10',
'receiverList.receiver(1).email' => 'seller1#test.com',
'receiverList.receiver(1).amount' => '90',
'requestEnvelope.errorLanguage' => 'en-US',
buyer#test.com wants a refund:
1) If you have API permission to submit refunds for seller1#test.com you can refund his part of the transaction as well as yours. You do this by passing the receiverList variables:
https://svcs.sandbox.paypal.com/AdaptivePayments/Refund
'payKey' => $thepaykey,
'receiverList.receiver(0).email' => 'mystore#test.com',
'receiverList.receiver(0).amount' => '10',
'receiverList.receiver(1).email' => 'seller1#test.com',
'receiverList.receiver(1).amount' => '90',
'requestEnvelope.errorLanguage' => 'en_US',
'currencyCode' => 'USD',
1.1) mystore#test.com and seller1#test.com both have the funds, they are refunded immediately.
1.2) mystore#test.com has the funds, but seller1#test.com does not. An eCheck is submitted from seller1#test.com's bank account to pay for the refund, and the status will be PENDING until it clears from the bank. mystore#test.com has only paid buyer#test.com 10USD. buyer#test.com will have two transactions, one for 10USD that is completed, and one for 90USD that is pending. If the 90USD transaction fails, PayPal will try a second time to represent to the bank. If it fails again, seller1#test.com's transaction should go into a FAILED status and may not be refunded via the transaction. The only way to refund this transaction would be to do a send money.
2) If you do not have API permission to submit the refunds for seller1#test.com you will not be able to pass his receiver in the request. If you do, the whole refund will fail. You cannot exceed the amount you were originally paid (10USD)
3) If the seller1#test.com is not confirmed, or does not have an account created in paypal/sandbox, the transaction will be PENDING , and while it is pending the buyer can click cancel next to the transaction. You may also cancel the transaction before it shows COMPLETED by submitting a refund for their amount.
If this was a chained payment it may have a different outcome.

Paypal charge via recrurring payment?

In my online store i'm going to manage subscription for the products. Every product can be subscribed for some period of time, weekly, biweekly, monthly, semiannually. I'm going to use PayPal PayFlow Pro and PayPal Website Payments Pro gateways to recieve payments.
The issue is here how to manage getting recurring payments through this payment gateways? Any php code or smth else?
Here I'm including how this process works:
1. Customer adds reqiored products in his shopping cart.
2. In the cart there is a selectbox per every product for subscription.(options: just this one time, dayly, weekly...)
3. Customer checks out from the site paying with Credit/Debit card or PayPal account.
Question: How to charge automatically charge the fee for subscription in the selected period?
Why would you use Website Payments Pro and Payflow Pro? They're essentially the same (although Payflow Pro requires you to sign up for a merchant account, whereas Website Payments Pro doesn't).
What you need to do is:
Sign up for PayPal Website Payments Pro (US, UK and Canada only).
Once approved, sign up for Direct Recurring Payments
Once approved, start integrating with PayPal via the DoDirectPayment API (one-off payments) and CreateRecurringPaymentsProfile (recurring payments).
DoDirectPayments lets you add in card details via the CREDITCARDTYPE, ACCT, EXPDATE and CVV2 parameters. This lets you charge buyers for one-off payments.
If you wish to set up recurring payments, you would use the CreateRecurringPaymentsProfile API instead.
This also lets you specify card details as detailed above, but in addition will let you specify terms for a recurring term on which the payment must recur.
For example; an example API call for CreateRecurringPaymentsProfile would look as follows:
USER=Your API username
PWD=Your API password
SIGNATURE=Your API signature
VERSION=84.0
METHOD=CreateRecurringPaymentsProfile
DESC=Monthly recurring payment for MyStore Ltd
BILLINGPERIOD=Month
BILLINGFREQUENCY=12
TOTALBILLINGCYCLES=0
AMT=9.99
TRIALBILLINGPERIOD=Day
TRIALBILLINGFREQUENCY=7
TRIALTOTALBILLINGCYCLES=1
TRIALAMT=0.99
CURRENCYCODE=GBP
CREDITCARDTYPE=Visa
ACCT=4556699176680030
EXPDATE=122012
CVV2=000
EMAIL=buyer#buyeremail.tld
STREET=12 Street
CITY=Beverly Hills
STATE=CA
ZIP=90210
COUNTRYCODE=US
This will set up a recurring payment profile which PayPal will bill for 9.99 GBP monthly, with a 7 day trial period of 0.99 GBP and run indefinitely. Once the API call is run, it will return a PROFILEID in response and the buyer will be charged 0.99 GBP. He will be charged 9.99 GBP after 7 days.
You must store this PROFILEID on your end, as this is the unique identifier which refers to this profile.
If you wish to test CreateRecurringPaymentsProfile, sign up at https://developer.paypal.com/ and create a preconfigured US, Website Payments Pro test account, and ask PayPal MTS over at https://www.paypal.com/mts to activate CreateRecurringPaymentsProfile for your test account (be sure to include the API username, but not any other API credentials).

Categories