DPO Radio

Free Website Privacy Check: Ensure Your Site's Compliant Now!

Integrate PayPal with WordPress for GDPR Compliance

Integrate PayPal with WordPress for GDPR Compliance

How to Integrate PayPal Buttons and Payment Gateways in WordPress for GDPR Compliance Using AesirX Analytics & CMP

Adding PayPal buttons and payment gateways to your WordPress site can significantly boost your e-commerce capabilities. However, it’s essential to ensure that these integrations comply with GDPR regulations to protect user data and avoid legal complications.

This guide will walk you through the process of integrating PayPal buttons and payment gateways on your WordPress site while maintaining GDPR compliance using AesirX Analytics & CMP. Additionally, you’ll benefit from AesirX’s first-party analytics, which helps reduce reliance on third-party tracking and enhances your data privacy practices.

Compliance Risk: Using PayPal without explicit and informed consent is non-compliant. Read more to understand the legal requirements and risks involved.

Step 1: Prepare Your WordPress Site

  • First, install WordPress on your server or choose a WordPress-compatible hosting provider. 
  • Pick a theme that suits your brand and provides a good user experience. 
  • Add essential plugins to enhance your site’s functionality, such as those for SEO, security, and performance.

Step 2: Remove or Deactivate PayPal Payment Gateway Plugin (if Installed)

1. Check if PayPal Payment Gateway Plugin is Installed:

  • Go to your WordPress dashboard and navigate to Plugins > Installed Plugins.
  • If the PayPal Payment Gateway plugin is listed, click Deactivate or Delete to remove it.
  • Using the plugin version of PayPal can interfere with this setup.

2. Confirm Plugin Removal:

  • Ensure that the PayPal Payment Gateway plugin is fully removed from your plugin list before proceeding.

NoteAfter removing the PayPal Payment Gateway plugin, you can set up PayPal payments with AesirX Analytics using the provided embedded code. This method allows you to manage user consent and maintain GDPR compliance without relying on the plugin.

Step 3: Set Up PayPal Payments with AesirX Analytics Embedded Code

  • Setup AesirX Analytics: Begin by setting up AesirX Analytics. Follow the instructions here.
  • Follow PayPal instruction and get CLIENT-ID here
  • Setup a container element for the button in HTML <body>:
copy icon
<!-- Set up a container element for the button -->
<div id="paypal-button-container"></div>
  • Add the PayPal Script: Embed the following script in your site:
    • Option 1: Theme File Editor:
      • Go to your WordPress dashboard and navigate to Appearance > Theme Editor.
      • Open the footer.php file (or another appropriate file where scripts are added) and paste the code before the closing </footer> tag.
    • Option 2: Widgets > Custom HTML:
      • Go to Appearance > Widgets.
      • Add a Custom HTML widget to your desired widget area (like a sidebar or footer) and paste the code there.
  • Script to Embed
copy icon
<script type="module">
  window.funcAfterConsent = async function () {
    var script = document.createElement("script");
    script.type = "text/javascript";
    script.async = true;
    //Change CLIENT-ID to your CLIENT-ID
    script.src =
      "https://www.paypal.com/sdk/js?client-id=CLIENT-ID&currency=USD";
    document.head.appendChild(script);
    var scriptPaypal = document.createElement("script");
    scriptPaypal.type = "text/javascript";
    scriptPaypal.text = `
         paypal.Buttons({
            createOrder: function(data, actions) {
                return fetch('/demo/checkout/api/paypal/order/create/', {
                    method: 'post'
                }).then(function(res) {
                    return res.json();
                }).then(function(orderData) {
                    return orderData.id;
                });
            },
            onApprove: function(data, actions) {
                return fetch('/demo/checkout/api/paypal/order/' + data.orderID + '/capture/', {
                    method: 'post'
                }).then(function(res) {
                    return res.json();
                }).then(function(orderData) {
                    var errorDetail = Array.isArray(orderData.details) && orderData.details[0];

                    if (errorDetail && errorDetail.issue === 'INSTRUMENT_DECLINED') {
                        return actions.restart();
                    }

                    if (errorDetail) {
                        var msg = 'Sorry, your transaction could not be processed.';
                        if (errorDetail.description) msg += '

' + errorDetail.description;
                        if (orderData.debug_id) msg += ' (' + orderData.debug_id + ')';
                        return alert(msg);
                    }
                    console.log('Capture result', orderData, JSON.stringify(orderData, null, 2));
                    var transaction = orderData.purchase_units[0].payments.captures[0];
                    alert('Transaction '+ transaction.status + ': ' + transaction.id + '

See console for all available details');
                });
            }

        }).render('#paypal-button-container')
      `;
    document.head.appendChild(scriptPaypal);
  };
</script>

