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:
1. Have a PayPal business or Premier account.
2. 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.
3. 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.
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;
- Paypal API Username
- Paypal API Signature
- Paypal API Password
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”
How to handle Paypal refunds in Rails:
Paypal Rest API;
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.
To integrate the Express Checkout with In-Context flow;
PayPal REST API Ruby SDK (paypal-sdk-rest gem):
The PayPal REST SDK provides Ruby APIs to create, process and manage payment.
Add the gem our application, in Gemfile:
And then execute:
$ bundle install
rails g paypal:sdk:install
Read More :