ReturnURL opening in iFrame instead of reloading page - paypal

I am using Paypal Pros iframe implementation and all is working fine...
<iframe name="hss_iframe" width="570px" height="540px"></iframe>
<form style="display:none;" target="hss_iframe" name="form_iframe" method="post" action="https://securepayments.paypal.com/cgi-bin/acquiringweb?cmd=_hosted-payment">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="subtotal" value="50.00">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="business" value="KASDFS323234">
<input type="hidden" name="paymentaction" value="sale">
<input type="text" name="custom" value="<?php echo $_REQUEST['email_address']; ?>">
<input type="hidden" name="template" value="templateD">
<input type="hidden" name="notify_url" value="http://www.mydomain.com/notify.php" />
<input type="hidden" name="return" value="http://www.mydomain.com/thankyou">
</form>
My problem is that the return URL of www.mydomain.com/thankyou is opening up inside of the iframe instead of reloading the browser with that page.
Has anyone experienced a similar issue?

Related

Paypal BuyNow - GET instead of POST with params for returnUrl

I´m running into an issue that I detected today. I have the following paypal button config :
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" i d="paypalFormId">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="mybusinessID">
<input type="hidden" name="lc" value="DE">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="2">
<input type="hidden" name="item_name" value="MyProductName">
<input type="hidden" name="amount" value="1.00">
<input type="hidden" name="custom" value="somecustom infos needed in the redirection">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="return" value="https://myreturnurl.com">
<input type="hidden" name="cancel_return" value="https://mycancelurl.com">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="notify_url" value="myIPNUrl">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<div class="row">
<button type="submit" class="btn btn-submit-next pull-right">Bestellung abschließen</button>
</div>
I didn´t change anything that could impact this code in the last days, nevertheless, redirection POST parameters are missing and redirection is a GET now and not a POST method anymore, even with the rm=2 !
Any idea, what´s going on ?
Best regards,
Antoine
Edited :
I was able to isolate the issue on JSFiddle : if I remove the item_name input then it works. I have no clue why but maybe it helps you guy telling me what I do wrong !
We had the same problem.
You need to enable "PDT", then the custom field will be returned in the "cm" variable of the return url post.
"Auto Return" also needs to be enabled to use "PDT", but you can still set the return URL in the button form post instead of in the "Auto Return" config if you need it to be dynamic.
https://developer.paypal.com/docs/classic/products/payment-data-transfer/
Try out this sandbox pay button and see what the response looks like when it is recorded on our return URL.
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick"><input type="hidden" name="amount" value="0.67">
<input type="hidden" name="cancel_return" value="http://test.smsportal.co.za/onlinePaymentv2/Testing3rdPartyResponse.aspx">
<input type="hidden" name="custom" value="this is the custom variable. it is named 'cm' in the returned Url.">
<input type="hidden" name="return" value="http://test.smsportal.co.za/onlinePaymentv2/Testing3rdPartyResponse.aspx">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="cbt" value="Return to Merchant"> <input type="hidden" name="business" value="paypalmerchant#smsportal.com">
<input type="hidden" name="item_name" value="Credit Purchase">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services"><input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHostedGuest">
<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="Pay now"><img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1"></form>

Donation authorization not possible?

I am using HTML variables for PayPal Standard for my donation page. According to this page, it should be possible to set paymentaction=authorization
However, testing says otherwise. The transaction is shown as a completed donation on the recipient account instead of a a pending authorization:
Here are my html variables:
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Donation</title>
</head>
<body>
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="donateForm">
<input type="hidden" name="business" value="neil#example.com">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="notify_url" value="https://example.com/ipn.php">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="return" value="https://example.com/return.php">
<input type="hidden" name="image_url" value="">
<input type="hidden" name="lc" value="N/A">
<input type="hidden" name="paymentaction" value="authorization">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="amount" value="25">
<input type="hidden" name="item_name" value="Donation">
<input type="submit" value="Donate later!">
</form>
</body>
</html>
Any ideas?

PayPal redirect after payment

