I want to draw your attention to something new that I’ve added to the Lesson Resources list and that is a link to WP eStore’s page on Amazon AWS S3 URL Configuration.
Test A Transaction
And now we’re going to start another transaction here on our Store, essentially picking up where we left off last week with testing a transaction. Go to Our Products and come over to our Store and by WordPress Instruction, we’re going to add it to the cart at which point we will continue to “Checkout with PayPal”.
We’re going to that process right now and then we want to use not our real PayPal email address obviously, we’re using the purchaser account that we created in the Sandbox. The account I’m going to use here is firstname.lastname@example.org. So I’m going to Agree and Continue. You can see the order processing is ready for me to complete, so we’ll just say, yes, use that as the shipping address but we don’t actually need the shipping address and now it says, “Thanks for your order”, “You’re now going back to Rick Anderson’s Test Store” and we’re brought back to our “Thank You” page.
Now, if we click on this link, it’s going to fail and I want you to see the codes that are going on in here that are failing. The code is “SignatureDoesNotMatch” and the message is “The request signature we calculated does not match the signature provided. Check your key and signing method.”
This is an error that is related to the way we have configured and set up everything in Amazon S3. When you see an error like this, you’re bound to wonder what is the potential area of the problem. Last week you saw us troubleshooting this and we opened up the error logs and it looked like everything was processing correctly but what we should do first is take the financial processing out of the equation.
Troubleshoot Failure – Remove Financial Processing from the Equation
When troubleshooting, we did look at the error log and did look like everything worked okay from the error standpoint. But we should try this one more time where we are not testing it at the same time as we’re testing exchanging money. Fortunately that’s not a particularly difficult thing to do.
Add Download Now Button
I want to save this error code, you can see also that the error is being generated by Amazon S3. Let’s come back over to our site again, estore3. Now instead of going through this purchase process, what I’m going to do is I’m going to add a “Download Now” button here to test that product.
I will remind you of the fact that we have this WP eStore Shortcodes Cheat Sheet that you can download here. I’m going to open that up now because we’re going to go down to our Download Shortcodes. The one that we’re going to use is this “Download Now” button. So we’ll copy that button and I’m just going to edit this page and put that there although that’s not the right product ID. I want to check the same product that I just tried to purchase so I’m going go into WP eStore and find out what that product ID was.
That was WordPress Instruction…WordPress eBook, that’s what it was right there, product number 25. So instead of product ID 1, we’re going to say 25. We’ll hit Update and then we’re going to come view the page. Now we have this “Download” button here which is not going to ask us for any money but it should provide us with an encrypted link. If this works, we know the problem is in the financial transaction part of it and if this doesn’t work, we know the problem is in our Amazon set up.
Troubleshoot Failure – Error Isolated to Amazon S3 Settings
Click “Download” and there you go, I get exactly the same error. We have isolated the error and we know it’s not associated with the ability to take money and make decisions based on that money, it is associated with the way we have Amazon set up. I’m going to close that and direct you to this article, WP eStore Amazon AWS S3 URL Configuration.
The first thing I want to do with you is troubleshoot our credentials. This says, “SignatureDoesNotMatch”, “The request signature we calculated does not match the signature you provided. Check your key and signing method.”, which suggests that our API Key is potentially incorrectly formatted.
Access Key and Secret Access Key Not the Problem
We’ll come back over here to our Addon Settings then what we need to do is check to see whether or not there is an issue here with our access key and our secret access key. We do that by, of course, going to aws.amazon.com and logging into our Management Console. We’ll come over to our Credentials. I already have an IAM that I created, this is their new credential system and you can create as many users as you want.
We’ll create a user, let’s just say a testuser and let’s open it up and look at Permissions. We want to attach user policy to this that has Read Only access. Then let’s look at their Security Credentials…let’s give this user a password. Then we’re going to look at our access keys. e’ve got our access ID and then we have our secret access key which is that, okay. It looks like we’ve got everything setup properly, we’ll go ahead and hit Update.
We’re going to try it again. Hit “Download”, okay it says, “The request signature we calculated does not match the signature you provided”, so that didn’t really work. Now, I deliberately made it fail and the reason I deliberately made it fail, oh actually, it didn’t. I failed to deliberately make it fail, let’s try it now.
Notice I put a trailing space in there, this is something that often happens when you cut and paste out of Amazon depending upon what browser you’re using and that trailing space in there can cause this to fail. I thought I placed that trailing space in and obviously I hadn’t or it had deliberately attempted to fix that, let’s click “Download” again.
We’re still getting the same error message here so the first thing I want to point out to you is absolutely to make sure there is no trailing space and by trailing space I mean any space after the code, this has nailed me several times before although it’s not our problem here.
Failure Found in URL and Bucket Name
So since our access key is not our problem then the only thing left for it to be is our URL as our problem. Let’s come over to our Manage Products and go to product number 25. Edit this, go to our Digital Content Details and look at our link, it looks like it’s probably right.
Let’s come over here and take a look at S3. We’re looking at my buckets and so I’ve got this BYOB Website bucket products and inside that products, I have a folder called eBooks and inside that I have this. If I click Properties, there’s my URL but there’s a subtle problem here, I’m going to paste that URL here so you can see it.
How to Correct the Problem
You may remember from our first lesson where we said that you have to replace this as3tp:// with http. And we’ve done that here but there’s one other thing and I didn’t notice this and that is that there’s actually a format that is quite a bit different than the original URL.
It’s not just ast3p:// it’s also the bucketname.s3.amazonaws. Let’s look at the one that we actually have in there. You see it does have the as3tp://s3.amazon and so on and so forth. That’s got exactly the same URL here and we replace the https with as3tp but what we’re missing is the rearrangement of the bucket name in front of the amazonaws.com.
Again, if we take a look their example, here is how this should look. We’ll grab this one and paste it in. It should say as3tp, our bucket name then s3.amazonaws.com and then folder and object. In our case, our bucket name is byobwebsite.products. So I’ll cut that out and I put it in front of the s3. Put my period in and then get rid of my additional space and now I have it in that format.
I’ve got the special protocol format then I’ve got my bucket name then I’ve got the .s3.amazonaws.com then I’ve got the folder inside that bucket and then I’ve got the object which is the file we want to download. So, the way I had created all of these URLs was incorrect because I’d forgotten that I needed to rearrange the bucket name so that the bucket name came before s3.amazon.aws.
Retest Transaction with Download Button
If we switch to this now, come back over to WP eStore and change the download URL so it’s that as3tp://byobwebsite.products.s3.amazonaws.com, this is now going to work. Hit Save Product and then we go back to our front page and refresh it. Click on “Download” and you can see it’s downloading. Now that it has download, I can open the file up and there it is, the eCommerce Plugin Comparison.
Retest Transaction with Financial Element (PayPayl)
The actual problem was that the URL was incorrectly formed in this product. So now let’s actually go back and test the sale system again. So we come back to Our Products and Instruction, WordPress Instruction and “Add to Cart” the WordPress eBook. We’re going to “Checkout with PayPal”, we’ll just do this whole thing one more time.
Wait for redirection, now we’ve been brought to the “Thank You” page and “You can download your products from the links below.” If we click on this product, now it downloads,
There’s another component to this though and that’s the email component. I’m going to log in to this test Gmail account, mail.gmail.com, this is test3 I want to do test2. Here it is from today, “Thank you for your purchase” and this is the latest purchase. So this is the link that’s going to work so if I click on that link, it’s asking how I want to save it, let’s go ahead and open it and there it is, it works.
That process is now working the way that we want it to, that is you get the “Thank You”, “Download” and everything else. Now, let’s just go take a look at that in sandbox.paypal.com and the first thing I need to do is sign in as my real self.
I’m in the test site so I don’t believe I need to do that anymore so now it’s byobtest2. I just signed in as a user and I can see I made two payments to Rick Anderson’s Test Store and if I come back over and log in now as the seller. Let’s go to developer.paypal.com and I’ll log in so I can see my account. I’ll come over to Applications and the Sandbox to get my account information.
Now I can see I got 2 payments from ricktest2 and can look at my details and see the transaction details. If I go to my test accounts, go to my dashboard and look at Sandbox Notifications I can see that “Notification of payment received” was sent. I can see that byobtest has sent a “Receipt for Your Payment to Rick Anderson’s Test Store” which actually did happen. So all of those emails were processed correctly, all the funds change hands the right way and I was able to download the product which means that we now have a successful transaction.