How to test buyer side of a Credit Card transaction on PayPal Website Payments Pro? - paypal

We are running an e-commerce web site on Ruby on Rails and for the processing of Credit Cards we use the ActiveMerchant plugin to interface to our PayPal Website Payments Pro account using our API credentials.
As part of the checkout process we first call the authorize function on our gateway object and then, after some further checks, we perform the capture part.
We have lately been experiencing a bug where an amount gets reserved twice on a customer's account: one charge being only the authorization and the second being the final purchase. So to the client it looks like we are billing him twice (once for authorization, once for final purchase) while we are actually receiving the money only once and the "second charge" on his account is simply an authorization that we don't clear for some reason. (This seems to happen particularly when PayPal FMF rejects our transaction and we re-process.)
I am trying to troubleshoot this by creating PayPal Sandbox Accounts for Buyer and for Seller. I am running through the code line by line via Rails Console and simulating different conditions to try and replicate the error. However, my successful Credit Card transactions only appear in my "seller"/"merchant" account and not in the "buyer" account on the PayPal Sandbox so I cannot see what the effect of my code sequence is having on a customer's card. This post seems to indicate that that is just the way things are and that it is indeed not possible to test the effect on Buyer Credit Card side. This post suggests using PayPal Express Checkout but that is not what we need on our site as we're specifically looking at Credit Card transactions here that are integrated to our site.
How can I test the effect of my code on a client's Credit Card? Is there perhaps something I missed in PayPal or is there maybe some mode/log/monitor in ActiveMerchant that I can use to see this? I need to find the line of code that is causing us to authorize twice.

If the initial transaction is being rejected by FMF, and then you reattempt another transaction this would cause a second hold on the buyers card as this would be a completely different transaction attempt. The bank may have approved the first transaction, but then the FMF filters declined it based on your settings. As far as the bank is concerned, it is still a valid charge that was approved. So when you run your second attempt, this will cause a second hold on the card for the same amount but for a different transaction.

Related

Integration tests with PayPal

I would like to be able to test our integration with PayPal. We have sandbox accounts set up, etc, and I can even create payments. However, I'd like to be able to also issue refunds, query for refunds, and all the other APIs, all via integration tests and without human or even browser involvement. The difficult part seems to be that, of course, the PayPal flow requires someone to interact with a PayPal URL and approve the purchase.
Some more detail : We use the standard e-commerce flow on our site. User shows up, puts a product in a cart, proceeds to buy flow, selects a payment method, in this case PayPal. Of course, in PayPal's case, we create the Payment in PayPal and then simply show the embedded popup of palpal's flow where the user logs into their PayPal account and approves the purchase. PayPal does all this work. We simply get the response that 'yes, the purchase has been approved'.
So.. in an integration test environment, we can create the Payment entity in PayPal but.. how do we, in a sandbox environment integration test, get that payment approved? Is there a developer API available on the sandbox environment that says 'hey, this PayPal user approves this payment' or 'hey, this PayPal user rejects this payment', so that in test code we can simulate the buyer's flow. Or is there a way to set up a sandbox account to just 'auto approve' purchases or 'auto reject' purchases, simply for a test environment?
Yes, you can do anything in the sandbox that you can do on the live servers. This is a very broad question, though, so it's tough to answer.
For example, if you want to process payments without the need for any browser flow you'll need to have a billing agreement setup or a Pro transaction so you can run reference transactions. This would involve Express Checkout APIs and/or Payments Pro APIs, and reference transactions APIs. Depending on whether you're using Classic or REST, though, the API calls would be different.
In any case, once a transaction exists in the PayPal sandbox system you could then use the API to refund it. Same thing, though...you'd either be using REST APIs or Classic.
If you can provide more specifics in your question I can update this answer to be more specific as well.

Can i use pre-approval using PayPal website payments pro?

