Coder Social home page Coder Social logo

trewqa / cmp_payment Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 0.0 28 KB

Visitors who do not accept your CMP consents will have to pay to browse your site. Working with IAB TCF v2.2.

License: GNU General Public License v3.0

JavaScript 20.12% PHP 71.73% CSS 8.15%

cmp_payment's Introduction

CMP Payment

Lee este texto en español pulsando aquí

This project uses the IAB TCF v2.2 API to force users browsing your site to accept your CMP consents or pay to browse without accepting them.

Requirements

  • CMP based on IAB TCF v2.2 (Sirdata, Complianz, etc...)
  • PHP website (Wordpress or other PHP-based CMS).
  • MySQL and MariaDB databases support.

Authors

Installation

Files

Upload cmp_payment folder to the website root folder.

Usually the root folder is /public_html/. The folder should be available in /public_html/cmp_payment/ or https://mywebsite.com/cmp_payment/.

Database

To install CMP Payment, you must first create a table containing the access codes for paying users. You can do this from phpMyAdmin or from your favorite MySQL/MariaDB client.

CREATE TABLE `cmp_payment_tokens` (
	`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
	`token` VARCHAR(255) NOT NULL DEFAULT '' COLLATE 'utf8mb4_general_ci',
	`email_paypal` VARCHAR(255) NULL DEFAULT NULL COLLATE 'utf8mb4_general_ci',
	`expire_datetime` DATETIME NOT NULL,
	PRIMARY KEY (`id`) USING BTREE,
	UNIQUE INDEX `token` (`token`) USING BTREE
)
COLLATE='utf8mb4_general_ci'
ENGINE=InnoDB;

Files configuration

  • db.php Modify the following lines with the access data to the database where you have created the cmp_payment_tokens table.
$host = '127.0.0.1';
$user = 'mysql_user';
$password = 'mysql_password';
$database = 'mysql_database';

Modify the following lines with your PayPal email.

$paypal_email = "[email protected]";
  • lang.php You can modify all texts and language in this file.

You can change the $language variable to english for English or spanish for Spanish.

You must also modify the contact email in case of problems.

$language = "english"; // Change this according to the desired language ("spanish" or "english")

$email = "[email protected]"; // Change this with your contact email

Usage

Add this code snippet after <body> tag on your site.

<?php include $_SERVER['DOCUMENT_ROOT'].'/cmp_payment/cmp_payment.php'; ?>

Wordpress

Usually <body> tag is on your header.php theme file.

Images

Mobile

image image

PC

image

Important Considerations

After making the payment, PayPal immediately notifies the payment, but in some cases it may take a few minutes to notify the payment, so until then the code will not be reflected in the database.

Contributing

Contributions are always welcome!

If you think you can contribute improvements to this project, don't hesitate to make a pull request!

Licence

This project uses the GNU General Public License (GPL), version 3.0. Under the GPL, you may use, study, modify, and distribute the software, but you must include attribution to the original author when you distribute code or modified versions.

For more details, see the LICENSE file included in this repository.

cmp_payment's People

Contributors

trewqa avatar

Stargazers

LV avatar Karen Aguirre avatar Fernando Cortés Hierro avatar  avatar Israel avatar Elena Ortiz avatar Martín Aberastegue avatar Cesar Rada avatar Jordi Rivero avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.