I am trying to get custom date to pass to PayPal - php

I am trying to get this line of product info here to pass into PayPal form using the custom varible <input type="hidden" name="custom" value="SansburyTech|Purchase of a ToolCart|Dewalt Roller|SKU:164604646|Cost:163.50"> but its not happening?
Is there something I am doing wrong or overlooking? Here on PayPalDocs it says specifically: The following are pass-through variables: custom or item_number or item_number_x or invoice
Here is my complete HTML Paypal form as an example;
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin:0;padding:0;" target="PayPal">
<input type="hidden" name="business" value="">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="Toolcart">
<input type="hidden" name="item_number" value="Dewalt Roller">
<input
type="hidden"
name="custom"
value="SansburyTech|Purchase of a ToolCart|Dewalt Roller|SKU:164604646|Cost:163.50">
<input type="hidden" name="amount" value="244.50">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="receiver_email" value="">
<input type="hidden" name="return" value="https://toolcart.info/pickup">
<input type="hidden" name="no_note" value="0">
<input type="image" src="/wp-content/themes/toolcart-theme/images/paypal.png" class="img-fluid" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Will be incredibly grateful for any answers!
~ Thank-you!

Converting my comment to an answer (for that sweet sweet karma).
The OP was looking for the custom variable to appear in the PayPal-generated e-mail messages that get sent back to the merchant account-holder (or to the customer). This won't work because PayPal does not include the custom variable in any e-mail messages: it's only included in IPN messages.

Usually the best solution is to pass only a unique identifier and store the rest in own your database.
But if you must pass multiple values in the arbitrary custom field, the pipes in your example seem problematic. Use base64 encoding or a different delimiter--JSON format is a common choice here, then you can simply decode it into an array when receiving the IPN.

Related

Error on Buy Button (Paypal Integration Gateway in CodeIgniter)