I am making a system in which user permits pre-approval of amount. I've used pre-approval with chained payment. But the problem is that my customer gets redirected to PayPal site and also he/she must have a PayPal account or need to create one. So can i make pre-approval payment using PayPal website payment pro? So my customers will not get redirected to PayPal account. And the process becomes more fast? Note :- I don't want to use authorization and capture method. Thanks.
Edit
One more question :- If i make the website in the UK and the currency in GBP, can I still use the American Paypal account for this?
Auth and Capture is what you're asking for, but then you say you don't want it..?? That's what gives you the functionality you're after, though.
You could do a $0 auth and then run DoReferenceTransaction when you're ready to process the payment as opposed to capturing an actual auth if you want.
Those are your only options when working with Pro, though, and it would give you the same sort of preapproval experience for the buyer.
Here are the steps to accomplish what you're after.
Use DoDirectPayment to run a $0 Authorization (card verification). Users will enter their credit card details directly into a form on your site without any redirection to PayPal (and without any knowledge PayPal is being used at all unless you notify them some way.)
Save the transaction ID that you get form this card verification into your transaction history for the customer in your database. This ID is what will be used to process future payments using that credit card.
When you're ready to process a payment for this customer, pull the ID out of the database and use it with a DoReferenceTransaction request to process any amount you need to.
So the card verification is your preapproval, and then running reference transactions are the same as running Pay requests with a Preapproval key. Both methods accomplish the same thing, but one is with direct credit cards and the other is not.
If you're using PHP you can use this PayPal PHP SDK to make all of the API calls very quick and easy for you. If you're using some other language then there are SDKs available for those as well I'm sure.
Please correct me if i am wrong, #Andrew Angell #Ved Pandya
Auth and Capture or Capture payments later method allows you to do direct payment, but it comes with additional charges, which might not suitable for crowdfunding model as refund/ cancel payment is very frequent
Auth and Capture: You are required to pay $0.30 for each "Card Verification Transactions"
Capture payments later: You are required to pay $0.30 for each "Uncaptured Authorization" that you triggered
https://www.paypal.com/us/webapps/mpp/merchant-fees

Successful payment in Paypal Sandbox even without funds

I'm currently trying my app to notify the buyer if he/she has no funds. But every time I use a paypal test account without funds, the payment still proceeds. What could be the cause of this error? I have negative testing on for my facilitator account.
If you have a credit card attached to the sandbox account it will use that as the funding source.
With negative testing, though, what you do is send a specific amount in the transaction request in order to get a specific error code back for testing.
See this documentation for more details.

Issues with processing PayPal Payment

