Error on Buy Button (Paypal Integration Gateway in CodeIgniter) - php

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/

Related

I am trying to get custom date to pass to PayPal

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.

Can we unsubscribe from recurring payment via passing subscribe id on link

<form name="myform" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">
<div id="other_element"></div>
<input type="hidden" name="cmd" value="_xclick-subscriptions">
<input type="hidden" name="business" value="<?php echo $adminpaypal; ?>">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Monthly Subscription">
<input type="hidden" name="a3" value="5.00">
<input type="hidden" name="p3" value="1">
<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="notify_url" value="<?php echo $paypal_notify; ?>" id="payment-notify" />
<!-- Display the payment button. -->
<input name="return" value="<?php echo $paypal_return; ?>" type="hidden">
<input type="image" src="" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
I have created form of paypal for monthly subscription. After subscription, I am getting "subscription id". Now I am working on making unsubscribe button.Is it possible to make unsubscribe button via passing subscription id on link ?
If you created your subscription using subscription button creator then you can follow these steps.
When you go to your saved buttons, click on "action"-->"view code". At the bottom, under your code, there is a "create unsubscribe button" option.
Create the button and copy the code. Paste it in your web app. You are good to go.
Here is the button creator code with hidden values---
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick"> //custom variable. You can access it like $_POST['cmd'] when you call listener (IPN)
<input type="hidden" name="hosted_button_id" value="*********">
<input type="hidden" name="custom" value="<?php echo $_SESSION['user']['id']; ?>">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
And here is the code for unsubscribe button. When you will create unsubscribe button, it will generate same code. Just ****** will be replaced by some value.
<a HREF="https://www.paypal.com/cgi-bin/webscr?cmd=_subscr-find&alias=*******">
<img SRC="https://www.paypalobjects.com/en_US/i/btn/btn_unsubscribe_LG.gif" BORDER="0">
</a>

PayPal IPN Simulator Custom Text Fields

I have the following PayPal button set up:
<form action="https://www.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="SN3834XQZMRCW">
<table>
<tr><td><input type="hidden" name="on0" value="Minecraft Username:">Minecraft Username:</td></tr>
<tr><td><input type="text" name="os0" maxlength="200"></td></tr>
<tr><td><input type="hidden" name="on1" value="TeamSpeak UID:">TeamSpeak UID:</td></tr>
<tr><td><input type="text" name="os1" maxlength="200"></td></tr>
</table>
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_subscribeCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
According to the documentation, the two hidden fields I have simply get passed to PayPal and then back to my PHP script. To get these values, would it be correct to use the following:
$_POST['TeamSpeak UID:'];
Before you ask, I can't seem to send these custom fields using the simulator, unless the fields are encapsulated within the custom field? The documentation and help seems to be lacking here. Thanks for any help.

How to protect user edit paypal button ?

How to protect user edit paypal button ?
this is paypal buy now button on my site
<form name="_xclick" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="me#mybusiness.com">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="hidden" name="amount" value="12.99">
<input type="image" src="http://www.paypalobjects.com/en_US/i/btn/btn_buynow_LG.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
</form>
my customer will edit paypal button like currency_code, amount
i want to know , how can i protect user to edit paypal button ?
Log into your PayPal account and use the button tool to create a saved button. the saved button replaces all of the sensitive data in the button code with a "Hosted button ID. here is an example of the hosted button code:
<form action="https://www.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="L7NSNLBNU69AC">
<input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_paynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>

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.

Categories