Forum

Thread tagged as: Question, Addons, PayPal

Unsure what "code" is required when adding a product via the shop-paypal app, an...

So far, using Perch to build my very first content-manage site has been a wonderful experience.

Thoughtful videos, and detailed documentation generally abound. You guys are doing wonderful things here.

However, when attempting to implement the shop-paypal app, the documentation regarding the actual use of it is very sparse, and there appear to be no videos at all. This has been a stumbling block for me.

I believe I have it installed correctly, as products added appear in the cart, and I can even go as far as to begin the checkout process with paypal.

I am confused, however, as to what to put in the "code" input box when adding a product via the shop app within perch.

I have, for the time being, simply placed gibberish text and it appears to work, on a functional level, just fine.

I tried creating an identical product on paypal, and copying the code for the "add-to-cart" button into this input within perch, but it seemed to add an "upload image" form button into the item, when rendered on the actual site, so surely this can't be right.

I currently feel lost, and frustrated.

Specifically my questions are as follows:

1) What code should I place in the "code" input box when adding a product within perch?

2) Is there any sort of "walkthrough" for implementing the shop-paypal app, like there is for installing it?

3) Must I expect the user to create an identical product/button via pay pal's website, and copy/paste this every time they want to add a product in perch?

4) How can I "test" the site without using actual "real money" transactions.

Thank you so much for your time, and for this so-far great product.

P.S. I am aware that it is entirely possible that I am simply experiencing an "ID10T" error. As someone new to web development (10 static, non-responsive websites, and only 3 with paypal integration, all of which were via copy/pasting product buttons into my sites, and none of which had any sort of CMS) please be kind. Thanks in advance.

Michael Griffin

Michael Griffin 0 points

  • 7 years ago
Rachel Andrew

Rachel Andrew 394 points
Perch Support

  1. Anything you like, your internal product code.

  2. The shop ships with example pages which are fully functional. You do not need to create "buttons" on PayPal - I would start out with our example pages and work from there.

  3. No, you just pass the products through to PayPal.

  4. You can create a PayPal sandbox account as usual and use that. That doesn't have any bearing on Perch functionality.

First, thank you so much for your rapid response! And on a weekend, no less.

I'll explore the example pages in greater detail, although those are what I have used to get as far as I have now.

As far as the Paypal Sandbox, I previously stumbled across THIS POST, in which Drew suggests there are 4 places where paypal.com would need to be replaced with, presumably, sandbox.paypal.com. After trying to test this myself, I am having the exact same problem as described in that post, wherein my paypal sandbox "personal" (aka "pretend customer") account is being denied access during the checkout process, even though the email and password are correct.

I assume this is because perch is trying to interact with the real Paypal servers, and not the sandbox servers, and therefore it is not allowing my sandbox "personal" account (which has 9,999 pretend dollars in it ;-) access to the real servers. This would explain why Drew has suggested that the paypal.com URLs be replaced.

Though the topic has been closed, the specifics still seem muddy to me.

1) Are you saying the shop-paypal app has been updated and I shouldn't need to replace these URLs anymore?

2) If I do, in fact, still need to replace them, where would I replace them, exactly? Would I simply replace these URLs in the shop/index.php, category.php. and product.php pages (using the example pages, for clarity), or must they be changed somewhere in perch's core files?

As far as the code input box, and specifically what code to include in that code input box, I am still confused.

2) What if I don't want my client to have to include any code when they add a new product? Is there a way to leave it blank. As of now, it won't allow me to leave it blank, and I would prefer my client never have to even see code.

3) Is this code something that would interact with Paypal's API, and would I have to explore their documentation to understand what it is? Do you have any example code shown anywhere?

The product pages that shipped with the shop don't seem to have any "example" products loaded already, so I don't see any examples of what this code could be. I apologize again if I am being thick.

All I want is for Paypal to process the payment, and upon receipt of the payment, have perch reduce the available stock by how many were purchased (as is explained in the documentation). I don't need the site to be any more complex than that.

The TL:DR is this: If I could get the example pages, to which I have added a product, to connect to pay pal's sandbox servers, so I can see how perch behaves once a product has been purchased, I believe I could then figure out how it works through trial and error.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

PayPal requires a unique code as far as I remember so your client will need to add one. As for the Sandbox you'll need to check with the PayPal documentation what is currently required at that end. The app is just a very simple product listing to use with PayPal, most of the functionality is on the PayPal side so you do need to have an understanding of how PayPal carts work.

I am just replying for posterity's sake, in case anyone is reading this thread at a later date.

paypal.minicart.render({action: "https://sandbox.paypal.com/cgi-bin/webscr"});

This worked perfectly.

  • 2) I feel pretty silly about this one. The "code" that the perch shop is asking for when you create a product is just your personal, internal product code. This is something my client had not yet developed, and the first time I've done this sort of thing, so I didn't know what it was asking for.

For example if you were selling 'Sandalwood Soap' your product code for that product might be something like "SP-SNDLWD" It is not expecting PHP code, which for some dense reason, is what I thought it was asking for.

Thanks again for the great product, and for pointing me in the right direction!