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

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

Related

PayPal buy now button with IPN

I am new to PHP , and PayPal.
I need to do crowdfunding site.
Here I have a form where user can choose pay method :
Pay with terminal
Bank transfer
Paypal
Input with amount that user want to donate for project, and some fields like name, surname , phone etc.
Now action of my form is example.com/pay.php, here I register pay in my database with status "in progress" and i want after it to redirect user to PayPal page.
How to redirect user to PayPal with necessary data (see in PayPal button code) , after I add the transaction to my database?
Code of of my PayPal button:
<form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="business" value="BJKELCPG5WDSN">
<input type="hidden" name="lc" value="MD">
<input type="hidden" name="item_name" value="Help African child">
<input type="hidden" name="item_number" value="2299">
<input type="hidden" name="amount" value="67.00">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="button_subtype" value="services">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="rm" value="1">
<input type="hidden" name="return" value="http://example.com/test/thanks.php">
<input type="hidden" name="cancel_return" value="http://example.com/test/">
<input type="hidden" name="bn" value="PP-BuyNowBF:btn_buynowCC_LG.gif:NonHosted">
<input type="hidden" name="notify_url" value="http://example.com/test/listener.php">
<input type="image" src="https://www.paypalobjects.com/en_US/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/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Help me please with this problem.

Paypal Payment Integration not returning any values

This is my code in PHP for paypal payment integration.Payments are being done successfully. The response URL should be http://codaty.com/success.php?tx=83437E384950D&st=Completed&amt=10.00&cc=USD&cm=&item_number=1 .But I am getting the URL as http://codaty.com/success.php. I am not getting any parameters in return. Is this the right method for integration. Can I get a sample code for reference.
$paypal_url='https://www.paypal.com/cgi-bin/webscr';
$paypal_id='codaty#outlook.com';
<form action="<?php echo $paypal_url; ?>" method="post" name="frmPayPal1">
<input type="hidden" name="business" value="<?php echo $paypal_id; ?>">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="item_name" value="QR Code">
<input type="hidden" name="item_number" value="1">
<input type="hidden" name="credits" value="510">
<input type="hidden" name="userid" value="<?=$session_userid?>">
<input type="hidden" name="amount" value="0.10">
<input type="hidden" name="cpp_header_image" value="http://codaty.com/images/logo.png">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="handling" value="0">
<input type="hidden" name="cancel_return" value="http://codaty.com/cancel.php">
<input type="hidden" name="return" value="http://codaty.com/success.php">
<input type="image" src="images/card03.png" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!" class="img-responsive">
<img alt="" border="0" src="https://www.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
Add addition Return method input hidden field <input type="hidden" name="rm" value="2">
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.
And then in success.php :
echo "<pre>";
print_r($_POST);
More details : HTML Variables for PayPal Payments Standard

how to hide paypal button code from user?

how to hide paypal button code from user ?
for example codecanyon.net when i purchase some item i don't see paypal form , how can i do that ?
my user will edit price and currency code
i use code look like this.
<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>
<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="text" name="currency_code" value="USD">
<input type="hidden" name="item_name" value="Teddy Bear">
<input type="text" name="amount" value="12.99">
<!-- for submit button -->
<input type="submit" name="submit" value="Pay now">
<!-- for image button -->
<input type="image" src="your button image url" border="0" name="submit" alt="Give here some title">
</form>
For currency you should use select box
<input type="text" name="currency_code" value="USD">
<select name="currency_code" >
<option value="USD">USD</option>
</select>
when you use the button tool to create a saved button all the sensitive data is stored in the account and is replaced by a "Button ID". Here's an example:
<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>
Use:
<input type="image" src="your image url" border="0" name="submit" alt="Pay Now">

PayPal Payments Standard - change shipping and handling to just shipping

I am using PayPal Payments Standard with my own button code as follows. This works exactly as I would like except for one thing. In the PayPal shopping cart and on the invoicing, the display shows "Shipping and Handling". In California, I have to pay taxes on Handling fees. Can I make the display show "Shipping" only without the "Handling?
I tried to pass both a "handling" and a "handling-cart" input attribute with both empty and zero as values but that had no impact.
<form target="paypal" action="<?=PAYPAL_URL?>" method="post">
<input type="hidden" name="business" value="<?=PAYPAL_BUSINESS?>">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="add" value="1">
<input type="hidden" name="amount" value="12.50">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="shopping_url" value="<?=$url?>">
<input type="hidden" name="shipping" value="5.00" />
<input type="hidden" name="shipping2" value="5.00">
<input type="hidden" name="item_name" value="stain">
<input type="image" src="images/add_to_cart.png" border="0" name="submit" alt="Add to Cart">
<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