Step 4: Integrate AesirX Analytics & CMP

  1. Install the AesirX Analytics & CMP Plugin:
    • In your WordPress dashboard, go to Plugins > Add New and search for "AesirX Analytics".
    • Click "Install Now" and then "Activate".
  2. Create an AesirX Account and Obtain an Analytics License:
    • Register on the AesirX Sign-Up Page. (Note that you will be redirected to register for a Shield of Privacy (SoP) account - this acts as your AesirX Account ID and provides access to access all AesirX solutions and licenses)
    • Choose your Shield of Privacy ID.
    • Select “First-Party Analytics” from the Solutions drop-down menu. 
    • Receive your license ID and confirmation email to complete the setup.
  3. Configure AesirX Analytics:
    • Navigate to Settings > AesirX Analytics in your WordPress dashboard.
    • Configure server setup (internal or external) and ensure consent is required before data collection.
    • Paste your solution key and click “Save” to apply changes.
  4. Set Up Consent Templates: 

AesirX supports two consent modes compatible with Google Consent Mode V2, but with enhanced compliance features:

  • Simple Consent Mode: No data is collected or sent to any third parties until users provide explicit consent - ideal for strict GDPR and ePrivacy compliance.
  • Default Template: Tags are preloaded with denied parameters and do not collect, store, or send any data until consent is obtained - supporting compliance while preparing for data collection after user consent. 

Note: While Google Consent Mode V2 allows for tag loading with denied parameters, AesirX's approach of not loading any tags until consent is given minimizes compliance risks associated with GDPR and ePrivacy Directive regulations.

  1. Steps:
    • Go to AesirX BI > Consent > Consent Templates.
    • Input your Google Tag ID and Google Tag Manager ID (Optional). 
    • Choose your preferred consent mode and customize the consent text.
    • Click “Save”.

tag.jpg

Step 5: Implement Site-Wide and Opt-In Consent

To comply with GDPR and ePrivacy, manage user consent effectively through a two-tiered approach:

  1. Site-Wide Consent: 

Customize Site-Wide Consent:

AesirX integrates automatic site-wide consent, prompting users to provide general consent before loading any tracking scripts or third-party services. Customize the consent text to be clear and informative.

  • Go to AesirX BI > Consent Templates and update the consent text.
  • Example Text:

“We use AesirX Analytics and Consent Management Platform (CMP) to manage your data preferences. You can choose to:

  • Reject: No data will be collected.
  • Consent: Allow data collection to improve site performance and user experience.
  • Decentralized Consent: Retain control over your personal data and revoke consent anytime.

Data may be used for payment processing, analytics, and marketing purposes, including tracking by PayPal and AesirX Analytics, as outlined in our Privacy Policy.” 

Note:

1. Ensure your privacy policy is updated to explicitly mention the collection, processing, and use of data by PayPal, AesirX Analytics, and any other third-party services. Clearly inform users about how their data will be used and shared. 

2. Please include any other third-party services as applicable in your implementation. For step-by-step instructions, refer to our How-To Guides.

Handling Consent Rejection:

If a user rejects consent, explain the limitations and suggest using decentralized methods for better control. Currently, you can't customize the site-wide rejection message. 

To manage rejections effectively, switch to opt-in consent. This allows you to handle rejections on a case-by-case basis. Follow the instructions in the opt-in consent setup guide.

Revoking Consent:

AesirX supports decentralized consent management via a wallet and Shield of Privacy (SoP). Users can revoke consent directly on the site or through the AesirX dApp. This aligns with GDPR's requirement for easy consent withdrawal options.

consent_modal.jpg

  1. Opt-In Consent for Specific Functionalities: 

For features like payment processing or customer support tools, use opt-in consent to activate third-party services only after explicit user approval. This approach minimizes data collection, limits third-party sharing, and enhances user trust by clearly explaining how their data will be used. 

Customize Opt-in Consent:

  • Example JavaScript for Opt-In Consent: (Use Site Consent and Opt-In Consent in Combination) 
copy icon
<script>
    window.optInConsentData = `[
      {
        title: "payment",
        content: "<div>YOUR_CONTENT_INPUT_HERE</div>",
      }
    ]`;
</script>
  • Optional Configuration: Replace Site Consent with Opt-in Consent
copy icon
<script>
    window.optInConsentData = `[
      {
        title: "payment",
        content: "<div>YOUR_CONTENT_INPUT_HERE</div>",
        replaceAnalyticsConsent: "true",
      }
    ]`;
  </script>

Handle Reject Consent:

  • If a user rejects consent, display a message indicating that consent is required for the functionality to work.
  • Example:
    • Wide-site consent:
copy icon
window.funcAfterReject = async function () {
  // Show a message or label indicating that consent is required
  alert(
    "Consent is required for this functionality to work. We use this third-party service for [specific purpose], and it cannot operate without your consent"
  );
};
    • Opt-in Consent:
