ABSYZ ABSYZ

  • Home

    Home

  • About us

    Who We Are

  • Our Expertise

    What we Do

  • Our Approach

    How We Do It

  • Products

    What We Made

  • Industries

    Who We Do It For

  • Clients

    Whom We Did It For.

  • Article & Blogs

    What Experts Think

  • Careers

    Join The Team

  • Get In Touch

    Let’s Get Started

ABSYZ

Salesforce integration with Paypal

Home / Article & Blogs / Salesforce / Integration / Salesforce integration with Paypal
By Team ABSYZ inIntegration, Paypal

Purpose of Integration

The main purpose of this blog is to integrate the Paypal Payment Gateway with Salesforce. Paypal is useful to make the payment from e-com community or sites.In this blog, we are going to implement Paypal integration with Salesforce for a basic payment for Merchant Type account, the payments would be from Customers using Credit Cards like Visa etc. where customer enters the payment details on lightning component which will complete the payment on click of submit button.Firstly,we need to set up a paypal account.So let’s get started.

Integration Steps:

1) Set up Paypal Account:

1.Create a Personal or Business Paypal Account.

(i).To create business Paypal Account visit developer.paypal.com

(ii).To create Personal/Individual Account visit https://www.paypal.com/in/signup/account

For this blog,I have created a Business Paypal Account.

2.Login with your credentials and you will be landed in Dashboard Page.

3.Select Sandbox under Accounts from left side.You will find one default Business and one Personal account.

Click on Create Account and Create one Business account and Personal Account.You can also create custom Account.

Select the Business Account you created now and click View/Edit Account and click Upgrade to Pro beside Account Type Business.Because Business Pro Account is required for Business(Merchant)  Account to process transactions.

4.Copy the API Credentials(username,password and signature) generated for  the Business Pro Account.This credentials will be used in the Salesforce Apex Class.

2) Set up Salesforce:

(i).Create a lightning component with a button Paypal Integration, onclick of a button a modal with a payment detail form opens up where the customer needs to fill the payment details. On Submitting the details the amount will be debited from the payee account and will be credited in the paypal account.

<aura:component controller="PaypalProcessorLightning" implements="force:appHostable,flexipage:availableForAllPageTypes, flexipage:availableForRecordHome,force:hasRecordId, forceCommunity:availableForAllPageTypes, force:lightningQuickAction" access="global" >
    <aura:attribute name="inp1" type="string" default="aslam"/>
    <aura:attribute name="inp2" type="string" default="bari"/>
    <aura:attribute name="inp3" type="string" default="US"/>
    <aura:attribute name="inp4" type="string" default="44"/>
    <aura:attribute name="inp5" type="string" default="433"/>
    <aura:attribute name="inp6" type="string" default="ajm"/>
    <aura:attribute name="inp7" type="string" default="CA"/>
    <aura:attribute name="inp8" type="string" default="4534"/>
    <aura:attribute name="inp9" type="string" default="4028398122647025"/>
    <aura:attribute name="inp10" type="string" default="Visa"/>
    <aura:attribute name="inp11" type="string" default=""/>
    <aura:attribute name="inp12" type="string" default="01"/>
    <aura:attribute name="inp13" type="string" default="2020"/>
    <aura:attribute name="inp14" type="string" default="abuy_1294681533_per@gmail.com"/>
    <aura:attribute name="inp15" type="string" default="100"/>
    <lightning:button aura:id="show" label="Paypal Integration" class="slds-button slds-button--brand buttontype" onclick="{!c.showModal}" />    
    <div aria-hidden="false" aura:id="popUpId" role="dialog" class="slds-modal slds-fade-in-open hideContent" style="padding-top:7rem">
        <div class="slds-modal__container">
            <div class="slds-modal__header">
                <div class="slds-button slds-button--icon-inverse slds-modal__close" onclick="{!c.hidePopup}">
                    <lightning:icon iconName="utility:close" size="medium" alternativeText="Indicates approval"/>
                    <span class="slds-assistive-text">Close</span>
                </div>
                <h2 style="font-weight:bolder;font-size:1rem">Complete Your Payment Details</h2>
            </div>
            <div class="slds-modal__content " style="padding:40px">
                <div class="row">
                    <h2 class="header"></h2>

                    <lightning:input  type="text" name="input1" label="First Name" value="{!v.inp1}" />
                    <lightning:input type="text" name="input2" label="Last Name" value="{!v.inp2}"/>
                    <lightning:input type="text" name="input3" label="Country" value="{!v.inp3}"/>
                    <lightning:input type="text" name="input4" label="Shipping Address1" value="{!v.inp4}"/>
                    <lightning:input type="text" name="input5" label="Shipping Address2" value="{!v.inp5}"/>
                    <lightning:input type="text" name="input6" label="Shipping City" value="{!v.inp6}"/>
                    <lightning:input type="text" name="input7" label="Shipping State" value="{!v.inp7}"/>
                    <lightning:input type="text" name="input8" label="Zip Code" value="{!v.inp8}"/>
                    <lightning:input type="text" name="input9" label="Card Number" value="{!v.inp9}"/>
                    <lightning:input type="text" name="input10" label="Card Type" value="{!v.inp10}"/>
                    <lightning:input type="text" name="input11" label="CVV" value="{!v.inp11}"/>
                    <lightning:input type="text" name="input12" label="Expiry Month" value="{!v.inp12}"/>
                    <lightning:input type="text" name="input13" label="Expiry Year" value="{!v.inp13}"/>
                    <lightning:input type="text" name="input14" label="Payer" value="{!v.inp14}"/>
                    <lightning:input type="text" name="input15" label="Amount" value="{!v.inp15}"/>
                </div>
            </div>
            <div class="slds-modal__footer" style="padding-top: 20px">
                <lightning:button variant="brand" label="Submit" title="Brand action" onclick="{! c.handleClick }" />
                <lightning:button aura:id="Cancel" label="Cancel" class="slds-button slds-button--brand buttontype" onclick="{!c.hidePopup}" />
            </div>
        </div>
    </div>
    <div class="slds-backdrop slds-backdrop--open hideContent" aura:id="popUpBackgroundId"></div>
