How to integrate with Paypal payments through Ingresse.

Paypal method has a specific flow, that must be done one time per Paypal account. It is necessary in order to get customer permission to charge from Paypal account recurrently.

  1. Add the line below into your website header.
<script src="https://www.paypalobjects.com/api/checkout.js"></script>
  1. Create the transaction to start the payment process Start Transaction
  2. If customer does not have a Paypal billing agreement ID in your database, creates a new Express Checkout Create a Express Checkout. It should be performed only once per customer.
  3. Execute at the client side, the function below:
paypal.Button.render({
    // for development use 'sandbox' as 'env' value.
    env: "production",
    payment: function (data, action) {
         // Add below the token returned from step 3.
         return "BA-3A027712Y78623734";
    },
    onAuthorize: function (data, action) {
				 console.log(data);
    }
}, '#paypal-button-element-id');
  1. Using the token created in the step above, then create a Billing Agreement by calling Create a Billing Agreement
  2. With all customer information, get the available installments for the customer by Get the Installments
  3. Then, create a new payment for transaction Pay Transaction to process the payment with Paypal customer wallet.