I'm using a CodeIgniter 3 and I'm having a hard time on implementing the paypal integration on my website . For now I'm trying it on the sandbox and followed this tutorial Paypal Integration Using CodeIgniter
Now the problem here is on my
views/products/index.php
<a href="<?php echo base_url().'products/buy/'.$product['id']; ?>">
<img src="<?php echo base_url(); ?>assets/images/x-click-but01.gif" style="width: 70px;">
</a>
Now when i click the button Paypal Buy Now now it
redirects me to
products/buy/1 was not found on this server.
I follow the instruction
and here is what on my database
Then i tried using the paypal button
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="S3RE65SMVGAHC">
<input type="image" src="https://www.sandbox.paypal.com/en_GB/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
and it redirects me to paypal but without the prices that i inputted on my database. SOMEONE HELP ME PLEASE
The error message
products/buy/1 was not found on this server.
is saying that the controller Products.php was not found.
Assuming the file is in the `applications/controllers' directory (it should be) then you need to make sure that the file name starts with an uppercase 'P'. In other words, the file name should be Products.php not products.php
Please try below sample codes.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="YOUR_ACCOUNT_EMAIL/MERCHANTID">
<input type="hidden" name="item_name" value="test">
<input type="hidden" name="amount" value="10">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="image" src="https://www.paypalobjects.com/en_US/GB/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal — The safer, easier way to pay online.">
</form>
And refer to below link for details of each variable.
https://developer.paypal.com/webapps/developer/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/

PayPal Secure way to process order

I'm currently developing a website that uses PayPal for order processing..
This is the html form I'm using so far for testing purpose
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<select name="amount">
<option value="3.99">6 Months ($3.99)</option>
<option value="5.99">12 Months ($5.99)</option>
</select>
<br>
<input name="currency_code" type="hidden" value="USD">
<input name="shipping" type="hidden" value="0.00">
<input name="tax" type="hidden" value="0.00">
<input name="return" type="hidden" value="urlOnValidPayment">
<input name="cancel_return" type="hidden" value="UrlOnCancelPayment">
<input name="notify_url" type="hidden" value="URLForValidationPayement">
<input name="cmd" type="hidden" value="_xclick">
<input name="business" type="hidden" value="your e-mail">
<input name="item_name" type="hidden" value="name of the object">
<input name="no_note" type="hidden" value="1">
<input type="hidden" name="no_shipping" value="1">
<input name="lc" type="hidden" value="EN">
<input name="bn" type="hidden" value="PP-BuyNowBF">
<input name="custom" type="hidden" value="custom data">
<input type="image" src="https://www.paypalobjects.com/en_US/CH/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/fr_FR/i/scr/pixel.gif" width="1" height="1">
</form>
But, I've noticed that, this method is not secure for ordering purpose. it can be only used for donation purpose. Because, user may return to the url in "notify_url" field without paying. blah blah..
Am I right? Or is there any way to make it secure?
You can reconcile the item amount within an IPN script, but this can be more trouble than its worth in my opinion. Since you're already working with PHP I'd recommend using the Express Checkout API instead of standard payment buttons. This makes everything much more secure and allows you to fully integrate without any limitations.
You can take a look at my PHP class library for PayPal if you want. It'll make the API calls very simple for you. Specifically, you'd be looking at SetExpressCheckout, GetExpressCheckoutDetails, and DoExpressCheckoutPayment.

Paypal ipn - Empty IPN and wrong date. Used to work

I have a website with a simple ticket shop built into it using IPN. It has been working for the past month and I left it alone. I was working on another payment site on the same webhost and for the first time i specified the "notification_url". I noticed that I couldn't get any response from PayPal on my new build and left it there. I then checked to see that my orginal system was still working at least; It was not.
For some reason when i check my IPN history the "latest delivery atempt" is "1984/12/14 04:53:12 CET (UTC+1)". The worst thing is that it also sais "Notification url: ". Empty.
This aparently returned 200 and success allthough my access logs show no traffic to my ipn-page. I have logs running and i havn't modified either code. I can access the IPN url manualt and it will get logged. No html login and no restrictions.
Heres my payment form:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="8TPEJKFGZEJBS">
<input type="hidden" name="lc" value="sv_SE">
<input type="hidden" name="item_name" value="'.$text.'">
<input type="hidden" name="item_number" value="'.$order_id.'">
<input type="hidden" name="amount" value="'.$cost.'">
<input type="hidden" name="currency_code" value="SEK">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="rm" value="2">
<input type="hidden" name="return" value="http://mywebsite.com/?page=13&done">
<input type="hidden" name="cancel_return" value="http://mywebsite.com/? page=13&cancel">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_paynowCC_LG.gif:NonHosted">
<input type="image" style="border: none;" src="images/buy.png" border="0" name="submit" alt="PayPal - Det tryggare, enklare sättet att betala online!">
<img alt="" border="0" src="https://www.paypalobjects.com/sv_SE/i/scr/pixel.gif" width="1" height="1">
</form>
What is wrong and what should i try to fix it?
You just need to add a field "notify_url" in your form. This URL is your IPN file url.
<input type="hidden" name="notify_url" value="http://mywebsite.com/?page=13&done">
For more details:
https://cms.paypal.com/cms_content/GB/en_GB/files/developer/PP_WebsitePaymentsStandard_IntegrationGuide.pdf

redirect to a page after paypal payment success

Is it possible to redirect the user to certain page after the payment is successful.
I have this form, and when the user fills the details, I want to redirect the user to my page when the payment is successful. Is it possiblt?
This is a sample of paypal payment code.
<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="accounts#freelanceswitch.com">
<input type="hidden" name="item_name" value="Donation">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="amount" value="9.00">
<input type="hidden" name="no_shipping" value="0">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="lc" value="AU">
<input type="hidden" name="bn" value="PP-BuyNowBF">
<input type="hidden" name="return" value="http://net.tutsplus.com/payment-complete/">
<input type="image" src="https://www.paypal.com/en_AU/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1">
</form>
Here <input type="hidden" name="return" value="http://net.tutsplus.com/payment-complete/"> specifies the return url. For more info - Go Here
Consider also the Auto return option: it allows you to set up an url for all buttons.
Log in and click the Profile subtab under My Account.
Click the Website Payment Preferences link under Selling Preferences.
Click the On radio button to enable Auto Return.
Enter the Return URL
The Return URL will be applied universally to all Auto Return payments. This can be overridden by mentioning separate return URLs in the payment buttons that you’ve created in your PayPal profile
More info in this answer.

Paypal return URL - using GET parameters?

Here's some simple code I'm using to test the Paypal Website Payments Standard upload thingy.
My return URL is http://mysite/index.php?module=store&show=order_confirm
I go through the payment process, and when I get to the end and it returns me to the page, it instead just returns me to index.php (i.e. without the extra parameters).
Anyone know what the deal with this is
<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="return" value="http://mysite/index.php?module=store&show=order_confirm" />
<input type="hidden" name="currency_code" value="EUR" />
<input type="hidden" name="business" value="b.coug_1277121937_biz#gmail.com">
<input type="hidden" name="item_name_1" value="adaddada" />
<input type="hidden" name="amount_1" value="30.00" />
<input type="hidden" name="quantity_1" value="1" />
<input type="hidden" name="item_name_2" value="wuiui" />
<input type="hidden" name="amount_2" value="50.00" />
<input type="hidden" name="quantity_2" value="1" />
<input type="hidden" name="custom" value="19" />
<input type="image" name="submit" border="0" src="https://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif" alt="PayPal - The safer, easier way to pay online">
</form>
I'm not sure why Paypal is doing what it's doing, but I suspect their desire to add their own GET parameters is wiping out your own. You might want to try something like this, if mod_rewrite or something similar is available to you:
write a rule that changes this:
http://mysite/store/order_confirm/?merchant_return_link=Test+Store
to this
http://mysite/index.php?merchant_return_link=Test+Store&module=store&show=order_confirm
Try escaping the ? and & in the return URL; change them to %3F and %26.
An alternative answer is to set the paypal 'rm' [return method] variable to "2", so that paypal would POST all its own return variables, rather than sending them as GET variables

Categories