Tag: PHP

WordPress PHP PayPal Payout Helper Class

View on GitHub

At-A-Glance

Platform: WordPress
Language: PHP
Keywords: RESTful API, PayPal, eCommerce, WooCommerce

Overview

We live in an international, interconnected world. We work for one another on all sorts of solutions. And we all want to get paid for our work, right? Right.

It’s not uncommon for people to use a CMS like WordPress to advertise, facilitate, and implement their business. And when doing so, an eCommerce platform handles all of the sales, taxes, and so on. But what if we’re not paying for a product, but rather providing payment to another person for a service rendered?

The client in this example is running a business in Australia, and connects those needing professional SEO services with qualified freelancers. The desired solution would not only ensure the proper flow of payment from the former to the latter, but also automate the process so that recurring contracts with a monthly or bi-weekly payout schedule would take place without requiring manual input.

Approach

The prevailing idea was to have a solution that was as seamless as possible with current WordPress and WooCommerce functionality. The modularity of WordPress and, by extension, WooCommerce means that new classes to handle a situation like this can be added onto the platform is relatively straightforward. With that in mind, I worked to craft a class that drew the information required from existing sources, work it through the PayPal API, and update all of the pertinent data without interfering with other processes.

In most instances, this is a process that is done manually. By automating things, we could make the work of the client more smooth, provided that we could ensure the success of these transactions should they run automatically as a CRON job based on whenever the appropriate payout should be made, as well as checking for the proper currencies on payout.

Result

Thanks to the functionality of WooCommerce and PayPal, the incoming currency was the only type that requires a callout. Once the recipients information is entered and the transaction started, PayPal handles the rest. However, giving it the incoming currency is crucial, in that PayPal is informed that default currency values should not be used.

Then, it’s a matter of making sure the correct credentials are culled for both payer and recipient from the WordPress database. This information is entered by both parties as part of their registration for the site. The class consolidates this information and, along with the currency type and amount, facilitates the transaction.

Code Monkey Flails At Code

Courtesy Plognark.com

*makes various ‘ook’ and ‘eek’ sounds*

*slaps paws against keyboard*

*throws monitor*

So over the last few months I’ve been learning a lot about myself.

In addition to exploring my inner mental and emotional landscape, coming to terms with seizing my own sovereignty, and doing my utmost to unlearn some nasty learned behaviors, I’ve made strides in returning to a dayjob that is rewarding in both a personal and financial aspect. A couple of weeks ago, I finally found one. I’m very happy to be here.

But ye gods and little fishes, is it frustrating sometimes.

I’ve discovered that I’m actually a pretty logical thinker. To me, A should lead to B which results in C. However, sometimes my head weasels try to derail that and take me from A to B by way of Z. That’s dumb, and I’m getting better at not doing it. Even if sometimes my boss has to say “Josh, are you making things harder than they have to be again?”

I’m still not sure where I picked up my habit of trying to play life on Hard Mode.

Since I started working here, I’ve had several jam sessions regarding programming logic and order of operations related to specific tasks and goals. It’s been difficult at times for me to comprehend what goes on under the hood of certain functions, as at first the logic seems to fly in the face of common sense. However, taking a step back to realize what the code is actually doing as opposed to what we want it to do has helped. I’m still frustrated, to be sure, but at least I better understand why the hell the thing I want to work is not working.

“Hey, am I just dumb, or is it this code that’s dumb?”

That’s in jest. I know I’m not dumb. I can just overlook a fact or miss an aspect of a function that makes a thing work the way it should.

We’re looking at moving on from using WordPress as our foundation for our products, and building something in more modern, secure, and malleable code structures. I feel that getting tossed into the deep end of the current workload here has prepared me for that sort of looking ahead. I know this work will be worth it.

Man oh man, it hurts sometimes, though.

It’s like going to the gym after you’ve skipped out for a while. Or getting back to long-distance running after taking the winter off because fuck that, it’s cold outside. It hurts. You ache, and you struggle to breathe, and why in the name of all that’s good and awesome am I doing this to myself. But it’s worth it. Soon it won’t hurt so much. And the results will be even more magical than they are now.

Until then, it’s poo-tossing time.

*ook ook eek*

Thursdays are for talking tech.

Behold, the Webfolio!

Web Alchemy

It’s been a busy week for me, and it’s far from over. My mind’s practically on fire with everything coming at me, and I knew there was something necessary to start tying things together, to fully utilize that fire in a productive way. I needed a single location to feature my work, easy to locate and quick to load, to which I can point those interested in seeing exactly what I bring to the table in terms of programming skill and web-based creativity.

Hence, the webfolio!