We are using the secure token method to process credit card payments with PayPal hosted pages. We generate the secure token by providing the required information
[TRXTYPE=S, AMT=xxx, TENDER=C, ORDERID=xxxxxxxxxxxx, CURRENCY=USD, CREATESECURETOKEN=Y, SECURETOKENID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx, PARTNER=Paypal, VENDOR=xxxxxx, USER=xxxxxx, PWD=xxxxxx]
We get the success result as follows:
{"RESULT"=>"0", "SECURETOKEN"=>"xxxxxxxxxxxxxxxxxxxxxxxxx", "SECURETOKENID"=>"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", "RESPMSG"=>"Approved"}
We then send this back to PayPal where the user can choose to pay with credit card and or PayPal.
When someone pays with credit card, all is fine, when someone chooses to pay using "PayPal" it asks user for PayPal credentials and once provided it shows another screen to accept the charges. Once the user accepts, we get the following error message:
{"TYPE":"S","RESPMSG":"Original transaction ID not found: xxxxxxxxxxxx","TAX":"0.00","PNREF":"xxxxxxxxxxxx","TENDER":"P","AVSDATA":"XXN","METHOD":"P","SECURETOKEN":"xxxxxxxxxxxxxxxxxxxxxxxxx","AMT":"1.00","SECURETOKENID":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx","TRANSTIME":"2014-01-02 06:09:02","ORDERID":"xxxxxxxx36U1","RESULT":"19","DUPLICATE":"2","TRXTYPE":"S","action":"create","controller":"payment_notifications"}
The help I got from PayPal folks says "Looking at the logs it seems like the transaction was declined with the result code 19 which means that the transaction ID you entered for this transaction is not valid. When searched for the original transaction, I could not find any. So, it seems like the original transaction is not valid. Provide an valid original transaction ID and it should go through fine."
However nowhere in their documentation do they suggest to send this "transaction ID" variable and without it we have been processing Credit Card payments just fine.
My question:
What do i need to change in my process that I can accept Credit Card and PayPal payments?
Any help will be greatly appreciated.
It seems the issue was on PayPal side and they have yet to come back to us with an answer. Once thing which they do not openly advertise is that they have the ability to remove the Pay with PayPal button form the hosted pages so if someone else runs across the same issue they should ask PayPal to remove the Pay with PayPal button from their end, made sure to confirm that you are not disabling the service from express checkout just hiding the button.

PayPal Partial Authorizations Always Declined

Problem: I've implemented "partial authorizations" (pg 72) but whenever I try to run a transaction that could use it, the result is a decline.
Setup: I'm handling transactions with the API with PayPal Payment Pro Payflow Edition (aka, PayFlow Pro Gateway & PayPal Merchant Account).
Cards use in Transaction: Visa Gift Card & American Express Gift Card. This feature was made for gift cards and other prepaid products. Gift Cards are specifically cited in PayPal's documentation example.
Transaction Logs:
Here is the log for a declined partial authorization. The original amount requested is $25.00, even though this visa gift card only had $2.00 on it. I should have received a response with an approved amount for $2.00. Instead I got a decline.
-> PARTIALAUTH:Y TENDER:C ACCT:**** VERBOSITY:HIGH TRXTYPE:A EXPDATE:0618 AMT:25.00
<- RESULT:12 CARDTYPE:0 PROCAVS:G IAVS:N PROCCVV2:I EXPDATE:0618 RESPMSG:Declined: 15005-This transaction cannot be processed. LASTNAME:NotProvided ACCT:**** AMT:25.00 PNREF:************ AVSZIP:X AVSADDR:X HOSTCODE:15005 TRANSTIME:2012-12-14 12:43:04 CVV2MATCH:X
For comparison, when I run the same card for an amount that is less than what's on the card, it goes through no problem:
-> TENDER:C VERBOSITY:HIGH ACCT:**** AMT:.11 TRXTYPE:A EXPDATE:0618 PARTIALAUTH:Y
<- AMT:0.11 AVSZIP:X PPREF:***************** ACCT:**** AUTHCODE:111111 TRANSTIME:2012-12-14 12:41:46 LASTNAME:NotProvided IAVS:N PROCAVS:G RESPMSG:Approved PNREF:************ RESULT:0 EXPDATE:0618 PROCCVV2:I CARDTYPE:0 AVSADDR:X CVV2MATCH:X CORRELATIONID:*************
-> TENDER:C ORIGID:************ TRXTYPE:D
<- RESULT:0 PENDINGREASON:completed PNREF:************ FEEAMT:0.11 PAYMENTTYPE:instant RESPMSG:Approved PPREF:************ CORRELATIONID:*************
I believe the API calls should be and in fact are the same in both cases. The point of Partial Authorizations is that you don't know when you need it, so if you want it, it should be enabled for all transactions -- meaning you always append the two extra parameters of VERBOSITY=HIGH and and PARTIALAUTH=Y.
Any ideas why this isn't working. The feature is very important to my application and is one of the main reasons I'm using PayPal.
I hope I'm missing something simple, like a setting in manager.paypal.com.
From what I can see you're doing everything correctly. When something like this happens the only thing you can do is contact PayPal directly.
You can do so via www.paypal.com/mts or if you login to your PayPal account and go into the contact by phone section you should see a separate phone number for tech support directly.
I would recommend submitting a ticket to MTS and then also calling, but when you call, refer them to your ticket. They're going to want you to post one anyway, but if that's all you do it probably won't get answered for awhile, unfortunately. I've had good luck catching them on the phone, though, and can get things done much more quickly that way.
The only thing I can think of that might be an issue here is that you're using the PayFlow gateway with PayPal as your merchant. While the PayFlow gateway supports this, PayPal may not. It may only work if you're using a 3rd party merchant account on the PayFlow gateway.
That's something they will need to confirm or deny as I haven't specifically tested this myself, but again, I don't see that you're doing anything incorrectly.