The PayPal Developer API and How To Use It
This video walks through step by step how to use the PayPal Developer API to create a sample payment and then pull out the transaction ID that could be pushed into Odoo through the Odoo API and XML-RPC
How to use the PayPal Developer API
Using the REST payment API with the PayPalRestSDK for Python
PayPal offers a variety of API's that allow to perform nearly any action within PayPal. This gives you the opportunity to create a very robust user experience. Odoo includes a PayPal payment processor application that integrates within the shopping cart in the Ecommerce application. There are however many other interfaces and web experiences in which you may wish to integrate with PayPal's system. For example, perhaps your company has been taking payments in PayPal for some years now and would like to link those transactions in PayPal with your customers.
Setting up your PayPal Account: Naturally if you wish to use the PayPal Developer API with Odoo you are going to need a developer account. Just head on over to PayPal.com and set it up.
Register your REST application in PayPal: Once you are verified by PayPal you can then get access to the PayPal Developer API Dashboard. From here you can configure your applications. Fortunately it is very easy. Just provide a name and PayPal will then provide you the keys you need in the next step.
Get your Client ID and Secret ID: After you have created the application PayPal will provide you with the client id and secret id you will need to provide the API so it knows you are authenticated to access the account.
Using the PayPalRestSDK with Odoo
While it is certainly possible to access the PayPal REST API with your Python scripts from within Odoo, there is an SDK that makes it far easier. Primarily the SDK is going to allow you to work with Python dictionaries rather than having to work with JSON. It allows you to work with the API at a higher level than you would otherwise.Testing the API access
After we have all the pre-requisites in place we are ready to test and make sure we can reliability access the PayPal Developer API from our Python script. In the video we walk through step by step how this is accomplished as well as a few other common problems you may encounter when trying to work with the PayPal API.Creating a Payment in the PayPal Sandbox
Next we take an example payment and see how we can process it in the PayPal sandbox. Learn how you can test all of these processes along the way. By breaking down each of the steps you will find it relatively easy to integrate Odoo with the PayPal API.Here is an example PayPal payment transaction request we cover in the video:
payment = paypalrestsdk.Payment ({
"intent" : "sale", "payer": { "payer_info":
{ "email": "[email protected]",
"first_name": "Bob",
"last_name": "Sacamanto", },
"payment_method": "paypal"}, "redirect_urls": { "return_url": "http://localhost:3000/payment/execute","cancel_url": "http://localhost:3000/"},
"transactions": [{
"item_list": { "items": [{ "name": "item","sku": "item","price": "15.00", "currency": "USD", "quantity": 10}]},"amount": {"total": "150.00", "currency": "USD"}
,"description": "This is the payment transaction description."}]})