How to automate a donation receipt system - paypal

I volunteer for a nonprofit which accepts donations via Paypal. My job is to log into the Paypal account, note down the particulars about a donation (name, date,amount, etc), populate those fields in a template receipt stored in Google drive, download a pdf of the receipt created, and use the nonprofit's Gmail account to send the donor a confirmation/thank you mail, with the generated receipt as attachment.
Is there a way to automate this whole process and make it instantaneous? This will be cool (and will save me quite a bit of labor). If there is no specific answer, do you have any general path I can follow? Also, if we move from PayPal to, say, a bank, can the same thing be done?
I only know bash programming and Fortran, but I may be able to learn what's needed to do this job.
thanks for reading my question!

Yes. You would use Instant Payment Notification (IPN) for that.
Basically, you create a script that sits on your web server and "listens" for data. Any time a transaction hits your PayPal account their server will POST all of the data about that transaction to your listener script.
Your script receives the data, and within it you can process the data however you need to. You can generate customized email receipts like you've mentioned, update databases, hit 3rd party web services, etc. It happens automatically and in real-time.
It's an extremely valuable tool that will let you automate tasks based on payments, refunds, disputes, etc.

Related

Mass payouts suggestion for third party

Let's say I have a software that does accounting for businesses. These businesses collect money that, at the end of the month, they need to forward to their clients.
Meaning, at the end of the month, my software produces an accounting statement that goes like this
Send x € to Client A
Send y € to Client B
and so on
Today, the businesses then manually log into their bank account and type in every transaction.
But now, I'd like to automate that process by suggesting the businesses a "bulk transaction" on e.g. PayPal. At the end of the month, they log in and see a "Pay with Paypal" button. Once they click, they get taken to Paypal and the bulk transaction my software has created is shown to them. They can decline or accept it.
Once they've gone ahead and sent out the transaction, my software gets notified if the transaction was successful or not.
A few more things to consider:
My software is operated from Germany. Here, as soon as my software can "touch" the money of the businesses I'm serving, I'll have to get permission from BaFin. So I'd like to not have access to any money of the businesses I'm serving!
I want to make the process as smooth as possible from a UX perspective.
I've looked at the PayPal API. I've found that Mass Pay is deprecated. And so is Adaptive Payments... So the only option left would be the Payouts API. But I can't find a way where I can suggest the businesses a transaction but then get notified later if it was successful...
I could have them upload a csv. But then how do I know if it was paid?
Ideally, I could:
Generate a csv of all the recipients + amounts
Business downloads it from my software and uploads it to their Paypal. They confirm.
Somehow there's a webhook that calls my software to tell it whether the transaction succeeded.
I've also looked at the Reports API. In that case, I'd ask the businesses that I'm serving to allow me to access their reports and would periodically download them. But that neither seems to work as the Adaptive Payments API is deprecated.
Any ideas on how to solve this on PayPal? Any other providers I could take a look at?
Require all clients to be approved for PayPal Payouts and provide you with a ClientID and Secret to facilitate payments via the Payouts API. You can be notified via the Payouts API batch details.
If checking batch details isn't enough, you can implement webhooks for updates.

charitable payment processing to an account I don't own

I'm trying to set up payment processing for my web app where I've gameified charitable donations.
My goal is as follows:
User on my website wants to unlock a feature or perk by donating to an arbitrary charity.
I redirect them to some payment processor where the money goes directly to the charity.
The user is redirected back with proof of payment, and I unlock the feature.
I don't want to deal with having any sort of liability as a "business" or any of the risks associated with accepting money into an account I control. I just want proof that the payment happened.
Most charities use Paypal to process payments, so let's assume the payment system is PayPal. Is there any way at all I can do this? Hacky solutions and unconventional routes that require some extra work on the user's end are also welcome.
EDIT for clarity:
I'm not looking for code, but instead for recommendation of a service or payment workflow that is capable of this feature. Thanks!
May stab at this use case at hand:
Let the user complete the payment for his selected charity at say paypal and give the user an option to upload the receipt at your webapp(may be a pdf). To begin with you can eyeball the receipt and give the user the credit(On your review admin screen?). But if you want to go fancy you can implement some ocr and automatically substantiate the payment receipt.
Or you can even make it much simpler by auto accepting the receipts by default in the beginning and see how many are cheating on you and then decide to implement the verification. Some time a user taking pain to upload the receipt itself is a proof that he did the right thing.
Another approach would be to use email processing. Provide the user with a disposable email address, and instruct them to provide this address for the receipt.
This won't work for every charity, but in my case, the charity requires an email address to give. Simply use a service like mailgun to process the "Thanks for your donation" email.
It's not as fast as an HTTP callback, but the function is roughly the same.

How can I execute code after receiving a paypal payment?

