PayPal Checkout includes payment solutions ranging from simple to robust
that let the merchants as well as developers choose an integration option
that can be the best-suited for their website and customers. In order to
integrate Paypal Payment Gateway, we need to do the following:

Have a PayPal business or Premier account.

Create a PayPal app and get an access token. When we create a PayPal app,
PayPal generates a set of OAuth client_id and secret keys for the application. PayPal generates
these keys for both the PayPal sandbox and Live environments. To get an access
token, pass the client-id:secret credentials in the Authorization header.
We use the access token for authentication when we make REST API requests.

To perform an end-to-end test of our Express Checkout with In-Context
integration, create both merchant and buyer accounts in the PayPal sandbox
environment.

www.sandbox.paypal.com/in/webapps/mpp/home Merchant : Select the Business
account type and enter an email address and password. Buyer : Select the
Personal account type and enter a high PayPal balance, such as 5000.

Once we create Paypal sandbox account then click on the “Profile” link
for that account, look under the tab “API Credentials”. We will have the
following information;

Note: When we are ready to go live we would just use the credentials from
our real paypal account instead of the ones from our sandbox account. The
credentials can be found in the “My Profile” area under the left hand
tab “My Selling Tools” under the option “API access”

For more complex merchant sites, direct calls to PayPal APIs for an Express
Checkout integration may be a more appropriate integration. REST APIs —
We can develop an Express Checkout integration using PayPal REST APIs.

Refund a completed payment (sale): If we must refund a completed payment,
or sale, provide the sale id given to us in response to a completed payment
along with an empty JSON payload for a full
refund and for partial refunds, we can instead include an amount object in
the JSON payload.

Paper trail lets us track all the changes in the models data for the
purpose of its editing and versioning. By using this gem, we can see how a
model looks, at every stage of its life-cycle and we can take it back to
any version of the model data and
we can even undo all the changes after a record has been destroyed so as to
restore it completely.

gem ‘paper_trail’runbundleinstalltoinstallit

After bundle install you can run the following command for adding versions
table to your database