Hy,
I have a problem with a PayPal redirection after the payment. When the client is redirected to the confirmation page after the payment, in background I save the data into DB and I send an email with the invoice to the merchant and to the client.
For the redirection I user a return parameter with the value like this: http://domain.com/en/shop/shopping-cart/?wpcomethod=cosuccess&type=pp_pro&order_id=''
The order Id is a dynamic value.
But it's not working. And also I cannot put this url in the PayPal account preferences, because I have that dynamic id.
This is my form that is sent to PayPal:
<iframe name="hss_iframe" width="570px" height="550px" style="border:1px solid grey;box-shadow:0px 2px 8px 0.5px;position:relative;left:18%;"></iframe>
<form style="display:none" target="hss_iframe" name="form_iframe" action="https://securepayments.paypal.com/cgi-bin/acquiringweb?cmd=_hosted-payment'" method="post" id="pp-form">
<input type="hidden" value="1" name="upload">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="redirect_cmd" value="_hosted-payment">
<input type="hidden" value="business email" name="business">
<input type="hidden" value="business email" name="receiver_email">
<input type="hidden" value="templateD" name="template">
<input type="hidden" value="false" name="showHostedThankyouPage">
<input type="hidden" id="lc" value="US" name="lc">
<input type="hidden" id="hLang" value="en" name="lang">
<input type="hidden" value="test" name="item_name_1">
<input type="hidden" value="3341" name="item_number_1">
<input type="hidden" value="1" name="quantity_1">
<input type="hidden" value="1" name="num_cart_items">
<input type="hidden" value="5" name="subtotal">
<input type="hidden" value="1" name="no_note">
<input type="hidden" value="EUR" name="currency_code">
<input type="hidden" value="http://domain.com/en/shop/shopping-cart/?wpcomethod=billing" name="cancel_return">
<input type="hidden" value="http://domain.com/en/shop/shopping-cart/?wpcomethod=cosuccess&type=pp_pro&order_id=1116" name="return">
<input type="hidden" value="CLICK HERE TO COMPLETE YOUR ORDER NOW" name="cbt">
<input type="hidden" value="2" name="rm">
<input type="hidden" value="a%3A4%3A%7Bs%3A8%3A%22order_id%22%3Bs%3A4%3A%221116%22%3Bs%3A6%3A%22buynow%22%3Bs%3A1%3A%22N%22%3Bs%3A4%3A%22user%22%3Bs%3A27%3A%22wpco52ca49f594a4d2.97750046%22%3Bs%3A7%3A%22user_id%22%3Bs%3A1%3A%224%22%3B%7D" name="custom">
<input type="hidden" value="INV1116" name="invoice">
<input type="hidden" value="rtytester#yahoo.com" name="email">
<input type="hidden" value="1565556565" name="night_phone_a">
<input type="hidden" value="Test " name="first_name">
<input type="hidden" value="lesz" name="last_name">
<input type="hidden" value="asdsad 555" name="address1">
<input type="hidden" value="" name="address2">
<input type="hidden" value="asdasd" name="city">
<input type="hidden" value="" name="state">
<input type="hidden" value="454445445" name="zip">
<input type="hidden" value="FR" name="country">
<input type="hidden" value="1" name="ptype">
<input type="hidden" value="1" name="pnr">
<input type="hidden" value="5" name="ptotal">
<input type="hidden" value="0" name="pshipp">
</form>
Any sugestions?

Need to pass user input from 1 form to another on the same page