</aura:component>

 

({ 
    showModal : function(component, event, helper) {
    $A.util.removeClass(component.find('popUpId'), 'hideContent');
    $A.util.removeClass(component.find('popUpBackgroundId'), 'hideContent');
},
  
  hidePopup : function(component){
      $A.util.addClass(component.find('popUpId'), 'hideContent');
      $A.util.addClass(component.find('popUpBackgroundId'), 'hideContent');
  },
  handleClick : function(component, event, helper) {
      var Firstname=component.get("v.inp1");
      var Lastname=component.get("v.inp2");
      var Country=component.get("v.inp3");
      var Address1=component.get("v.inp4");
      var Address2=component.get("v.inp5");
      var City=component.get("v.inp6");
      var State=component.get("v.inp7");
      var Zipcode=component.get("v.inp8");
      var Cardno=component.get("v.inp9");
      var Cardtype=component.get("v.inp10");
      var Cvv=component.get("v.inp11");
      var Expirymonth=component.get("v.inp12");
      var Expiryyear=component.get("v.inp13");
      var Payer=component.get("v.inp14");
      var Amount=component.get("v.inp15");
      var action = component.get("c.doDirectPayment");
        action.setParams({
            'fname':Firstname,
            'lastname':Lastname,
            'contry':Country,
            'add1':Address1,
            'add2':Address2,
            'shippingcity':City,
            'shippingstate':State,
            'zip':Zipcode,
            'cardnumber':Cardno,
            'cardtype':Cardtype,
            'cvvno':Cvv,
            'expmonth':Expirymonth,
            'expyear':Expiryyear,
            'pay':Payer,
            'amt':Amount
            
        });
        
        action.setCallback(this, function(a) {
            var state = a.getState();
            if (state === "SUCCESS") {
                alert(a.getReturnValue());
                
            }
        });
        
        $A.enqueueAction(action);
   
    }
 })
Paypal Integration Button on Lightning Component:

3) Run and Test

You can test the payment process by doing a sample payment providing payer bank details.Onclick of submit apex class will be called which will process the payment.

Log into your Paypal Account and check the balance from the Funding tab of Business Pro Account , it might be increased.

You will also be receiving a notification that the payment is completed successfully.

Integration with PaypalLightningSalesforceSFDC
141
Like this post
26 Posts
Team ABSYZ

Search Posts

Archives

Categories

Recent posts

BioAsia 2023 in Hyderabad: An Annual International Event

BioAsia 2023 in Hyderabad: An Annual International Event

The Role Of Marketing in Small & Medium Enterprises

The Role Of Marketing in Small & Medium Enterprises

Salesforce For Retail: How Salesforce CRM Can Help Retailers

Salesforce For Retail: How Salesforce CRM Can Help Retailers

What is ChatGPT & How Does It Work?

What is ChatGPT & How Does It Work?

What Is Graphic Design? (Executive Summary 2023)

What Is Graphic Design? (Executive Summary 2023)

  • Previous PostSalesforce CI/CD: Introduction to Gearset
  • Next PostUsing Modal/ Popup in Lightning Web Components

Related Posts

PLATFORM EVENTS IN SALESFORCE
Integration Salesforce

PLATFORM EVENTS IN SALESFORCE

Integrate SharePoint with Salesforce using Microsoft Graph API
Apex Integration Salesforce

Integrate SharePoint with Salesforce using Microsoft Graph API

Create/Update Salesforce Picklist definitions using metadata API
Integration Metadata API Salesforce

Create/Update Salesforce Picklist definitions using metadata API

Increase your Productivity with the Apex Metadata API
Integration Metadata API

Increase your Productivity with the Apex Metadata API

Leave a Reply (Cancel reply)

Your email address will not be published. Required fields are marked *

*
*

ABSYZ Logo

INDIA | USA | UAE

  • About us
  • Article & Blogs
  • Careers
  • Get In Touch
  • Our Expertise
  • Our Approach
  • Products
  • Industries
  • Clients
  • White Papers

Copyright ©2022 Absyz Inc. All Rights Reserved.

youngsoft
Copy
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “ACCEPT ALL”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent. Privacy Policy
Cookie SettingsREJECT ALLACCEPT ALL
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled

Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.

CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.

Functional

Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.

Performance

Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.

Analytics

Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.

Advertisement

Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.

Others

Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.

SAVE & ACCEPT