PayPal redirect after payment - paypal

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?

Related

Paypal Hosted language bug. Based on 'country' instead of 'lc' for Paypal Express button

Create a paypal hosted form using the templateD option with lc="GB" but shipping country of another language than English (like NL)
When given the option to pay with Paypal Express or credit card, choose the Paypal express option.
When redirected to paypal, the paypal login form is shown in dutch because it is using the "country" value instead of the "lc" value. I've confirmed this by forcing "GB" in the country value.
Here's the html form:
<form action="https://securepayments.paypal.com/webapps/HostedSoleSolutionApp/webflow/sparta/hostedSoleSolutionProcess" method="post" id="checkout-form">
<input type="hidden" name="cmd" value="_hosted-payment">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="shipping" value="4.13">
<input type="hidden" name="tax" value="0.83">
<input type="hidden" name="subtotal" value="22.98">
<input type="hidden" name="business" value="xxx#xxx.com">
<input type="hidden" name="currency_code" value="GBP">
<input type="hidden" name="showShippingAddress" value="true">
<input type="hidden" name="first_name" value="test">
<input type="hidden" name="last_name" value="test">
<input type="hidden" name="address1" value="123 Test">
<input type="hidden" name="address2" value="">
<input type="hidden" name="city" value="Laren">
<input type="hidden" name="zip" value="1251TM">
<input type="hidden" name="country" value="NL">
<input type="hidden" name="state" value="Noord Holland">
<input type="hidden" name="night_phone_b" value="252525">
<input type="hidden" name="billing_first_name" value="test">
<input type="hidden" name="billing_last_name" value="test">
<input type="hidden" name="billing_address1" value="123 UK Street, Suite UK1">
<input type="hidden" name="billing_address2" value="">
<input type="hidden" name="billing_city" value="Aberdeen">
<input type="hidden" name="billing_zip" value="AB10">
<input type="hidden" name="billing_country" value="GB">
<input type="hidden" name="logoImage" value="https://www.specialistsupplements.com/image/data/specialist-supplements-logo.png">
<input type="hidden" name="billing_state" value="Aberdeen">
<input type="hidden" name="showBillingPhone" value="false">
<input type="hidden" name="showHostedThankyouPage" value="false">
<input type="hidden" name="buyer_email" value="test#test.com">
<input type="hidden" name="invoice" value="123">
<input type="hidden" name="lc" value="GB">
<input type="hidden" name="charset" value="utf-8">
<input type="hidden" name="address_override" value="false">
<input type="hidden" name="paymentaction" value="sale">
<input type="hidden" name="return" value="xxxx">
<input type="hidden" name="notify_url" value="xxxx">
<input type="hidden" name="cancel_return" value="xxxx">
<input type="hidden" name="custom" value="123">
<input type="hidden" name="template" value="templateD">
</form>
The "lc" code in this is "GB" which is what should force "English". The problem is a person who does not read dutch may want to send an item to a friend in another country and will not be able to read the payment options. At the very least it should be using the billing_country value, but ultimately use the lc code as that is its intended use.
I found that PayPal was ignoring the lc and billing_country fields.
In my case, both were set to CA, but upon arrival at PayPal, it would always show United States for the billing country, not Canada.
The workaround I found is to set:
<input name="landing_page" value="billing" type="hidden">
After I set this variable, PayPal stopped ignoring the billing_country field.

Paypal ipn catch payment cancel event

I am trying to do the following: When the user selects some items and click "Pay Now" button on our website, I mark the selected items status as "on hold" so no one else can select these items. If I receive "complete" from ipn I will mark the items as "purchased" and do other database change. If I receive "canceled" from ipn I will mark the "on hold" items back to "available".
It works fine when the user did make the payment (complete). However, if the user exit the payment flow (for example just close the browser tab) I didn't receive any messages. I am not sure why this is happening. Or the ipn just wouldn't give a message if the transaction is not complete?
Here is the code of the paypal button:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="upload" value="1">
<input type="hidden" name="business" value="********-facilitator#gmail.com">
<input type="hidden" name="env" value="www.sandbox">
<input type="hidden" name="address_override" value="1">
<c:set var="index" value="${1}"/>
<c:forEach items="${items}" var="item">
<input type="hidden" name="item_name_${index}" value="${item.title}">
<input type="hidden" name="amount_${index}" value="${item.askPrice}">
<input type="hidden" name="tax_${index}" value="$<fmt:formatNumber type="number" maxFractionDigits="2" value="${item.askPrice * taxRate}" />">
<c:if test="${index == 1}">
<input type="hidden" name="shipping_${index}" value="$<fmt:formatNumber type="number" maxFractionDigits="2" value="${shipmentFee}" />">
</c:if>
<c:set var="index" value="${index + 1}"/>
</c:forEach>
<c:remove var="index"/>
<!-- Fill full name in the first_name field -->
<input type="hidden" name="first_name" value="${info.recipient}">
<input type="hidden" name="notify_url" value="<c:url value="https://********.localtunnel.me/payment/paypal/ipn"></c:url>">
<input type="hidden" name="address1" value="${info.addressLine1}">
<input type="hidden" name="address2" value="${info.addressLine2}">
<input type="hidden" name="city" value="${info.city}">
<input type="hidden" name="state" value="${info.state}">
<input type="hidden" name="zip" value="${info.zip}">
<input type="hidden" name="country" value="US">
<input type="hidden" name="email" value="${info.email}">
<input type="hidden" name="custom" value="${flowId}">
<input type="image" name="submit" border="0"
src="https://www.paypalobjects.com/webstatic/en_US/i/buttons/checkout-logo-large.png" alt="Check out with PayPal">
</form>

