Braintree (PayPal)

Braintree is the only platform that supports a PayPal integration.

Read more about Braintree (Paypal)

To get started the JavaScript SDK needs a tokenization key or client token generated by your server using Braintree Server SDK. Read more about this authorization.

Step 1: Initialize Braintree (PayPal) on your page

Include the following scripts on your page. To read the details and be updated with all the possibilities read this section at Braintree.

<!-- Load PayPal's checkout.js Library. -->
<script src="https://www.paypalobjects.com/api/checkout.js" data-version-4 log-level="warn"></script>

<!-- Load the client component. -->
<script src="https://js.braintreegateway.com/web/3.52.1/js/client.min.js"></script>

<!-- Load the PayPal Checkout component. -->
<script src="https://js.braintreegateway.com/web/3.52.1/js/paypal-checkout.min.js"></script>

Then you can initialize the JavaScript SDK like this

braintree.client.create({
  authorization: “tokenization key or client token”
}, function (err, clientInstance) {
  // ...
});

Step 2: Vaulting

Vaulting is what you do at the user checkout flow. After initializing JS SDK you must present user checkout flow with option flow: vault. With this option set after checkout flow has been done by the customer, you should receive nonce that should be sent to your server.

In your server is using Braintree Server SDK you need to create a customer. After customer has been created using customer id and nonce that you received from JS SDK you need to create a payment method using both of those values. After creating a payment method, you should store the token in Upodi.

Code example on the user checkout

paypal.Button.render({
      env: 'production', // or 'sandbox'
      payment: function () {
        return paypalCheckoutInstance.createPayment({
          flow: 'vault',
          billingAgreementDescription: 'Your agreement description',
          enableShippingAddress: true,
          shippingAddressEditable: true,
        });
      }

Read more about how to vault and the options available.

Step 3: Create Customer in Braintree

Read how to create a customer in PayPal.

Step 4: Create a Payment Method in Braintree

Read how to create a Payment Method in PayPal. Be sure to grab the PaymentMethodToken, which will have to be sent to Upodi in the next step.

Step 5: Send the Payment Method to Upodi

{
  "type" : 64,
  "makedefault" : "true",
  "puretoken" : { 
  	"token" : "{PaymentMethodToken}",
  	"paymentgateway" : "braintree_paypal"
  }
}

🚧

Currencies in Braintree

Make sure you create merchant accounts for each currency you plan to use in Braintree