29-11-2011 : Remettre dans le débat politique les principes du Conseil National de la Résistance
17-02-2012 : Pétition pour une protection de l’apiculture et des consommateurs face au lobby des OGM
Logo de mon site
Logo de mon site
Faire un don




Right menu

Logo du site ez.no  Logo XHTML 1.O du W3C  Logo XHTML 1.O du W3C  Site francophone officiel de Firefox
zero papier grâce aux catalogues et promos en ligne de bonial

eZ Publish : Selling Pay-Per-Download Products - Vendre des produits à télécharger (dématérialisés)

Table des matières

  1. Selling Pay-Per-Download Products - Vendre des produits à télécharger (dématérialisés)
  2. The buyer experience -- L'expérience client
  3. Setting up the product and permission structure -- Mise en oeuvre du produit et des permissions
  4. Payment process -- Processus de paiement
  5. Extension: Assigning permissions upon purchase part 1 -- Extension: assignation des droits à l'achat (partie 1)
  6. Pay-per-download extension part 2 -- Extension Pay-per-download (partie 2)
  7. Confirmation e-mails and pages -- Mails et pages de confirmation
  8. Extra considerations -- Considérations complémentaires
  9. Paypal Sandbox : comptes de test et devises
  10. Modification pour eZ Publish 4.3+

Payment process -- Processus de paiement

Date de publication: le vendredi 28 janvier 2011 à 00h52
Dernière modification: par Pascal BOYER le mardi 29 mars 2011 à 16h15

31-08-2009 12:00

Versions: 4.x

As there is already an in-depth article on installing a payment gateway (specifically, for eZ Authorize), this article will skip most of the theory and focus on the practical steps.
Puisqu'il existe déjà un article de fond sur l'installation d'une passerelle de paiement (tout particulièrement pour eZ Authorize ), nous éluderons ici la plupart des aspects théoriques d'une telle installation pour nous concentrer de préférence sur ses étapes pratiques.

In our example, we are requiring buyers to pay via PayPal before they can access the downloadable products. The eZ PayPal account is a workflow event that will be triggered at the correct step in the checkout process. It will handle the payment process on the PayPal site and return to the example site upon successful payment.
Dans notre exemple nous souhaitons que les acheteurs s'acquittent de leur facture via Paypal avant d'accéder au téléchargement des produits. Le compte Paypal est un événement de workflow déclenché par l'étape adéquat du processus de commande. Ce compte gèrera le processus de paiement sur le site de Paypal puis retournera sur notre site d'exemple une fois le paiement terminé avec succès.

PayPal Sandbox account / Compte Paypal Sandbox (bac à sable)

When setting up any sort of PayPal integration with a website, it is useful to sign up for a free PayPal Sandbox account. With such an account, you can create a test buyer and test seller account and buy all the example products you want! Make sure you have a PayPal Sandbox account before continuing, as you will need to use some test PayPal accounts shortly.
Au cours de la phase d'intégration de Paypal à un site web il est préférable de créer un compte PayPal Sandbox gratuit. À partir d'un tel compte vous pouvez créer un compte acheteur de test ainsi qu'un compte vendeur de test puis acheter autant de produits que désirés ! Dans la mesure où vous devrez utiliser très prochainement des comptes Paypal de test, assurez-vous de posséder dès à présent un compte Paypal Sandbox.

Note that in order to properly test the PayPal integration, you must also do your testing on a website that has a publicly available address (that is, it cannot just be "localhost") in order for the PayPal website to be able to communicate back.
Retenez que pour tester correctement l'intégration de Paypal vous devez réaliser ces tests à partir d'un site dont l'accès est réalisé via un URI public (il ne peut donc s'agir d'un accès de type localhost) afin que le site Paypal puisse communiquer avec votre site.

Installing and configuring the eZ PayPal extension / Installer et configurer l'extension eZ Paypal

The eZ PayPal extension can be downloaded at http://svn.ez.no/svn/extensions/ezpaypal/trunk/.
L'extension eZ Paypal peut être téléchargée à cette adresse: http://svn.ez.no/svn/extensions/ezpaypal/trunk/ .

Place the contents of that "trunk" folder into the folder extension/ezpaypal in your eZ Publish installation. Then, activate the extension globally in settings/override/site.ini.append.php, adding it to the "ActiveExtensions" list:
Placez le contenu du dossier trunk à la racine du dossier extension/ezpaypal/ puis activez l'extension dans le fichier settings/override/site.ini.append.php en ajoutant son nom à la liste des valeurs du tableau ActiveExtensions:

[ExtensionSettings]
ActiveExtensions[]
ActiveExtensions[]=ezpaypal

The eZ PayPal extension also has some of its own settings in extension/ezpaypal/settings/paypal.ini. The only ones that we need to worry about for now are the PayPal server name (which we will set to the PayPal Sandbox server) and the test PayPal seller account:
L'extension eZ Paypal contient également, dans le fichier extension/ezpaypal/settings/paypal.ini, quelques paramètres qui lui sont propres. Les seuls sur lesquels nous devons porter notre attention sont le nom du serveur Paypal (qui sera défini comme étant le serveur de Paypal Sandbox) et le compte vendeur de test Paypal.

[ServerSettings]
#ServerName=https://www.paypal.com
ServerName=https://www.sandbox.paypal.com
RequestURI=/cgi-bin/webscr
 
# field: "business"
# e-mail of receiver
Business=adresseMailCompteVendeurTestPaypal@xxxxx.com