return URL for non-paypal user

will a person that pays with their credit card (not associated with a PayPal account) go to the return URL below...if not where do they go?
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="something">
<input type="hidden" name="lc" value="US" />
<input type="hidden" name="upload" value="1" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="invoice" value="900000000">
<input type="hidden" name="item_name_1" value="mem" />
<input type="hidden" name="item_number_1" value="1">
<input type="hidden" name="amount_1" value="0">
<input type="hidden" name="item_name_2" value="CP" />
<input type="hidden" name="item_number_2" value="2">
<input type="hidden" name="amount_2" value="10"/>
<input type="hidden" name="item_name_3" value="AD" />
<input type="hidden" name="item_number_3" value="3">
<input type="hidden" name="amount_3" value="0">
<input type="hidden" name="return" value="https://www.something.com/ppd.aspx?TransID=<%=request.querystring("IDUNNO")%>
<input type="hidden" name="cancel_return" value="https://www.something.com/ppc.aspx">
<input type="hidden" name="modify" value="0">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="undefined_quantity" value="1">
<input type="image" src="images/btn_paynow.gif" border="0" name="submit" alt="use PayPal!">
</form>

How to create PayPal subscription form with billing address?

I am trying to create a PayPal subscription form with billing address but it doesn't work, I'm unable to figure out the problem, please have a look at this form.
<form name="_xclick" action="https://www.sandbox.paypal.com/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick-subscriptions" />
<input type="hidden" name="business" value="business.account#test.com" />
<input type="hidden" name="currency_code" value="USD" />
<input type="hidden" name="no_shipping" value="1" />
<input type="hidden" name="item_name" value="Baseball Hat Monthly" />
<input type="hidden" name="item_number" value="123" />
<input type="hidden" name="a3" value="5.00" />
<input type="hidden" name="p3" value="3" />
<input type="hidden" name="t3" value="M" />
<input type="hidden" name="src" value="1" />
<input type="hidden" name="sra" value="1" />
<input type="hidden" name="return" value="http://www.example.com/thankyou" />
<input type="hidden" name="cancel_return" value="http://www.example.com/cancel" />
<input type="hidden" name="notify_url" value="http://www.example.com/ipn" />
<input type="hidden" value="Colorado Springs" name="city" id="city">
<input type="hidden" value="US" name="country" id="country">
<input type="hidden" value="personal.account#test.com" name="email" id="email">
<input type="hidden" value="Tahir" name="first_name" id="first_name">
<input type="hidden" value="Yasin" name="last_name" id="last_name">
<input type="hidden" value="80903" name="zip" id="zip">
<input type="hidden" value="CO" name="state" id="state">
<input type="hidden" value="219 W. Colorado Avenue Suite 200" name="address1" id="address1">
<input type="hidden" value="" name="address2" id="address2">
<input type="hidden" value="1" name="address_override" id="address_override">
<input type="submit" name="submit" value="Subscribe" />
</form>
You can see address_override attribute is set to 1 but when I see the order detail in my PayPal business account, it doesn't show me the submitted address but shows following notice.
When you have "no_shipping=1" set you aren't requiring a shipping address for the transaction so that is why the address doesn't appear during the checkout process and in the transaction details.
I changed it to both "2" and "0" but the address didn't appear after I logged into a test account - like it should. If I switch the button type to be "_xclick" with "no_shipping=2" the address does appear correctly.
I'll file a ticket with the engineers to get this resolved for Subscription buttons.

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".