Featuring projects past and present, I mean to provide little snapshots of my adeptness at programming, my willingness to work on a team and my propensity for trying new things. I’ll be updating this as my experience grows, but for now it features four of my best sites to date.

Waterfall Jewelers, featuring what may be my programmatic pride and joy to date: a Flash-based Pandora build-a-bracelet app;

Ellipsis Enterprises, an agile little brochure site;

Specialty Ring Inc., a site featuring JQuery drop-down navigation and real-time AJAX form authentication;

and GoreCon Inc., a brochure site including a WordPress blog skinned to reflect the shiny design.

More to come, as my skills and opportunities continue to grow!

Programming Mission Statement

Courtesy Leslie Town Photography

The creative mind is like a thoroughbred horse – it requires a firm but flexible grip, one that does not allow the beast to run wild, but also one that permits some leeway, lest the creature rail against its control and fight to be free. Just the right balance of control and detachment puts new ideas on the path to greatness. You know what you want, but permitting your trajectory to follow its own course allows for growth, stays agile in the face of inevitable setbacks and lends a sense of adventure to the overall process.

code

They’ve called it “the information superhighway.” If you want to travel on it, you’ll need a good vehicle. ‘Good’ is a subjective term – maybe you want something you don’t have to worry about, or perhaps you’re looking for a high-precision machine stuffed with power and bursting with cool gizmos. Either way, you need someone who understands both the beating heart of an Internet vehicle and how the paint’s going to look to visitors after everything is said and done.

That’s where I come in.

Web Alchemy

I take the ideas that float around the subconscious mind and make them manifest. I find new ways to get things working. I get my hands dirty. It’s messy and magical all at once. I turn dreams into gold – one jot & scribble, one line of code at a time.

Programmatic Mission Statement

code

My career path has been, to say the least, an odd one. I knew that published fiction was a tough field to enter, and that attempting to make a living from it directly out of university would be difficult, if not impossible. That knowledge, coupled with a challenge issued by a flatmate, pushed me in the direction of honing my nascent skills with computers into usable and marketable skills.

Things didn’t go so well in that regard. I worked for a few years in customer service, specifically tech support for a company in the wilds of Pittsburgh. I managed to squeeze in some freelance web work here and there, but never really found the time to truly develop my programming skills. A renewed search for the expansion of my knowledge and marketability lead me to a course in King of Prussia for Microsoft certifications.

It turns out the network administration environment and I don’t get along. There’s a great deal of stress and immediacy, no margin for error and no room for creativity. I struggled with the job daily until I lost it. Finally, after months of searching, I found my first true programming job. I’ve moved from there to another position and it’s come time to define what I want out of this particular branch of my working life. The more I work with PHP, the more I develop object-oriented solutions in Flash, the more I realize I need to be specific about my idea of a good career if I want to be happy to hop in a car or on a train to head to the office.

Don’t get me wrong. I consider myself a writer first and foremost. It’s the creation of new worlds, putting interesting characters into those worlds and setting events in motion that affect those characters that gets me up in the morning and makes me feel alive. Programming, however, is something of an extension of that. To that end, here’s something I’d like to call a ‘programmatic mission statement.’

Courtesy Leslie Town Photography

The creative mind is like a thoroughbred horse – it requires a firm but flexible grip, one that does not allow the beast to run wild, but also one that permits some leeway, lest the creature rail against its control and fight to be free. Just the right balance of control and detachment puts new ideas on the path to greatness. You know what you want, but permitting your trajectory to follow its own course allows for growth, stays agile in the face of inevitable setbacks and lends a sense of adventure to the overall process.

They’ve called it “the information superhighway.” If you want to travel on it, you’ll need a good vehicle. ‘Good’ is a subjective term – maybe you want something you don’t have to worry about, or perhaps you’re looking for a high-precision machine stuffed with power and bursting with cool gizmos. Either way, you need someone who understands both the beating heart of an Internet vehicle and how the paint’s going to look to visitors after everything is said and done.

That’s where I come in.

I take the ideas that float around the subconscious mind and make them manifest. I find new ways to get things working. I get my hands dirty. It’s messy and magical all at once. I turn dreams into gold – one jot & scribble, one line of code at a time.

I think that makes things pretty clear. It’s a shame it took me the better part of a decade to finally put this notion together. I’ll still be pitching to the Escapist, working on stories and columns and chipping away at the latest iteration of my first novel. But in the meantime, I have bills to pay and mouths to feed and, unfortunately, I haven’t quite earned the writing stripes to leave the day job behind. Until I do, I’d still rather do something I enjoy than flip burgers or stand on a street corner.

© 2024 Blue Ink Alchemy

Theme by Anders NorenUp ↑