I am trying to integrate paypal express checkout(test) with no luck. Not sure what i am doing wrong. I have followed the documentation but i get "This transaction is invalid. Please return to the recipient's website to complete your transaction using their regular checkout flow." when i try to redirect to the browser to the sandbox login page.
<form method=post action=https://api-3t.sandbox.paypal.com/nvp>
<input type=hidden name=USER value=j***-1_api1.g*******s.com.au>
<input type=hidden name=PWD value=Q8P*******U6>
<input type=hidden name=SIGNATURE value=AFc************fH>
<input type=hidden name=VERSION value=124.0>
<input type=hidden name=PAYMENTREQUEST_0_PAYMENTACTION
value=Sale>
<input name=PAYMENTREQUEST_0_AMT value=19.95>
<input type=hidden name=RETURNURL
value=http://localhost/moes/paypal_complete.php>
<input type=hidden name=CANCELURL
value=http://localhost/moes/paypal_complete.php>
<input type=submit name=METHOD id="submit_paypal" value=SetExpressCheckout>
</form>
have also tried this on my site live in case localhost is causing the troubles, but still the same.
The ACK response i get back is success:
TOKEN=EC-83V63085L7957480A
TIMESTAMP=20150901T14:14:08Z
CORRELATIONID=ffb632c840981
ACK=Success
VERSION=124.0
BUILD=000000
But when i use the redirectURL in the documentation with the token i get the invalid transcation error.
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&TOKEN=EC-83V63085L7957480A
I am logged into developer.paypal.com when i try it, still every time is an invalid transaction.
the URL of the invalid transaction:
//http://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_flow&SESSION=xa6gvld5X3qDZhYbt7pnz6rWMCzBdIFvAREoxohX4E5zH_3ydrzEQBnpQFW&dispatch=50a222a57771920b6a3d7b606239e4d529b525e0b7e69bf0224adecfb0124e9b61f737ba21b0819803370655d2811b9456e01fe893c80ec2
ideas?
You can get sample Express Checkout Code from the PayPal Wizard:
PayPal Express Checkout Code Wizard
<form action='expresscheckout.php' METHOD='POST'>
<input type='image' name='submit' src='https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif' border='0' align='top' alt='Check out with PayPal'/>
</form>
You will need to download the expresscheckout.php and the paypalfunctions.php files from the PayPal Code Wizard. Typically your PayPal API Signature goes in a separate php file. The paypalfunctions.php on the code wizard has the API credentials stored.
The below snippet is from the paypal.php file and it is the portion of the code for the sandbox endpoints.
if ($SandboxFlag == true)
{
$API_Endpoint = "https://api-3t.sandbox.paypal.com/nvp";
$PAYPAL_URL = "https://www.sandbox.paypal.com/webscr&cmd=_express-checkout&token=";
}
Also with Express Checkout you need to call Mark Express Checkout which is normally done in one of your PHP files.
You can get the complete php code from the code wizard.
Here is more documentation on Express Checkout from the PayPal Developer Site.
For anyone else reading this, i found that if i changed the redirectURL from:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&TOKEN=
to:
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_express-checkout&useraction=commit&token=
It redirects to the paypal(sandbox) log-in page as intended without error.
Hope this helps
Related
The 'Local development testing' section of PayPal's IPN Testing page implies that it is possible to test your IPN listener code via localhost, using a test page to simulate a message from PayPal.
My TestIPN.aspx page contains the following markup, which appears to follow the example provided by PayPal, but when I open it in Firefox under localhost (via Visual Studio 2019) and click the Submit Query button I get a 'File not found' error for https://localhost:44390/PayPal/IPNHandler.aspx.vb.
Needless to say, IPNHandler.aspx.vb does exist in my PayPal folder (using "PayPal/IPNHandler.aspx" in the form tag on my test page makes no difference). I also get the same error when I run it on my live site.
Any guidance on how to debug this problem would be much appreciated.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Test IPN message</title>
</head>
<body>
<!--
<form target="_new" method="post" action="https://www.YourDomain.com/Path/YourIPNHandler.php">
-->
<form target="_new" method="post" action="PayPal/IPNHandler.aspx.vb">
<input type="hidden" name="receiver_email" value="admin%40mysite.co.uk"/>
<input type="hidden" name="business" value="admin%40mysite.co.uk"/>
<input type="hidden" name="first_name" value="Fred"/>
<input type="hidden" name="last_name" value="Bloggs"/>
<input type="hidden" name="payer_email" value="fred.bloggs%40gmail.com"/>
<input type="hidden" name="address_city" value="Southampton"/>
<input type="hidden" name="payment_type" value="instant"/>
<input type="hidden" name="payment_date" value="19:54:19 Apr 12, 2021 GMT"/>
<input type="hidden" name="payment_status" value="Completed"/>
<input type="hidden" name="mc_currency" value="GBP"/>
<input type="hidden" name="mc_gross" value="5.00"/>
<input type="hidden" name="custom" value="25"/>
<input type="submit"/>
</form>
</body>
</html>
I get a 'File not found' error for https://localhost:44390/PayPal/IPNHandler.aspx.vb
Is that the correct port? What happens if you put https://localhost:44390/PayPal/IPNHandler.aspx.vb in the URL bar? Use a URL that works to the handler on your localhost, which does not return a 404. Set the action accordingly.
Consider something like https://ngrok.com for testing as well.
Why are you integrating IPN anyway? It's 20 or so years old, and not required for current PayPal Checkout integrations you should be using instead...
Follow the Set up standard payments guide and make 2 routes on your server, one for 'Create Order' and one for 'Capture Order', documented here. Both routes should return only JSON data (no HTML or text). Inside the 2nd route, when the capture API is successful you should store its resulting payment details in your database (particularly purchase_units[0].payments.captures[0].id, which is the PayPal transaction ID) and perform any necessary business logic (such as sending confirmation emails or reserving product) immediately before forwarding your return JSON to the frontend caller.
Pair those 2 routes with the frontend approval flow: https://developer.paypal.com/demo/checkout/#/pattern/server
Have been successfully using PayPal Cart buttons in PayPal Express for 2 years. Suddenly, when I click any "Cart button on my Store page, I get the dreaded ""Things don't appear to be working at the moment. Please try again later."
I tried the exact same transaction in the PayPal Sandbox and it processed fine. Now, however, that transaction draws the generic error page in "Live PayPal"
The only differences in the are in the action url, the business email, and the return url and store url:
Sandbox version of action attrbute:
<form id="form107" onsubmit="return CheckForm(this);"
action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_self">`
Live Version of action attribute:
<form id="form107" onsubmit="return CheckForm(this);"
action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_self">
(the javascript "CheckForm" function just checks data on the page to determine whether to show or hide a size dropdown)
The Sandbox integration URLs:
<input name="return" type="hidden" value="http://localhost:52980/Open/Congratulations/107/store">
<input name="shopping_url" type="hidden" value="http://localhost:52980/Store">
The "Live" integration URLS:
<input name="return" type="hidden" value="http://www.(mydomain).org/Open/Congratulations/107/store">
<input name="shopping_url" type="hidden" value="http://www.(mydomain).org/Store">
The code has worked up through 16 April 2018. No changes were made. As of 18 April 2018, we are now getting the PayPal generic error page upon clicking the Cart button
im trying to implement Paypal Payments Prop - transparent redirect.
Here are the steps that i perfom:
1) i send a request the payflow gateway i.e. https://pilot-payflowpro.paypal.com with some parameters like
SILENTTRAN=TRUE
CREATESECURETOKEN=Y
TRXTYPE=A
VERBOSITY=HIGH
TENDER=C
i get a proper response from the gateway.
for e.g.:
Array
(
[0] => RESULT=0
[1] => SECURETOKEN=1eh4ht2k4kUatSIjfqs0qzA4k
[2] => SECURETOKENID=ac31cb968d2902d4df3f10820f60f6fb
[3] => RESPMSG=Approved
)
2) Now since i want to perform a transparent redirect i will post the creditcard details directly to the payflow gateway using this form
<form action='https://payflowlink.paypal.com/' method='POST'>
<input type='hidden' name='MODE' value='TEST'>
<input type='hidden' name='SECURETOKEN' value='mysecuretoken'>
<input type='hidden' name='SECURETOKENID' value='mysecuretokenid'>
<label>Card Number</label> <input type='text' name='ACCT'>
<label>Code Code</label> <input type='text' name='CVV2'>
<label>Expiration</label> <input type='text' name='EXPDATE'>
<input type='submit' value='Make the transaction' />
</form>
but after posting this form im always being redirected to the ERRORURL that i specify in the first step.
what could be the probable mistake that im doing??
SOLVED :
there was nothing wrong in the code the mistake was done in testing. i was using my sandox account creditcard numbers to test but it doesn't work with sandbox accounts. you need to use the creditcard numbers mentioned in the integration document.
Are you referring to this integration document, https://developer.paypal.com/docs/classic/payflow/integration-guide/#testing-transactions ?
If so, it doesn't solve my problem.
I am trying to set up a subscription payment for Paypal. I am testing with the sandbox with the following code.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<br/>
<input type="hidden" name="cmd" value="_s-xclick"><br/>
<input type="hidden" name="hosted_button_id" value="3PFTX58KDNXHQ"><br/>
<input type="image" src="https://www.sandbox.paypal.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"><br/>
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"><br/>
</form>
Above code is a auto generated subxcription button code from my sandbox account.
It is working file with subscription in sandbox. I mean after the subscription complete it is showing right data in my sandbox account with the subscription information. But the problem is when the subscription is done and user got back to site is having a auth get parameter with it. like
http://my-site.com/this-subscribe-button-return-url.php?auth=[auth_code_from_paypal]&form_charset=UTF-8
Actually My return url is like the following
http://my-site.com/this-subscribe-button-return-url.php?status=success
I have my ipn enabled and its pointing to different url than return url.
What is this auth value? and what am I supposed to do with it?
I want the whole subscription data posted back when somebody completes his subscription process to a certain url (like notify_url). I have already set my notify_url in my ipn settings.
Please somebody give a proper solution to these problems. Thanks in advance.
How are you wanting to get the information back, or what method are you trying to use? If you wanting to get the information back and validate it, you want to use PDT. This will allow you to validate the information that is being sent over to you as well.
I am trying to implement Embedded chained payments.
I have downloaded PHP PayPal SDK and it works fine without embedded option. The problem comes when I try to do it embedded:
I get my payKey with sdk. It returns something like:
Pay - Response
responseEnvelope.timestamp: 2012-09-30T16:30:09.512-07:00
responseEnvelope.ack: Success
responseEnvelope.correlationId: 297f1e4a38b63
responseEnvelope.build: 3779320
payKey: AP-9EB01133M3012281Y
paymentExecStatus: CREATED
* Redirect URL to Complete Payment
(href of the link: https://www.sandbox.paypal.com/webscr&cmd=_ap-payment&paykey=AP-9EB01133M3012281Y)
Then, I copy the paykey (AP-9EB01133M3012281Y) and I paste on this html code:
<script type="text/javascript" src="https://www.paypalobjects.com/js/external/dg.js"></script>
<form action= "https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay" target="PPDGFrame">
<input id="type" type="hidden" name="expType" value="light"></input>
<input id="paykey" type="hidden" name="paykey" value="AP-3GH99339RW1696440"> </input>
<button id="submitBtn" value="Pay with PayPal"><p style="font-size:20px">Pay</button>
</form>
<script>var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submitBtn' });</script>
When I click the button, the iframe is shown right, but an error appears: "Transaction Cancelled. This function is temporarily unavailable".
If I click the cancel button, I am redirect correctly to my sdk page (the same if I wouldn't have do it embedded)
I am using sandbox.
Not setting the senderEmail when you create the PayRequest message should resolve the issue. It seems the PayPal embedded flow requires the buyer/sender to insert his/her email manually on PayPal.