Generate SIMPLE Paypal buttons dynamically with PHP - php

I wanted to add PayPal functionality to my Wordpress plug-in, so I ventured over to PayPal's developer page and scanned through it. I couldn't help but notice how vague and complicated their documentation was.
On their button manager API page, step 4 literally says " ... develop the API code necessary to create and manage your buttons." This is not helpful whatsoever. With a little more digging, I found this PHP SDK, but implementing it is poorly explained and I can't follow it. To be honest, it looks like overkill anyway. All I want to do is send basic information:
Merchant's e-mail (to which payment will be sent)
Item cost
Item quantity
Logging into my own PayPal account and generating a button using their form will not work for this. I am trying to generate a button dynamically, based on the information the user enters into the plug-in. I would also prefer the method to be more secure than using the HTML hidden input fields.
If there is absolutely no easy way to send PayPal these three simple things, then I would greatly appreciate seeing a more thorough explanation of the SDK. I do not know what composer is, nor what bootstrap.php is supposed to be, nor do I know where to save the files that use the SDK's functionality. Once those questions are answered, I only want to know how to send those three things and the bare necessities. I don't need all this extra information.

Best way to do it is to generate direct URL, something like: (you can click it)
https://www.sandbox.paypal.com/cgi-bin/webscr?cmd=_xclick&business=yourpaypalbusiness#hotmail.com&notify_url=http://example.com/ipn.php&item_name=myitem&item_number=1&currency_code=USD&rm=2&amount=49.99&quantity=1
This way you can populate URL query parameters from your database/plugin.
I hope so it helped.

Related

Automatically Post to Google + Business Page

Is it possible to post to Google + through PHP using some kind of API? I've read many conflicting statements on various places, including here on SO.
I've read that you need an analytics account, that you need to add a website to your page, that it isn't possible, that it's a closed service and you must apply, that you need your GMail username & password .etc.
Just really looking for a bit of clarity really. Found this, but I'm not sure if it allows this functionality. The lack of documentation really makes it quite daunting looking into this as well, there is literally nothing I can find at all.
Another option I've found appears to work, however it was from a website where you must pay to download the API. I'm genuinely not sure how or if it can be done.
Google restrict this API to whitelisted partners and companies through https://developers.google.com/+/web/api/rest/pages-signup
You could however use a third party script such as https://gist.github.com/zachbrowne/3301749 which handles the posting as if it was a logged in front end user rather than a direct API update flow.

Developing REST API using PHP

I am new in API. I am supposed to develop an API that allows our content provider to give information pertaining soccer whereby he is supposed to create matches,update matches etc .I would like to know how to create a REST API in php that allows a client to enter the information. So far,I have created an API but I dont know how to enable the client enter the information.
Informations:
It is the basic form that you have to create and then you must allow the user to submit the form datas that he/she has filled and you have to post the data to the route that you have created.
You must submit the data and then you have to make the submitted data to be json_encode() so that it will work for the API.
Or Else if you are not designing the form and other such things you can directly go in for the API ADD ONS that the Firefox and the chrome has . Assuming you are using the chrome or Firefox as browsers.
https://addons.mozilla.org/en-US/firefox/addon/restclient/
https://addons.mozilla.org/en-US/firefox/addon/rest-easy/
https://chrome.google.com/webstore/detail/postman/fhbjgbiflinjbdggehcddcbncdddomop?hl=en
Okay, assuming that you created a REST API already, download the Advanced REST client chrome extension: https://chrome.google.com/webstore/detail/advanced-rest-client/hgmloofddffdnphfgcellkdfbfbjeloo
I hope that answers to your question.
P.S: May I know what framework did you use to design your REST API ? Additional details can help you further.
Building REST APIs is atually a rather easy task. That's primarily what I work on at work all day. If you have to use PHP (I'm a fan of PHP, so don't take that comment the wrong way :) ), I would reccommend using a framework like Laravel.
The logic to handle the information once it's requested wouldn't change. You would just need to make your requests/responses REST compliant.
Here is a great tutorial for doing just that!
Also, since you use Yii, this tutorial is probably better. I've never used Yii, so I can't really vouch for it, though.