copy icon
window.funcAfterRejectOptIn = async function () {
      alert(
        "Consent is required for this functionality to work. We use this third-party service for customer support, and it cannot operate without your consent."
      );
};

Notify Users About Consent Status:

  • Inform users if they have rejected consent and how it affects their experience on the site.
  • Example Notification:
copy icon
document.addEventListener("DOMContentLoaded", function () {
  if (sessionStorage.getItem("aesirx-analytics-consent") !== "true") {
    alert(
      "Consent is required for payment processing through [Payment Processor Name]. We cannot complete transactions without your consent. Please adjust your preferences to continue using our payment services with [Payment Processor Name]"
    );
  }
});

Customize Consent Messages:

  • Edit your consent forms to include clear information about the use of these third-party widgets and the purpose of data collection. 
  • Example Alert Text: We use [Payment Processor Name] to handle transactions. To process your payment, we need to track and collect data related to your order. This includes sharing relevant information with [Payment Processor Name]. If you do not consent to this data sharing, you will not be able to complete your purchase. For more details, please refer to our Privacy Policy.

Installation Tip:

When setting up AesirX Analytics & CMP with PayPal, follow these steps for compliant consent handling:

  1. Start with a Site-Wide Consent Banner: 

Add a simple site-wide banner to collect general consent for basic data collection including AesirX Analytics & CMP. This banner will cover essential tracking tools and functions necessary for your site’s operation while maintaining GDPR and ePrivacy compliance.

  1. Add Opt-In Consent for PayPal and Other Specific Functionalities

For payment processing via PayPal, use opt-in consent to ensure that data related to transactions is only collected after users explicitly consent. Additionally, other third-party services such as CRM systems or chatbots should be enabled only after users grant specific consent. This approach supports data minimization principles and enables compliance with GDPR while providing a smooth and secure payment experience for your users.

  1. Bonus - Benefit from First-Party Analytics

By integrating AesirX Analytics & CMP, you’ll not only manage compliant consent but also gain access to privacy-focused, first-party analytics. This approach helps you gather insights without relying on third-party tracking, enhancing privacy and maintaining robust data analytics. 

Step 6: Utilize AesirX Tools for Enhanced Compliance

  1. First-Party Server: 

Transitioning to AesirX’s first-party tools significantly enhances performance and scalability. While the AesirX Analytics WordPress Plugin defaults to using the internal WordPress database for data storage and processing, opting for a dedicated first-party server offers even greater benefits. 

Configuring your own server allows you to optimize performance for your site’s specific needs, effectively scale resources to handle increased traffic, and maintain complete control over your data. This setup ensures that your data is hosted and managed entirely within your own infrastructure, free from third-party limitations. For detailed guidance on implementing and configuring your first-party server, refer to our First-Party Server How-To Guide.

  1. Privacy Scanner: 

Regularly use AesirX Privacy Scanner to monitor and ensure ongoing compliance. The Privacy Scanner helps ensure that your site adheres to the ePrivacy Directive and GDPR by identifying non-compliant elements such as cookies, trackers, and beacons. It provides detailed compliance reports and actionable insights for resolving detected issues. For detailed instructions on using the Privacy Scanner, refer to our Privacy Scanner How-To Guide.

  1. Privacy Monitoring: 

Implement AesirX’s Privacy Monitoring to continuously track and manage privacy compliance on a daily, weekly, monthly, or custom schedule. These services provide real-time updates and alerts on any changes that could impact your compliance status, ensuring you stay informed and can take prompt action when needed. Discover how to set up and utilize privacy monitoring in our Privacy Monitoring How-To Guide

content.jpg

Step 7: Ongoing Monitoring and Optimization

To maintain compliance and ensure optimal performance, regularly review and refine your consent management setup: 

  1. Test and Review Consent Records:
    • Consistently monitor consent records in AesirX BI > Consent > Overview. This helps ensure that all consent activities are accurately tracked and aligned with compliance requirements.
  2. Update Consent Forms:
    • Periodically update your consent forms to reflect any changes in data collection practices or third-party integrations. Keeping these forms current ensures that users are always informed about how their data is used.
  3. Verify Third-Party Integrations:
    • Routinely check that all plugins and third-party services adhere to the consent choices configured through AesirX CMP. This ensures that your data practices remain compliant and transparent.
  4. Analyze Performance Metrics:
    • Continuously analyze consent and engagement metrics in AesirX BI > Consent > Overview. Use these insights to refine your consent management approach and enhance the user experience.

By integrating PayPal buttons and payment gateways with AesirX Analytics & CMP, you achieve GDPR compliance and benefit from first-party data collection. This setup enhances user trust, safeguards data privacy, and offers a solid foundation for managing consent across your site.

For more detailed guidance, explore AesirX’s resources on digital privacy and compliance management. 

Enjoyed this read? Share the blog!