I am do not know .php at all but have a problem on one of my websites.
1. There are 2 forms for payment processing on a single page.
2. Each form has a separate submit button.
The problem.
I need to pass some of the user input from form one on to form two.
Note. this is on the same page.
Form 1
<input type="hidden" name="payfast_url" id="payfast_url" value="https://www."/>
<input type="hidden" name="merchant_id" id="merchant_id" value="xxxxx"/>
<input type="hidden" name="merchant_key" id="merchant_key" value="xxxxx"/>
<input type="hidden" name="return_url" id="return_url" value="payment_finished.html"/>
<input type="hidden" name="cancel_url" id="cancel_url" value="payment_cancelled.html"/>
<input type="hidden" name="notify_url" id="notify_url" value="/payment_notify.html"/>
<input type="hidden" name="item_name" id="item_name" value="Product name"/>
<input type="hidden" name="item_description" id="item_description"value="description"/>
<input type="hidden" name="email_confirmation" id="email_confirmation" value="1"/>
<input type="hidden" name="confirmation_address" id="confirmation_address" value=""/>
<input type="hidden" name="amount" id="amount" value="price" />
<input type="hidden" name="payment_id" id="payment_id" value="website_sales" />
<span class="formlable">Name</span><input name="name_first" id="name_first"type="text" value="" class="forminput"/>
<span class="formlable">Surname</span> <input name="name_last" id="name_last" type="text" value="" class="forminput"/>
<span class="formlable">E-Mail</span> <input type="text" name="email_address" id="email_address" value="" class="forminput"/>
<span class="formlable">Post Address</span> <input name="custom_str1" id="custom_str1" type="text" value="" class="forminput"/>
<span class="formlable">City</span><input name="custom_str2" id="custom_str2" type="text" value="" class="forminput"/>
<span class="formlable">Postal Code</span><input name="custom_str3" id="custom_str3" type="text" value="" class="forminput"/>
<input type="button" value="EFT Payment" onclick="quickPostPaymentToPayFast(document.getElementById('payfast_url').value);" id="button" method="post"/>
Form 2
<form name="CreditCards" action="https://www.mygate.co.za/.cfm" method="post"/>
<input type="hidden" name="Mode" id="Mode" value="0"/>
<input type="hidden" name="txtMerchantID" id="txtMerchant" value="xxxxxxx"/>
<input type="hidden" name="txtApplicationID" id="txtApplicationID" value="xxxxxxxx"/>
<input type="hidden" name="txtMerchantReference" id="txtMerchantReference" value="1234"/>
<input type="hidden" name="txtPrice" id="txtPrice" value="1234"/>
<input type="hidden" name="txtCurrencyCode" id="txtCurrencyCode" value="ZAR"/>
<input name="txtRedirectSuccessfulURL" value="success_failure.php" readonly="true" type="hidden"/>
<input name="txtRedirectFailedURL" value="success_failure.php" readonly="true" type="hidden"/ >
<input type="hidden" name="txtQty" id="txtQty" value="1"/>
<input type="hidden" name="txtItemDescr" id="txtItemDescr" value="descr"/>
<input type="hidden" name="txtItemAmount" id="txtItemAmount" value="449.00"/>
<input type="hidden" name="txtRecipient" value="<?php $_POST["name_first"]; ?>"/>
<input type="hidden" name="txtShippingAddress1" value="<?php $_POST["name_last"]; ?>"/>
<input type="hidden" name="txtShippingAddress2" value="<?php $_POST["email_address"]; ?>"/>
<input type="hidden" name="txtShippingAddress3" value="<?php $_POST["custom_str1"]; ?>"/>
<input type="hidden" name="txtShippingAddress4" value="<?php $_POST["custom_str2"]; ?>"/>
<input type="hidden" name="txtShippingAddress5" value="<?php $_POST["custom_str3"] ?>"/>
<input type="submit" id="button4" value="Credit card" />
</form>
name_first
name_last
email_address
custom_str1
custom_str2
Custom-str3
from the first form must be transfered into the second form as well
thanks
You should think of using some client-side JavaScript. I'd recommend using jQuery.
Not sure whether you have any experience in JS but that won't be very complex.
Basically, all you have to do is:
1) Read the value of the first input
email = $('#email_address').val()
2) Assign it to the other field (not sure what fields you want to assign)
$('#txtShippingAddress2').val(email)
Then just bind this code to your submit button or anywhere you need it.
You can find out more about jQuery at http://jquery.com/

Please return to the payment page and correct the address

i have an problem with integration of paypal sandbox for Australia.
in back end i enabled all tab except billing_phone number. when i click pay now i get following error Please return to the payment page and correct the address. here i am attaching my code. thanks in advance
<iframe name="hss_iframe" width="600px" height="600px" style="margin-top:-5px"></iframe>
<form style="display:none" target="hss_iframe" name="form_iframe" method="post" action="https://securepayments.sandbox.paypal.com/acquiringweb">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="currency_code" value="AUD">
<input type name="subtotal" value="71">
<input type="hidden" name="business" value="FK4PGWANVUF9C">
<input type="hidden" name="shipping" value="0">
<input type name="paymentaction" value="sale">
<input type="hidden" name="template" value="templateD">
<input type="hidden" name="invoice" value="12345">
<input type="hidden" name="billing_first_name" value="John">
<input type="hidden" name="billing_last_name" value="Due">
<input type="hidden" name="billing_address1" value="5 Cromwell St">
<input type="hidden" name="billing_address2" value="Glen Iris">
<input type="hidden" name="billing_city" value="Glen Iris">
<input type="hidden" name="billing_state" value="VIC">
<input type="hidden" name="billing_zip" value="3146">
<input type="hidden" name="buyer_email" value="mark#bssound.com.au">
<input type="hidden" name="billing_country" value="AU">
<input type name="return" value="https://122.165.58.219/team2/wpp-hosted/receipt_page.html">
</form>
<script type="text/javascript">
document.form_iframe.submit();
</script>
My code wasn't working either, but I didn't have the billing fields which I have now added and it worked.
I didn't have:
<input type="hidden" name="currency_code" value="AUD">
<input type="hidden" name="shipping" value="0">
Hope this helps anyone
I had the same problem. I resolved it by adding the same bunch of fields but without "billing_". In your case it will be:
<input type="hidden" name="first_name" value="John">
<input type="hidden" name="last_name" value="Due">
<input type="hidden" name="address1" value="5 Cromwell St">
<input type="hidden" name="city" value="Glen Iris">
<input type="hidden" name="state" value="VIC">
<input type="hidden" name="zip" value="3146">
<input type="hidden" name="country" value="AU">
I don't know whether it's important or not but I also removed both "billing_address2" and "address2".