Paypal profile field

Posts: 73
Joined: 12/10/2007

I'm going to start work on the capability to use different paypal info based on the product being sold.

My idea right now is the payment system would look at the author of the product, and if they have a 'paypal' field set in their profile it will use that information to process the payment instead of the store default.

The other idea was to add a cck field to product that would hold the paypal info. It would be used if not empty otherwise the store default info is used.

Any suggestions on where to start and hooks to use?

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

I think you'll want to check out hook_user() to get it done... and what you've described sounds reasonable... check the author of the node, see if their profile has a value for this, and if not default to the store's address. You can use hook_form_alter() on the form with ID uc_paypal_wps_form to change the value of the hidden 'business' element to be the right e-mail address. (I'm assuming you're using Website Payments Standard here.)

Posts: 73
Joined: 12/10/2007

I think it would be the same process for paypal pro or standard right? Just add the profile fields for api key, etc.

Posts: 5367
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Aye, should be. You might consider the security aspect of someone giving away their API credentials for a WPP account, though, as that requires a business account and costs money to use. I'd do something to ensure that only that user is able to see their API credentials.

Posts: 73
Joined: 12/10/2007

I'm pretty sure you can make profile fields hidden.

But thinking about it, paypal pro probably be more hassle and needless complication.