Need advanced help, Wordpress & mailchimp

Heyhou!
I have tried to figure this out long time already, but no luck so far.
I have Wordpress site with mailchimp email form, so users are able to join my email list. The problem is:
-When user join the list, Mailchimp send automatically the confirmation email. I have edited it already to meet my requirements, but I need one more thing. I need to place URL where the joined user can download my free file, that URL needs to be one time url and it would redirect to my site where s/he can download the file.
Soooo, which way would be a best way to do that ? The main point is here that nobody can't start share the download link or page so users could download the file without to join my list. Poor English, hope you got the picture.
I'm web developer / PHP programmer, so plug in is not a must, (of course if you know one, let me know) I can make this by myself, but I need your help to solve the logic, how this would be done.
If I just place my website's download link in the Mailchimp confirmation email, there isn't anything which protect file. I need to somehow to crush the link after user is downloaded the file. BUT no manual changes in Mailchimp confirmation email.
There might be some super easy solution for this or not, anyway I'm stuck.
Thank ya!
I have used mailchimp previously and found the only way to push some data into an email, for this example a dynamic URL with a special access code is to set it as an extra bit of data on the users profile via the API.
http://developer.mailchimp.com/documentation/mailchimp/guides/manage-subscribers-with-the-mailchimp-api/
From when I last used Mailchimp you get 30 fields of custom data you can set on each user.
Hope that helps.

How to use jotform API to display forms

I am looking to find a way to display forms that are created in JotForm using the APIs. Basically, I'd like to make a call with the API and pass an ID to the API and then have it pull the necessary information back from JotForms in order to render the form that as been created in JotForm itself.
I've done a little research and I haven't found anything that suits my needs just yet. Was wondering if anyone knew of a set of scripts (possibly php) that would allow me to complete such a task?
Please visit this website for your required language code:
http://api.jotform.com/docs/

Using OpenID to prove Stackoverflow membership

Here's the deal:
-Flair pretty much demands a Facebook app
-I'm working on learning the Facebook platform
Therefore, I've written a dinky little Facebook app to embed your Flair into a box on the side of your profile. If you're interested and on Facebook; beware that this is very much a work in progress, prone to change and has a whole bunch of rough edges.
However, I don't have an elegant way to say "this is MY Stackoverflow profile" from this dinky app. My current solution is best demonstrated this image. It is, frankly, idiotic; and there's nothing preventing impersonation.
Having no experience with OpenID, I'm wondering if there's some way (and some example of this way, please) to get a user to provide their Stackoverflow identify to a third party?
Behavior changed to that suggested by Noldorin's answer.
Request for a saner way to do this declined on UserVoice.
There's no way to get a StackOverflow ID from OpenID and to do the opposite would be possible but unnecessarily complicated (compared to your suggested method). Copying and pasting the user ID/profile URL isn't terribly inconvenient, in my mind.
However, I can suggest some sort of solution to the issue of impersonation. This may seem like a slightly silly method, but it's the simplest way of which I can think to insure that only the user themself can display the badge. Again, I don't think it's too inconvenient. (The more traditional method of using an email confirmation isn't possible, given that emails aren't public.)
Have your Facebook app generate a random (alphanumeric?) code. Something in the form A8IO45QW6T should do.
Hold this code on the server side of your Facebook app for a short time period (say, 5 minutes).
Instruct the user to edit their About Me information by adding the given code to the last line, then to return to the Facebook and confirm. Simple inspection of HTML for the profile page of the specified user would verify ownership. The user can then remove the verification code from their About Me text.
Nice idea creating this Facebook app, by the way. I may just give it a try!
Another solution that would allow for instant verification is hashing the email address and checking to see if it matches the user's Gravatar. Granted, not every user has provided an email address, but you can always perform this check first and if it fails you can fall back to the About Me section editing (or simply require that the user have an email address). This idea is not mine, so I'll let null explain:
Do you still have the source available? As I've gotten a solution to prevent other users from messing up your results. You just need to hash the email address used by the viewer and check for the gravatar image link on the page as outlined on the gravatar site. If the user id and image hash match, then record the change to the database, otherwise... just show results. I can make that change, but the source seems lost... :(

Categories