Using Paypal to purchase access code - paypal

I have a simple windows application (C++) that I would like to sell. The user downloads the full application which runs for 2 weeks. At the end of that time, the user must buy an access code ($1 - $5) to continue using the application.
The simplest way I've come up with for doing this is to have the application generate a UUID which is written into the registry. The application generates the access code based off the UUID. I would like to pass the access code to Paypal when the user initiates a purchase. If the purchase is successful, I would like Paypal to give the access code to the user (e.g. in an email confirming the purchase). Finally, the user will type the access code into the application to unlock it.
1) If someone has an easier way to do this, please send me an example. My requirements are only that the process require some detailed knowledge to hack (e.g. knowledge of a packet sniffer for my scheme above). (if my application becomes popular enough that someone wants to devote the time to hack it, I will be ecstatic).
2) What I have tried to implement the scheme above:
I have use the directions here to generate a paypal button for a purchase. I can click on the button and make a purchase using the sandbox. What I have been unable to do is a) add new hidden data to this button, and b) find a way for paypal to present that data back to the user on a completed transaction. (There is probably a way for me to do this by having a site that does the paypal ipn stuff found here)
The paypal ipn stuff just seems awfully complicated for something that I would think a lot of applications want to do. What I am hoping is that someone can point out a simpler way to do this with example code.
This is my first time using paypal as a merchant (in case that wasn't obvious).
Here is the sandbox-based button that I have from paypal.
<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="SOMETHING">
<input type="hidden" name="machine_id" value="PASSCODE">
<input type="image" src="https://www.sandbox.paypal.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.sandbox.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
In this example, I was trying to send my passcode in the machine_id field. I can't figure out how to get paypal to send this back to my buyer.
Thanks.
Chris

You cannot use your own variables.
Try this <input type="hidden" name="custom" value="PASSCODE">
custom - Pass-through variable for your own tracking purposes, which buyers do not see.
Or see list of all variables
https://developer.paypal.com/docs/classic/paypal-payments-standard/integration-guide/Appx_websitestandard_htmlvariables/#id08A6HF00TZS

Related

ASP.NET receive a query string from paypal after payment

I have created a button that allows for users to pay via PayPal and it works,
however when I get back to my page I receive no url query string to catch.
Here is the current code:
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<button class="ato4" name="submit" type="image" onmouseover="this.style.backgroundColor='#CCC9BD';return true;" onmouseout="this.style.backgroundColor='rgba(79,129,189,0.5)';return true;" style="cursor:pointer;float:right;margin-right:490px;">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="V84TB5GYULLYC">
<font class="shadowfilter">תשלום דרך האינטרנט
<br>
<font style="color:green;">PAYPAL</font>
</font>
</button>
</form>
How do I make paypal automatically redirect to my website without pressing the return button that PayPal has on their website?
apparently there is an option for all pages to auto return to -> url . well it's not as good as an individual pages but it gives the result
You have to enable auto return in your PayPal account, otherwise it will ignore the return field.
From the documentation (updated to reflect new layout):
Auto Return is turned off by default.
To turn on Auto Return:
Log in to your PayPal account at https://www.paypal.com.
The My Account Overview page appears.
Click the Profile subtab.
The Profile Summary page appears.
Click the My Selling Tools link in the left column.
Under the Selling Online section, click the Update link in the row for Website Preferences.
The Website Payment Preferences page appears
Under Auto Return for Website Payments, click the On radio button to enable Auto
Return.
In the Return URL field, enter the URL to which you want your payers redirected after
they complete their payments.
NOTE: PayPal checks the Return URL that you enter. If the URL is not properly formatted
or cannot be validated, PayPal will not activate Auto Return.
Scroll to the bottom of the page, and click the Save button.
IPN is for instant payment notification. It will give you more reliable/useful information than what you'll get from auto-return.
Documentation for IPN is here: https://www.x.com/sites/default/files/ipnguide.pdf
Online Documentation for IPN: https://developer.paypal.com/docs/classic/ipn/gs_IPN/
The general procedure is that you pass a notify_url parameter with the request, and set up a page which handles and validates IPN notifications, and PayPal will send requests to that page to notify you when payments/refunds/etc. go through. That IPN handler page would then be the correct place to update the database to mark orders as having been paid.
Ref.: Setting PayPal return URL and making it auto return?

Safecracker (ExpressionEngine) not working in Facebook page

I'm using ExpressionEngine and Safecracker to build a simple Facebook app that runs inside of a FB page.
My code functions properly outside of the Facebook page, but inside the page it shows a blank screen. I've been able to narrow it down to this piece of code:
{exp:safecracker channel="lekker_fietsen_competitie" return="/"}
<input type="text" name="title" value=""><br>
<textarea name="description"></textarea><br>
<input type="file" name="image"><br>
<input type="submit">
{/exp:safecracker}
I'm guessing that Safecracker is somehow violating what I can and can not do inside a FB page, but I can't see what it is.
Things I've tried:
hidden fields are allowed inside a FB page, they work properly, so they are not the cause of the problem
the scripts and other stuff that's generated by Safecracker works inside the FB page; I've
hard-coded all of it and there seems to be no problem if hard coded
You'd say the solution is easy: hard code the form. But I can't, because the form has two fields like ExpressionEngine needs to write the entry:
<input type="hidden" name="meta" value="cIssFx0NbcTnVxs7mWiSvwx0OwJ62c0KKoeGbZu8RMTHMJfNsv/OS0q8mtPh9HLmu/
ru2n8a5J4S3wgyB8c+XWBdNfUrTCeWNrKYwDOxSkxB34I5UNN8XpVQt/
wYc5FajtTx4VyGomwAHZ0vC7gXTxH4cYhU/zGx7S/UB6DgAyKk3cnl2f3+zbDId
+KbU7msE0O1AJX3Nx7QaE6IpKJpXnQeiMISCHC1aOxJriZ/5eWIhqZdDz18rRbs4
kdHCQ9RChFPtiB4rtjxque1CGylWj+OjiTaEVA68IVmC7c3AFrL9Wf4wxojOchPmlEx
0W2OD5T/ERy0mV6GbCnkAZcQRdQjgjx3Rd7SQrXOO6u7gHh+vqrzw/y/y7dqlMz1LGmrj
kdnOqdM/9bPej8Sp+3dCo2mDjf4WgCfLKze3P7XgLc=">
<input type="hidden" name="XID" value="1fba9120c5e00cfcb665bd0c7e147757b7888847">
So, where to go from here? What terms/guidelines might I be violating?
I submitted a ticket and did the following. Naviagate to expressionengine -> libraries -> Cp.php and go to line 75. Ticket https://support.ellislab.com/bugs/detail/19663
ee()->output->set_header('X-Frame-Options: SameOrigin');
Replace with
if (isset($_GET['D']) AND $_GET['D'] == 'cp')
{
ee()->output->set_header('X-Frame-Options: SameOrigin');
}

page_style not being applied when using Adaptive Payments

I am using Paypal's Adaptive Payments (Preapproval API) for one of my projects.
Everything is working fine, the payments are processed exactly as I want. My only problem is that I can't use the page_style variable as i could with a classic PayPal refirection solution.
When I obtain the pay key for PayPal, I prepare a form like this:
<form method="post" id="gateway_form" name="gateway_form" action="https://www.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=PA-XXXXXXXXX">
<input type="hidden" name="page_style" value="mystyle">
<button type="button" class="continue-with-payment" onclick="checkDonateForm(327, 'gateway_form');">
<span>Proceed to Payment</span>
</button>
</form>
Where mystyle is a custom page I have created on my Paypal account which is the application owner.
I have also tried to send page_style as a GET variable e.g. https://www.paypal.com/webscr?cmd=_ap-preapproval&preapprovalkey=PA-XXXXXXXXX&page_style=mystyle but nothing happened.
Any suggestions ?
The page_style variable is for Payments Standard transactions - not Adaptive Payments. I checked to see if there was an equivalent for Adaptive Payments but there doesn't seem to be.
I'll submit a Feature Request asking to include one but I cannot guarantee that it will be implemented - sorry.

Add MailChimp subscriber to group with signup form, not API

I know you can do this with the API, but not sure about the regular signup form.
Does anyone know if it is possible to add some code to the advanced signup form in MailChimp that would automatically add them to a specific group within my list?
I am only collecting the email address and I don't want the subscriber to have to select the group manually. If they are using that form, I want them added to that group.
I have asked MailChimp for help, but they tell me that their customer support doesn't code and that I should hire an expert.
Perhaps a segment of the relevant code may help:
<form action="http://lalala.us2.list-manage1.com/subscribe/post" method="post">
<input type="hidden" name="u" value="345fc4974810ef65c8276c8">
<input type="hidden" name="id" value="25c4d1b28">
<table cellpadding="5" cellspacing="0" border="0" align="center">
<tr>
<td align="right" class="formLabel"><strong>Email Address</strong> <span class="asterisk">*</span>:</td>
<td align="left">
<input type="email" autocapitalize="off" autocorrect="off" name="MERGE0" id="MERGE0" size="25" value="*|MERGE0|*">
<br><span class="error">*|HTML:EMAILERROR|*</span></td>
</tr>
Is there a hidden input type that I can add with a list grouping name that will auto add them to a group?
This is an old question, but I came across it looking for the answer myself and couldn't find a good answer anywhere (including the other answer here which is poor at best). When I couldn't find anything on this I was able to figure it out with a little experimentation.
It requires a couple steps. First, add your Group and the options you want the Group to contain (it can only be 1 if you want). Initially make sure the Group is not set to hidden. Go to your main default sign-up form in MailChimp under Sign Up Forms > General Forms. Verify the Group option(s) are visible and then use the Sign up form URL to visit your hosted sign-up form. Now, open the raw HTML in your browser using right-click > View Source. You need to find the INPUT element for the group / option you want. It will probably look something like this:
<input type="checkbox" data-dojo-type="dijit/form/CheckBox" id="group_8" name="group[13257][8]" value="1" class="av-checkbox">
The name parameter is the critical thing here. Copy and paste that entire input element inside your custom form. Now, use inline CSS to hide it and HTML to hard-code it to checked. You can also remove extra stuff too. The final version in your custom form should look something like this:
<input type="checkbox" id="group_8" name="group[13257][8]" value="1" checked="checked" style="display:none">
This will ensure that it is not visible to the user but it will automatically add them to the group defined by the name parameter that you grabbed from the form which showed it.
The final step is to go back and make sure you set that Group to Hidden to make sure it doesn't inadvertently show up on other forms.
Pretty simple!
All I did was delete the other checkboxes (as well as the unordered list and list item tags around them) and change the checkbox representing the default group I wanted into a hidden field. Literally just type="hidden" instead of type="checkbox" and that did the trick.
You should be able to add a hidden input field with the name of the MERGE TAG set for the specific group.
However, for this functionality it would be much easier to utilize the MailChimp API (even though your question suggests you'd rather not).

Paypal custom amount for "Donate Now" button

I've been asked to implement Paypal "Donate Now" functionality on a web site, similar to Wikipedia's site.
I know how to generate "Buy/Donate Now" buttons with fixed amounts, and with variable amounts,
but I don't see how Wikipedia is able to have the user specify the amount on their site and then have it carry over to Paypal, so that the amount is pre-filled once they get there.
Paypal's own documentation does not seem to support an "amount" field (or I've missed it). I actually called Paypal support and was told that I'd have to use a 3rd-party shopping cart for this functionality, but if the carts support this, isn't it just a form param?
Yes, there's an HTML input parameter for this. Simply called 'amount'.
See https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_html_Appx_websitestandard_htmlvariables
Just include amount in any HTML input/select field and ensure you pass it over to PayPal. For example:
<label for="amount">Enter the amount you wish to donate:</label>
<input type="text" id="amount" name="amount" value"">
Or;
<label for="amount">Select the amount you wish to donate:</label>
<select name="amount" id="amount">
<option value="5.00">$5.00</option>
<option value="25.00">$25.00</option>
<option value="50.00">$50.00</option>
</select>
Wikipedia uses some server-side scripting to create a transaction before it sends you to Paypal. This is the shopping cart functionality, yes, specifically the Express Checkout part.
I believe that this image illustrates the process:
(source: paypal.com)
Don't worry - it looks harder than it is: it's very easy to implement.