I'm fighting against Paypal.
I'm trying to use 'return' variable but for some reason it did not work.
The documentation says:
return
The URL to which PayPal redirects buyers' browser after they complete their payments. For example, specify a URL on your site that displays a "Thank you for your payment" page.
Default – PayPal redirects the browser to a PayPal webpage.
rm
Return method. The FORM METHOD used to send data to the URL specified by the return variable.
Allowable values are:
0 – all shopping cart payments use the GET method
1 – the buyer's browser is redirected to the return URL by using the GET method, but no payment variables are included
2 – the buyer's browser is redirected to the return URL by using the POST method, and all payment variables are included
So I decide add to my form:
<input type="hidden" name="return" value="http://www.site.com/payment_confirm.php" />
<input type="hidden" name="cancel_return" value="http://www.site.com/back" />
<input type="hidden" name="rm" value="2" />
But for some reason at the end of the payment nothing happens.
So I try to search on google why this could be and some people wrote to active the automatic redirect to a page at the end of transaction from profile.
So I went in the profile page and setted up the auto return to
www.site.com/
When I tryed again after the transaction paypal return me in the profile url and not in the url written in the form AND there are some data in the URL so the form hasn't use the POST method.
My ideas is over.
How can I solve this problem?
Related
I'm searching for example of implementation for Recurlyjs normal Paypal checkout flow. I suppose to request Billing info from the user besides Paypal token but it's not clear how do I merge them together to use.
Here are docs mentioning normal workflow but no details: https://docs.recurly.com/docs/paypal-payments
Here is example of Paypal express flow:
https://github.com/recurly/recurly-js-examples/blob/master/public/paypal/index.html . It looks like I need to add [additional-fields] to the form and merge_token_fields, but I can not find appropriate function.
<section>
<form method="post" action="/api/subscriptions/new">
<button id="subscribe">Subscribe with PayPal</button>
<div name="recurly-[additional-fields]></div> // TODO: fix this
<input type="hidden" id="recurly-token" name="recurly-token">
</form>
<script>
var form = $('form');
recurly.configure('PUBLIC_KEY');
var paypal = recurly.PayPal({
display: { displayName: 'My product' }
});
paypal.on('token', function (token) {
$('#recurly-token').val(token.id);
merge_token_fields(); // TODO: fix this
form[0].submit();
});
form.on('submit', function (event) {
event.preventDefault();
paypal.start();
});
</script>
</section>
The steps you'd want to follow:
1) Get Paypal token
2) Collect billing address (can be done on the recurly.js form and passed to the API)
3) From API, pass the Paypal billing agreement to the account
4) A subsequent request to pass billing address to account as a billing info update
Beginning Wednesday, March 27th, we encountered a problem testing PAY transactions in the Sandbox Adaptive Payment (Classic API) environment. Our last successful test was on Tuesday March 26th. We made no code or environment changes that would have affected our sandbox test transactions during that timeframe.
The problem we are experiencing is that the PayPal lightbox will not load after our application contacts the sandbox Adaptive Payment environment. At the point we try to invoke the lightbox, we have obtained a paykey. You can see the URL we are contacting, and a paykey value, in the screenshots of the error consoles in Firefox and Chrome attached.
The browser error console shows "404 – not found" error when we send a request to PayPal with a paykey. There are no other javascript errors on the page other than those generated by the request to Paypal. Is the "404 – not found" error related to the PayKey value we got back from the sandbox on the initial request? If so, why are the Paykeys suddenly not valid, when they were fine before?
The App ID we are using for the Adaptive Payment sandbox is: APP-80W284485P519543T Is this the correct App ID for the "new" sandbox environment?
We are using the UserID, password and signature from a verified US Business account set up in the Classic API sandbox.
<form id="lightbox_form" action="https://www.sandbox.paypal.com/webapps/adaptivepayment/flow/pay" target="PPDGFrame">
<input id="type" type="hidden" name="expType" value="lightbox">
<input id="type" name="autoredirectondone" type="hidden">
<input type="hidden" name="paykey" id="paykey" value="[paykey is inserted here]">
<input name="submit_order" id="submit_order" type="submit" class="common_input_button" value="Submit Order">
</form>
<script type="text/javascript" src="https://www.paypalobjects.com/js/external/dg.js">
</script>
<script>
var dgFlow = new PAYPAL.apps.DGFlow({ trigger: 'submit_order' });
</script>
Your form action is pointing to an old URL.
The new URL for sandbox Adaptive Payments is:
https://svcs.sandbox.paypal.com/AdaptivePayments/Pay
See: https://developer.paypal.com/webapps/developer/docs/classic/adaptive-payments/gs_AdaptivePayments/
I'm using spring security for normal login form, where users register and then enter their username and password to login. I'm using login with facebook and login with google options, I'm able to authenticate users and finally get user's info like email, first name, last name etc, After logging into either fb/google I'm using fb/google user email(unique) as user name and system generated password as login credentials so that these values will be entered automatically to spring security login form and then if I click on submit button he/she will be able to login and then session handling will be taken care by spring security as in case of normal user who registers in my website.
Since, all the steps described above are automated except last step i.e. submitting the form
I want to automate the last step also using either javascript or JSP. i tried submitting the form using javascript inside JSP but its unable to
<%
if(Success_login_with_facebook/Success_login_with_google)
{
email = fb_email/google_email;
Sql query to get username and password from db using email;//unique row will be returned
uname_db = username;
uname_pass = password;
out.println("<script>document.forms('login').submit();</script>");
}
%>
<div id="autologin" style="display:none">
<form name="f" id='login' action="<c:url value='j_spring_security_check'/>" method="POST" >
User ID <input size=35 type='text' id="first" name='j_username' value='<%=uname_db %>'/>
Password<input size=35 type='password' name='j_password' value='<%=pass_db %>'>
<input type="hidden" name="_spring_security_remember_me" value=true>
<input style="height:30px" name="submit" type="submit" value="Sign In">
</form>
</div>
Your solution should work, but it's missing one thing. You need to make sure that the form exists before trying to submit it wis JavaScript. In your example, you're doing an out.println above the form. Move this to below the form, and the JavaScript should work fine.
The reason why it did not work is because the html form has submit button name as "submit", and if we try to run the javascript document.forms['login'].submit(); it will not submit the form. If the form submit button name is other than 'submit' then it will work.
MVC 3 VB.NET applicaiton... Using express checkout with html razor view. I have tried everything mentioned in all of the docs i could google for as well as the ones on paypal's dev network. Our Paypal account is setup to allow users to Check out as Guest without requiring paypal account creation or login. However when users are taken to the paypal site after clicking the checkout button there is no option to check out as guest. I am including my checkout view for reference. Please understand that this is a valid question and do not down vote it. If there is something not clear I will clarify it..
#modeltype xxxxxxx.orderVM
#Code
ViewData("Title") = "CheckOut"
End Code
<p style="text-align:center">Once you complete your transaction you will be redirected back to the site</p>
<p></p>
<p style="text-align:center">We will process your payment within 24 hours at which time you will recieve a confirmation email which you will need for addmission. Along with a PDF attachment in this email which is your parking permit.. Please print and follow the instructions</p>
<p></p>
<p></p>
<p></p>
<p></p>
<p style="text-align: center"> Please Click on the paypal button below to be redirected to the PayPal Site to complete the payment Transaction</p>
<form id="PayPal" name="PayPal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
#Html.Hidden("cmd", "_cart")
#Html.Hidden("upload", "1")
#Html.Hidden("business", ConfigurationManager.AppSettings("PayPalMerchantEmail"))
#Html.Hidden("page_style","primary")
#Html.Hidden("custom", Model.id.ToString)
#Html.Hidden("image_url", "http://www.xxxxxxxxxx.com/content/images/xxxxxxxxLogo.jpg")
#Html.Hidden("cpp_header_image", "http://www.xxxxxxxx.com/content/images/xxxxxxxLogo.jpg")
#Html.Hidden("cpp_logo_image", "http://www.xxxxxxxxxxe.com/content/images/xxxxxxxLogo.jpg")
#Html.Hidden("return", "http://www.xxxxxxxxxx.com/")
#Html.Hidden("cancel_return", "http://www.xxxxxxxxxx.com")
#Html.Hidden("first_name", Model.first_name)
#Html.Hidden("last_name", Model.last_name)
#Html.Hidden("address1", Model.address1)
#Html.Hidden("address2", Model.address2)
#Html.Hidden("city", Model.city)
#Html.Hidden("state", Model.state)
#Html.Hidden("zip", Model.zip)
#If Not String.IsNullOrEmpty(Model.Class1) Then
#Html.Hidden("item_name_1", Model.Class1)
#Html.Hidden("amount_1", Model.fee1)
#Html.Hidden("quantity_1", ViewBag.quan)
#Html.Hidden("shipping_1", " 0.00 ")
#Html.Hidden("handling_1", " 0.00 ")
End If
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" align="middle" style="text-align:center"/>
</form>
I do not feel the code for the controller is required here since it does pass all the values correctly into the view... The only issue is I can not get check out as guest working...
Have you turned on 'Account Optional' in your PayPal Profile?
Which country is your account located in? The guest checkout functionality is not available in all countries yet.
Strangely the documentation on the Paypal site does not cover this very well.
We have a payment button that redirects to Paypal to process a payment.
We also have an IPN server running that catches paypal payments once they're made.
However, where can we place the "user id" of our system user in the paypal button, so that it will be forwarded to the IPN request in order to match the user up on our system that they have paid. Paypal seems to want people to do this manually, which is a real mission.
I'm currently doing some PayPal integration and I concur their documentation is a mess!
I finally found a guide somewhere that details which variables of a PayPal button form are forwarded to the IPN callback. You can use the variable item_name to forward a user id:
<input type="hidden" name="item_name" value="{user id}">
You should use:
<input type="hidden" name="item_number" value="{user id}">
and here is the documentation:
https://www.paypalobjects.com/IntegrationCenter/ic_std-variable-ref-buy-now.html
As said in the doc (https://developer.paypal.com/docs/classic/ipn/integration-guide/IPNandPDTVariables/)
in your form :
<input type="hidden" name="custom" value="<?php echo $id ?>">
and get it with ipn :
$_POST['custom']
For anyone trying to get this working for Paypal SmartButtons, you should do something like this:
return actions.order.create({
purchase_units: [{
invoice_id: 'your_custom_stuff1',
custom_id: 'your_custom_stuff2',
amount: {
value: '100'
}
}]
});
IPN will sent it as POST data, for example in PHP:
$_POST['invoice']; // 'your_custom_stuff1'
$_POST['custom']; // 'your_custom_stuff2'