chore: Merge master to develop (#3653)

This commit is contained in:
Oliver Windall Juhl authored and GitHub committed 2023-03-31 13:09:57 +02:00
1 parent b2e2eddcea
commit 809ab2e0eb
120 files changed
+2240 -585

No files matched your search

+72 -14
View File
@@ -1,20 +1,78 @@
# medusa-payment-paypal
# PayPal
Add PayPal as a Payment Provider.
Receive payments on your Medusa commerce application using PayPal.
Learn more about how you can use this plugin in the [documentaion](https://docs.medusajs.com/add-plugins/paypal).
[PayPal Plugin Documentation](https://docs.medusajs.com/plugins/payment/paypal) | [Medusa Website](https://medusajs.com/) | [Medusa Repository](https://github.com/medusajs/medusa)
## Options
The paypal plugin version `>=1.3.x` requires medusa `>=1.8.x`
```js
{
sandbox: true, //default false
clientId: "CLIENT_ID", // REQUIRED
clientSecret: "CLIENT_SECRET", // REQUIRED
authWebhookId: "WEBHOOK_ID", //REQUIRED for webhook to work
}
```
## Features
## Deprecation
- Authorize payments on orders from any sales channel.
- Capture payments from the admin dashboard.
- View payment analytics through PayPal's dashboard.
- Ready-integration with [Medusa's Next.js starter storefront](https://docs.medusajs.com/starters/nextjs-medusa-starter).
- Support for Webhooks.
The paypal plugin version `>=1.3.x` requires medusa `>=1.8.x`
---
## Prerequisites
- [Medusa backend](https://docs.medusajs.com/development/backend/install)
- [PayPal account](https://www.paypal.com)
---
## How to Install
1\. Run the following command in the directory of the Medusa backend:
```bash
npm install medusa-payment-paypal
```
2\. Set the following environment variables in `.env`:
```bash
PAYPAL_SANDBOX=true
PAYPAL_CLIENT_ID=<CLIENT_ID>
PAYPAL_CLIENT_SECRET=<CLIENT_SECRET>
PAYPAL_AUTH_WEBHOOK_ID=<WEBHOOK_ID>
```
3\. In `medusa-config.js` add the following at the end of the `plugins` array:
```js
const plugins = [
// ...
{
resolve: `medusa-payment-paypal`,
options: {
sandbox: process.env.PAYPAL_SANDBOX,
client_id: process.env.PAYPAL_CLIENT_ID,
client_secret: process.env.PAYPAL_CLIENT_SECRET,
auth_webhook_id: process.env.PAYPAL_AUTH_WEBHOOK_ID,
},
},
]
```
---
## Test the Plugin
1\. Run the following command in the directory of the Medusa backend to run the backend:
```bash
npm run start
```
2\. Enable PayPal in a region in the admin. You can refer to [this User Guide](https://docs.medusajs.com/user-guide/regions/providers) to learn how to do that. Alternatively, you can use the [Admin APIs](https://docs.medusajs.com/api/admin#tag/Region/operation/PostRegionsRegion).
3\. Place an order using a storefront or the [Store APIs](https://docs.medusajs.com/api/store). You should be able to use Stripe as a payment method.
---
## Additional Resources
- [PayPal Plugin Documentation](https://docs.medusajs.com/plugins/payment/paypal)