Category: Programming

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.

500 Words on CSS

Courtesy Keytechinc

Cascading Style Sheets are not exactly in my wheelhouse.

They’re kind of in the supply shed next to my wheelhouse. They’re right next to what I work with and I am familiar with them, but they aren’t what I work with all the time, and the nature of working with them slows me down quite a bit. I can do it, sure, and I can even produce results that are aesthetically pleasing. But it’s meticulous, exacting work, and continuously having to run between my wheelhouse and the shed take a lot out of me.

Don’t get me wrong. I vastly prefer using CSS to laying things out in Photoshop or even Flash. One of the advantages of the dayjob work I currently do is that 95% of it is happening on the code end of things. All I need is Notepad++, FileZilla, and a few browsers for testing. This method allows me to assault my problems from an angle that makes sense to me.

In terms of programming, I’m a little bit on the ancient side. I never got into some of the more hardcore languages like C, Python, or Perl, but back in the day, I hammered out some programs in BASIC, and my first few forays into web design were pure HTML constructs, before the advent of CSS or JavaScript. I think that’s where a lot of my approach comes from.

I use automobile analogies a lot when I describe online programmatic approaches and challenges. For example: if I were working with cars instead of computers, I would be more concerned about the inner workings of the engine, transmission, and even the sound system, rather than the paint job, flares, or rims. I can do it – I know my way around an airbrush rig and the sockets for the rims – but I much prefer being elbow-deep in engine grease and pistons.

I’ve worked for a great firm called Twelve23 for two weeks, now, and the experience has been a good one. I don’t drive to work – it’s walking and the light rail, for me. I have access to Belltown, a nice little portion of downtown Seattle. When things feel intense or problematic, I can duck out and walk up the hill, and catch sight of the Space Needle. It’s relaxing and a comfort, in all honesty. I have to remind myself that out here, things are different.

I’m used to the pace of the east coast. Everything is more immediate out there, at least in my experience. Workplaces are more intense. Stakes are high and the edges are sharp and jagged. It seems smoother, here. It could just be me, but the environment here is much more amenable to my pace of work and my outlook on priorities. I’m no slacker, and I’ll do what must be done, but I need to remind myself that taking care of myself is important, too.

And now I’ve gone 487 words without mentioning how I’m not at PAX East this weekend and that SUCKS.

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.

© 2018 Blue Ink Alchemy

Theme by Anders NorenUp ↑