  You are here:
 Goal: Using PayPal as an integrated payment processor. Expected experience or knowledge: Any knowledge of the PayPal Express Checkout may become handy, but is not strictly necessary. See PayPal's websites for more information. Have a look at this PayPal introduction: demo_express_checkout, or at PayPal's Website. Basic knowledge of algebra and algebraic operations is necessary. Prerequisites: For testing your payment functions you must have a PayPal Sandbox account. For a live PayPal payment processor you must have a PayPal Bussiness account. General: Typically any payment for a product will be a calculation; multyply the number of an article with the price of that article. For instance: you need a box of wine where a box contains 6 bottles (\$ 3,50 per bottle) . You would have to pay 6 times 1 bottle and added with the VAT(=19%). So, algabraïc notation: 6*3.5+.19*6*3.5 = Price to pay. For algabraïc information see: Skill in Arithmetic The result of this calculation is \$ 24.99; this is the price to pay. There are some algabraïc rules that must be followed: the order of operations (see: Order of Operations). (1)  Evaluate the parentheses, if there are any, and if they require evaluation. (2)  Evaluate the powers, that is, the exponents. (3)  Multiply or divide -- it does not matter.  (4)  Add or subtract. Changing the position of operands is allowed in the operations Multiplication and Addition. (2+3=5 equals 3+2=5 and 3*4=12 equals 4*3=12) Changing the position of operands is NOT allowed in Division or Subtraction. (3-2=1 is NOT the same as 2-3=-1 and 12/3=4 is NOT the same as 12/4=3) In the applicationbuilder the operations Division and Subtraction are converted to the operations Multiplication and Addition. How is this done? In algebra is a rule (#1) "Division by an operand is the same as Multiplication of 1(one) divided by that operand" . ( 12/4 == 12 * 1/4) And another rule (#2) for Subtraction is: " Subtracting an operand from another operand is the same as adding the negative value of that operand" . (3-2 == 3+(-2)) Why is this done? Well, according to the second rule (#2), the calculation must " know" what is operand #1 and what is operand #2, otherwise it would be impossible to do the math on these operations because the operands must be evaluated in the correct order. This means that every operand in the database tablefields must individually be marked in order to determine the order of execution of the operations on division and subtraction. This would be impossible to handle when there are more than two operands in the database tablefields. By converting divisions and subtractions to their opponent operations multiplication and addition, this problem is gone. The only thing that has to be done is to set operands in the database tablefield to the real value or the " reciprocal value" (= 1(one) divided by X) or "Signing" positive value" (+X) or negative value" (-X) and the multiply or add all the operands without regard to the positions of the operands in the database tablefields. Reciprocal calculations are: The product of a number and its reciprocal equals 1. The reciprocal of 4 is 1/4. The reciprocal of 2/3 is 3/2. The reciprocal of 1 is 1. The number 0 does not have a reciprocal because the product of any number and 0 equals 0. Positive sign is +4 Negative sign is -6 Fieldextentions for mthematical functions. The DatabaseBuilder has extentions for operands and functions. To prevent these extentions te become very long, these mathematical extentions start wit a caracter from the Greek alphabet. Operations are marked with: _ΩP (The Greek capital Omega folowed by P) Functions are build as follows: (Example _ξSFαIntβMultΩp1xxΩp2yy) 1st part: " Functionextention: _ξSF (Greek capital Xi followed by SF). 2nd part: αInt (Greek capital Alpha followed by Int) marking the SQL type result of the function. 3rd part: βMult (Greek capital Beta followed by Mult) marking the function Multiply. 4rd and 5th part: Ωp1xxΩp2yy (Greek capital Omega) for the operand(s) (These extentions may change in the future....) Execution: For now, we only calculate the price without VAT in the ActivityPlan record. This means that three SQL recordfields must get an extention; two fields get the Ωp extention and one SQL field gets the _ξSF extention for a multiplication with a decimal as result. The multiplication is done with the ActivityCost field and the NumberOfParticipants fields. The resultfunction extention is set to the PriceToPay SQL tablefield. Because the payment is done thru the PayPal processor, the PriceToPay field gets also the _PPLPY extention to force the ApplicationBuilder to create the PayPal Express Checkout code in the application. Observe the fields ##10 and 19 beeing Operands and field## 21 beeing the functionfield. Now re-create your application and re-install the module in your portal. You're done with this lesson. Continue on: PayPal Setup Module ---->> Lesson 17: Using Images