A final requirement of the eZ PayPal extension is that you force buyers on your site to have eZ Publish user accounts. To do so, make sure that the webshop account handler is set to "ezdefault" in settings/override/shopaccount.ini.append.php:
Un dernier élément de l'extension eZ Paypal est requis: vous devez forcer vos acheteurs à se créer un compte eZ Publish sur votre site. À cette fin, assurez-vous, dans le fichier settings/override/shopaccount.ini.append.php, que le gestionnaire de compte du module webshop soit effectivement ezdefault:

[AccountSettings]
Handler=ezdefault

To ensure that all of these configurations take effect, clear all caches, either from the right side of the Administration Interface, or on the command line from the root of your install:
Pour vous assurer que toutes ces modifications prennent effet, videz tous les caches soit à partir de la colonne droite de l'interface d'administration soit par le biais de la ligne de commande suivante lancée depuis la racine du répertoire d'installation de votre site:

php bin/php/ezcache.php –clear-all

As is the usual process with eZ Publish 4.0 and higher, you must now re-generate the autoloads file, either on the Setup > Extensions page in the Administration Interface, or on the command line from the root of your install:
Comme cela est la procédure normale depuis la version eZ Publish 4.0, vous devez maintenant régénérer le tableau d'autochargement soit à partir du lien Extensions de l'onglet Administration de l'interface d'administration soit à partir de la ligne de commande suivante lancée depuis la racine du répertoire d'installation de votre site:

php bin/php/ezpgenerateautoloads.php -e -p

("-e" to generate the extension autoloads and "-p" -- available in eZ Publish 4.1 and higher -- to show a nice progress bar)
(«-e» pour générer l'autochargement de l'extension et «-p» (disponible à partir de la version eZ Publish 4.1) afin d'afficher une belle barre de progression)

Setting up the eZ PayPal workflow / Définir le workflow eZ Paypal

Although the eZ PayPal extension is now activated and ready to use, you must also instruct eZ Publish on when to actually run it. This is where we will plug it into the workflow system. This involves creating a workflow group, creating the workflow, and assigning it to run at the appropriate trigger; all of this is done in the Administration Interface.
Bien que l'extension eZ Paypal soit à présent activée et prête à être utilisée, vous devez tout de même informer eZ Publish du moment où il devra l'exécuter. Pour cela il nous faut connecter l'extension au système de workflow. Nous allons donc créer un groupe de workflow et un workflow puis assigner ce dernier au déclencheur approprié: tout ceci sera effectué depuis l'interface d'administration.

First, on the "Setup > Workflows" page, click the "New workflow group" button. Name the workflow group "Payment gateways". Workflow groups serve only to organize workflows.
Tout d'abord, à partir de la page «Administration -> Workflows», cliquez sur le bouton Nouveau groupe de workflows et nommez-le Passerelle de paiement. Les groupes de workflows n'ont d'utilité que celle de classer les workflows.

When viewing the new workflow group, click the "New workflow" button. Name the workflow "Payment and Fulfillment", select "Event / Payment Gateway" from the dropdown list, and click the "Add event" button.
Lorsque vous affichez le nouveau groupe de workflows, cliquez sur le bouton Nouveau processus de workflow. Nommez ce dernier Paiement & Téléchargement, sélectionnez l'événement Événement / Passerelle de paiement et validez avec le bouton Ajouter un événement:

Payment and Fulfillment Workflow/ Le workflow Paiement & Téléchargement

Select the "Paypal" type, add a useful description, then click the "OK" button.
Sélectionnez le type Paypal, ajoutez une description explicite puis validez avec le bouton OK.

Your new workflow can now be assigned to the appropriate trigger. Click the "Triggers" link in the left menu, then select "Payment and Fulfillment" as the workflow to run before the "checkout" function of the "shop" module.
Votre nouveau workflow peut être à présent assigné au déclencheur idoine. Pour cela, cliquez sur le lien Déclencheurs dans le menu gauche, sélectionnez Paiement & Téléchargement comme workflow de la fonction checkout du module shop:

Shop Checkout Before Trigger/Déclencheur «Shop Checkout Before»

More testing / Plus de tests

To make sure that your PayPal workflow is running properly, you can buy your PDF product using your Test User account. However, first log in to your PayPal Sandbox account.
Pour vous assurer que votre workflow Paypal fonctionne correctement vous pouvez acheter votre livre PDF en utilisant le compte Utilisateur De test. Vous devez cependant vous connecter préalablement à votre compte Paypal Sandbox.

After you add the PDF product to the shopping cart, proceed to check out, and click the "Confirm" button, you should be redirected to the PayPal Sandbox site, prompting you to log in and pay for the product (using your test PayPal account).
Après avoir placé le livre PDF dans votre panier, passez la commande et confirmez-la. Vous devez alors être redirigé vers le site Paypal Sandbox qui vous proposera de vous connecter pour payer le livre (via votre compte de test Paypal).



Table des matières

  1. Selling Pay-Per-Download Products - Vendre des produits à télécharger (dématérialisés)
  2. The buyer experience -- L'expérience client
  3. Setting up the product and permission structure -- Mise en oeuvre du produit et des permissions
  4. Payment process -- Processus de paiement
  5. Extension: Assigning permissions upon purchase part 1 -- Extension: assignation des droits à l'achat (partie 1)
  6. Pay-per-download extension part 2 -- Extension Pay-per-download (partie 2)
  7. Confirmation e-mails and pages -- Mails et pages de confirmation
  8. Extra considerations -- Considérations complémentaires
  9. Paypal Sandbox : comptes de test et devises
  10. Modification pour eZ Publish 4.3+