CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Exchange of information between profiles and PayPal Standard
Pages: [1]

Author Topic: Exchange of information between profiles and PayPal Standard  (Read 2580 times)

randallemery

  • Guest
Exchange of information between profiles and PayPal Standard
July 26, 2008, 08:55:40 pm
I am trying to configure CiviContribute so that when a user fills in address information on a profile, this address information will be passed to PayPal.

The profile I am using now has "primary" address fields, and the information is not passed to PayPal.  Would using another set of address fields (billing, maybe?) fix the problem.

Likewise, I have read (but not tested) that address information is overwritten when data is returned from PayPal IPN.  Which address fileds are affected?  Primary, billing, etc?

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Exchange of information between profiles and PayPal Standard
July 26, 2008, 11:23:58 pm

This was fixed here: http://issues.civicrm.org/jira/browse/CRM-3130

This will be part of 2.1. If you need it in 2.0 feel free to backport the patch which can be found here: http://fisheye.civicrm.org/changelog/CiviCRM?cs=14534

We used to overwrite the name from the information returned by PayPal. This has also been fixed in 2.1. I'm not sure what we do with the address information, so if you do test, please report back your findings.

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

randallemery

  • Guest
Re: Exchange of information between profiles and PayPal Standard
August 13, 2008, 10:43:33 am
Thanks for this reply.  Just to get back with results from testing in 2.0 on overwriting from Paypal: it was kind of interesting.  The name was overwritten, but none of the addresses were changed.

Wasn't a real big deal for us.  We decided to wait until we upgrade to 2.1 as opposed to patching.

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Re: Exchange of information between profiles and PayPal Standard
October 09, 2008, 01:42:49 pm
Quote
We used to overwrite the name from the information returned by PayPal. This has also been fixed in 2.1. I'm not sure what we do with the address information, so if you do test, please report back your findings.

This is actually what I'm interested in.  We would like for the first and last names to be updated in CiviCRM if the PayPal IPN returns something different for those fields, or at the very least record it somewhere so that we can retrieve it.  We are using 2.0.3 and this doesn't seem to be happening, though the above snippet would seem to indicate that it should have for versions prior to 2.1.

Anyone have any information on this?

Thanks,  Nathan

randallemery

  • Guest
Re: Exchange of information between profiles and PayPal Standard
October 09, 2008, 07:24:17 pm
I tested on 2.0.5 and had three address types: main, constituent, and billing.  If I remember right, there was a billing address type by default and you cannot delete it.

The name fields were overwritten, but address fields were unchanged (including billing).

Hope that answers the question.

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Re: Exchange of information between profiles and PayPal Standard
October 10, 2008, 05:08:51 am
Turns out that the contact name wasn't getting updated in our version (2.0.3) because the relevant lines (195-198) of PayPalIPN.php were commented out ... the lines that make a call to the function createContact(). What's I'm going to do now is to write another function that simply drops the first/last name as reported by PayPal into some custom fields that I've created through the web interface.  It's important for us to know the name of the person as reported by PayPal, but like most people, we don't want the original name to be overwritten.  I'll post back here when I come up with something, just in case it might be of any use to anyone else.

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Exchange of information between profiles and PayPal Standard
October 10, 2008, 08:31:40 am
nkinkade:

Code was purposely commented out. Check http://issues.civicrm.org/jira/browse/CRM-2842

Kurund
« Last Edit: October 10, 2008, 08:33:11 am by Kurund Jalmi »
Found this reply helpful? Support CiviCRM

nkinkade

  • I post occasionally
  • **
  • Posts: 56
  • Karma: 5
Re: Exchange of information between profiles and PayPal Standard
October 17, 2008, 11:34:21 am
Per my last comment that I'd post back here with my solution, here it is.  Note that this seems to work fine for v2.0.3, but I haven't tested it with anything else.

1) Create a custom data group for the PayPal data you want to capture.
    * I named the data group "PayPal Data"
    * Added two fields: First name, Last name (both alphanumeric)
       (You could add more and capture as much or little of the data as you want)
    * Make special note of the new field IDs in the table civicrm_custom_field
       (There's probably some better way to do this using an official API)

2) Edit ./CRM/Core/Payment/BaseIPN.php and add the following function, you must edit it to reflect the IDs you grabbed in step 1.

function updateFromPayPal( &$input, &$ids ) {
    # custom_23 is group "PayPal Data" field "First name"
    # custom_24 is group "PayPal Data" field "Last name"
    $params = array (
        'contact_id' => $ids['contact'],
        'contact_type' => 'Individual',
        'custom_23' => $input['first_name'],
        'custom_24' => $input['last_name']
    );
    require_once 'api/v2/Contact.php';
    $status = &civicrm_contact_add($params);
    return true;
}

3) Edit ./CRM/Core/Payment/PayPalIPN.php and add the following block to the function single() somewhere near the top:

if ( ! $this->updateFromPayPal( $input, $ids ) ) {
    return false;
}

Now the first/last name reported by PayPal will be saved in these custom data fields for the contact.  Hopefully this could be of use to someone else.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Exchange of information between profiles and PayPal Standard

This forum was archived on 2017-11-26.