I’ve been mucking around with PayPal for a while and decided to try out the adaptive_payments gem by Tommy Chheng. Unfortunately I ran into the following error:
Neither PUB key nor PRIV key:: nested asn1 error
It turns out that I’d simply skipped an important part of the readme file. The api_cert_file in the paypal_adaptive.yaml file should point to a file containing BOTH your paypal_cert_pem.txt and whatever your private key happens to be. This took an embarrassingly long time for me to figure out, so hopefully this will help some of you!
It turns out I still had this wrong, I was using the wrong certs. After sorting out a few more errors that I ran into after the one mentioned above I finally started getting a response from Paypal, unfortunately it was another error message:
Authentication failed. API credentials are incorrect
It turns out I was using the wrong certs. If you’ve run into the same problem you’ll need to go to Profile > Request API Credentials > Option 2 (Request API credentials to create your own API username and password.). Then download the cert and point to this.
Hey everyone, just another update to this. If you happened to be following the railscast on PayPal before attempting to use the gem, you may not get the option to download the certs mentioned above. To get around this, simply remove your existing certificates (Profile > API Access > Option 2 > Remove > Remove). You should now see the ‘Request API Certificate Option’.
Sorry about the confusing post, but there’s a *slight* chance it might be able to help someone else who runs into the same problem.
I needed to do a fair bit of logging and came across a heroku guide that shows how to make things a little easier.
Change logging level to debug:
heroku config:add LOG_LEVEL=DEBUG
View a live(ish) feed of errors:
heroku logs –tail
If you’re aware of any other useful bits please let me know!
Just a quick post on how to block duplicate payments with PayPal. All you have to do is pass an invoice parameter and then select the ‘block multiple payments per invoice ID’ option in PayPal. I’ve attached an extract from PayPal’s documentation below:
1. Login at https://www.paypal.com
2. Click the ‘Profile’ subtab
3. Under ‘Selling Preferences’ click ‘Payment Receiving Preferences’
4. Choose ‘Yes, block multiple payments per invoice ID’ if you wish to utilize this feature while passing the “invoice” variable
5. Scroll to the bottom and click the ‘Save’ button
To pass the invoice number for Website Payments Standard, you will need to add a line of code to your existing button code. You cannot add this code to a button originally created as encrypted. Example below:
<input type=”hidden” name=”invoice” value=”001″>
The documentation is available at the following link:
Just a quick post detailing how to limit uploadify to a single file. Simply add the following settings to your uploadify initialisation:
queueSizeLimit : 1
uploadLimit : 1
'swf' : '<?php echo $this->Html->url('/uploadify/uploadify.swf');?>',
'uploader' : '<?php echo $this->Html->url('/uploadify/uploadify.php');?>',
'cancelImg' : '<?php echo $this->Html->url('/webroot/uploadify/cancel.png');?>',
'folder' : '<?php echo $this->Html->url('/extraz/uploaded_by_all_users');?>',
'auto' : true,
'buttonText' : 'Browse',
'multi' : false,
'queueSizeLimit' : 1,
'uploadLimit' : 1,
'sizeLimit' : 1073741824,
'debug' : true,
'multi' : false,
'onUploadProgress' : upload_progress_handler,
'onUploadStart' : upload_start_handler,
'onUploadSuccess' : on_upload_success,
'onUploadError' : on_upload_error
Once the upload limit is exceeded the onUploadError event is raised.
Just a quick post on how to view recent queries run into an Oracle database:
SELECT sql_text, sql_fulltext
ORDER BY last_load_time DESC
Just a quick post showing the config I needed to use in order to get KDiff3 working with git. It took a while to get this working so hopefully it’ll be able to help someone else out.
email = email@example.com
name = test
editor = \"C:\\Program Files\\Sublime Text 2\\sublime_text.exe\"
whitespace = fix
branch = auto
diff = auto
interactive = auto
status = auto
pager = less -FRSX
whitespace = cr-at-eol
autocrlf = input
excludesfile = /Users/test/.gitignore_global
editor = mate -w
co = checkout
lg = log --graph --pretty=oneline --abbrev-commit
recentrepo = Y:/Projects/Junk
recentrepo = C:/xampp/htdocs/onlinemedia
tool = kdiff3
Screenshot of git config from GUI:
Git Config KDiff