I have finished designing a program, and am ready to create a commerce system. Ideally, I would like to use Paypal to handle all the transactions for me, how ever I want this to be done on my own website, and have the information securely sent over to Paypal. I understand how to do this entire process, how ever I do not understand where I would add code to have my server generate a serial code and store it alongside customer information in a database.
The Paypal API isn't very helpful, so I am wondering if there is a variable passed back to the merchant website by PayPal, via a POST or similar, that can be checked to verify that a payment was accepted, and then react depending upon that status.
I understand that I can have it send the user back to the merchant website, but I would like it to generate a page along the lines of...
Thank you for your purchase (NAME)! A copy of your serial for (LICENSE_COUNT) licenses has been sent to your e-mail at (EMAIL).
And then have a script run to automatically generate the serial, send it to the user, and save it in a database.
Any language is acceptable.
Are you working with Payments Standard or Express Checkout?
If you're using Payments Standard you would need to use PDT + Auto-Return to get data back to your page for display. That said, I wouldn't rely on it to deliver the necessary details to your user because they're not always guaranteed to make it back there even with Auto-Return enabled.
Instant Payment Notification (IPN) is recommend for this sort of thing. It will POST transaction data to a listener script you have on your server. This happens separate from the checkout system itself. You can automate tasks like updating your database, hitting 3rd party web services, sending email notifications, etc. from within this script. It also allows you to handle e-checks correctly (only delivery the e-goods when the payment clears.)
If you're using Express Checkout you can handle this within the checkout flow rather than using IPN if you want to because the user is always guaranteed to make it back to your site. That said, if you're accepting e-checks you'd still want to use IPN instead. If you've disabled e-checks then this would work just fine.

Is it possible to automate payments through someone else's gateway?

Suppose some online retailer uses XYZ Bank's payment gateway. Is it possible to do the job of filling in card details and proceeding through the entire process using a script? If yes, is it legal?
Update:
To make the question more clear, I'll give a scenario.
Suppose the retailer we're talking about is Amazon, and I wan to use a card/netbanking (not PayPal). I want to be able to place an order on Amazon using a script which does the job of filling my cart and making the payment. Say the cart thing has been taken care of. How do I automate the payment process now? If it's allowed that is. Card details etc will not of some user, but my own, so no security issues with that I suppose.
The payment API would usually support something like this. For example, if we look at Paypal's direct payment api, they provide secure means for you to pass credit card numbers, etc to Paypal to process the payment.
If you are thinking to do this to process recurring payments, then you are doing it the wrong way. You should never store any credit card details unless you are PCI-DSS compliant. This takes a lot of work and auditing, so it is somewhat rare for small and medium companies to do it. For recurring payments, store the credit card numbers with your payment gateway (most should provide a means to do this) and the gateway should return a token to store. Every time you want to charge the card, simply pass the token to your gateway.
Given the new information:
What you are trying to do is to automate the browser (that's the best way to do it). You could write a script that connects to Amazon, loads the page, fills in the POST variable, send it back, get results and so on, but it is not very robust. For example, if amazon changes the name of a few post variables or even the markup, then your script would fail.
The best way to do this is to use a Browser Automation framework. Selenium is prbably the most popular and most well known. It is often used to automate testing user interfaces, but it is also useful for doing something like you are suggesting. You can use Selenium IDE which is a Firefox addon to quickly reproduce and replay recorded actions. For something more advanced and highly scriptable, try Selenium WebDriver.
As for whether this is legal or not, I don't see why it shouldn't be legal if you are using your own credit cards and what not.
If you are using your own credit card details it's at your own risk so very minimal legel issues. But it's always a good idea to store & transmit(SSL) card details encrypted for some peace of mind. But if it's for wider public you will need to look into PCI guidelines and matching class requirements.

Choosing the right Paypal system for processing registrations and subscriptions

The payments we gather on our website are for online subscriptions and registrations for conferences. In both cases, we want to gather absolutely all information other than the payment information ourselves, and ideally pass some of it on to PayPal (so users don't have to fill in name, address, etc. twice).
I know there are solutions where the information is gathered by the server itself and then redirected to PayPal via a web services call but that's not an option, unfortunately. All secure payment information gathered has to happen off-server due to network policy.
In addition, not every form will need to be processed using PayPal. Some people will be paying via check, etc. so they shouldn't be sent to a payment page at all. Most solutions I've looked at have a "Pay with Paypal" button, so I assume a form post is necessary to go to the PayPal site, but ideally we'd want to get there via a 302 redirect. Is that at all possible? (I'm aware we could do something like a form that was auto-submitted by JavaScript but I'd prefer to not go down that route).
Whichever system we implemented would need to handle recurring (periodic) payments also.
Paypal has something called Payflow Pro. They bought it from VeriSign a few years ago.
You can use it to do a full integration with the paypal api. So that the user enters their payment details on your site, and your backend code submits the transaction to paypal's servers. Paypal will then give you a transaction id back. Keep the transaction ID, chuck everything else (like the card number) out the window.
We have several clients that use Payflow Pro. It's very good and easy to use api.
I'm not entirely sure I understand the full scope of your question, but I think I do. I've coded a number these conf. registrations (though I have not interfaced with PayPal...rather iTransact and Plug'NPay) and in my applications, I had to read through the API documentation for the system being used (PayPal in this case). Then I logged into the payment gateway and usually they have an html form generator. All this does, of course, is returns an html form with the fields labeled appropriate to their API (so the billing name and address carry over from your system to PayPal's and the user doesn't have to re-enter their information), shows you what hidden fields you'll need(like cutomer_id, etc) and the form POST path.
Then what I do is I have the user register, preview their order details on another page (where you can choose to drop their info into a DB or wait until AFTER their credit card is processed) and then upon confirmation, they go to PayPal, pay with either credit card OR check (the options always exist) and when they hit confirm, the passback URL you put into a hidden var somewhere, takes you to a custom Thank You page (and hopefully processing script to capture successful transactions) which can be hosted anywhere on your servers.
It's pretty simple, just a bit labor intensive at first as you try and figure out the new form variables specific to a payment gateway API.
Hope this helped!