Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The possibility to pass/receive contact data to/from Paypal #207

Open
michaelmcandrew opened this issue Jul 28, 2021 · 2 comments
Open

The possibility to pass/receive contact data to/from Paypal #207

michaelmcandrew opened this issue Jul 28, 2021 · 2 comments

Comments

@michaelmcandrew
Copy link
Contributor

Just wondering if you considered this when doing the PayPal checkout integration.

At the moment, people have to enter their contact details twice if we want to collect them in CiviCRM. Once when they fill in the form on the website, and again when they are on the PayPal popup.

It would be good to either send details on CiviCRM to PayPal or receive the billing info from PayPal - any thoughts on how we might do that?

@eileenmcnaughton
Copy link
Owner

sorry it's been too long - but I didn't experience that - perhaps because I tested with an existing paypal account

@michaelmcandrew
Copy link
Contributor Author

@eileenmcnaughton - spent a bit of time trying to get my head around the integration :)

It looks like we might be able to capture billing fields when paypal returns us back to the page.

Here is an extract from https://developer.paypal.com/docs/checkout/integrate/#5-capture-the-transaction

<script>
  paypal.Buttons({
    createOrder: function(data, actions) {
      // This function sets up the details of the transaction, including the amount and line item details.
      return actions.order.create({
        purchase_units: [{
          amount: {
            value: '0.01'
          }
        }]
      });
    },
    onApprove: function(data, actions) {
      // This function captures the funds from the transaction.
      return actions.order.capture().then(function(details) {
        // This function shows a transaction success message to your buyer.
        alert('Transaction completed by ' + details.payer.name.given_name);
      });
    }
  }).render('#paypal-button-container');
  //This function displays Smart Payment Buttons on your web page.
</script>

It seems like details contain lots of goodies that are designed to be used to populate billing fields.

But the code in https://github.com/eileenmcnaughton/nz.co.fuzion.omnipaymultiprocessor/blob/master/Metadata/js/omnipay_PaypalRest.js looks like it is following a different CreateBillingAgreement flow, instead of the createOrder flow in the example code. My understanding is that this is the reference transactions flow.

Do you have any pointers on how we might use onApprove to capture data from details and add it to the contact? 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants