forked from vuestorefront/vue-storefront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# PayPal payments support | ||
|
||
Vue Storefront is supporting PayPal payments with PayPal Payment extension for [vue-storefront](https://github.com/DivanteLtd/vue-storefront), by [Develo Design](https://www.develodesign.co.uk). | ||
|
||
## The architecture | ||
![Architecture diagram](https://raw.githubusercontent.com/develodesign/vsf-payment-paypal/master/doc/executing-paypal-payment-server-integration.svg) | ||
|
||
## Installation using NPM: | ||
|
||
Add the extension to your Vue Storefront `package.json` using: | ||
```shell | ||
$ npm install vsf-payment-paypal --save | ||
``` | ||
|
||
Add `vsf-payment-paypal` to the `extensions/index.js` | ||
```js | ||
export default [ | ||
require('@vue-storefront/extension-droppoint-shipping/index.js'), | ||
require('@vue-storefront/extension-google-analytics/index.js'), | ||
require('@vue-storefront/extension-mailchimp-subscribe/index.js'), | ||
require('@vue-storefront/extension-payment-backend-methods/index.js'), | ||
require('@vue-storefront/extension-payment-cash-on-delivery/index.js'), | ||
require('@vue-storefront/extension-template/index.js'), | ||
require('vsf-payment-stripe/index.js'), | ||
require('src/extensions/cms/index.js'), | ||
|
||
require('vsf-payment-paypal/index.js') | ||
] | ||
``` | ||
|
||
Add the following also to your `config/local.json` need set `paypal.env` to `sandbox` or `production`. | ||
```js | ||
"paypal": { | ||
"env": "sandbox", | ||
"create_endpoint": "http://localhost:8080/api/ext/paypal-payment/create", | ||
"execute_endpoint": "http://localhost:8080/api/ext/paypal-payment/execute", | ||
"style": { | ||
"size": "small", | ||
"color": "gold", | ||
"shape": "pill" | ||
} | ||
} | ||
``` | ||
|
||
Also we can use `paypal.style` option for more customizable PayPal button view. For more info [PayPal](https://developer.paypal.com/demo/checkout/#/pattern/checkout). | ||
|
||
## Vue Storefront API | ||
|
||
After setting up the Vue Storefront extension - please setup the API with [https://github.com/develodesign/vsf-payment-paypal-api#readme](vsf-payment-paypal-api). | ||
|
||
This API extension execute payment to PayPal gateway. | ||
It use [`develodesign/m2-paypal-payment`](https://github.com/develodesign/m2-paypal-payment) composer module so you have to install it in your Magento instance. | ||
|
||
in your `local.json` file you should register the extension: | ||
`"registeredExtensions": ["mailchimp-subscribe", "example-magento-api", "paypal-payment"],` | ||
|
||
And need add the `paypal` settings to `extensions` key in `local.json`: | ||
``` | ||
"extensions": { | ||
"mailchimp": { | ||
... | ||
}, | ||
"paypal": { | ||
"api": "https://api.sandbox.paypal.com", | ||
"client": "", | ||
"secret": "" | ||
} | ||
} | ||
``` | ||
|
||
The API endpoitns are: | ||
``` | ||
/api/ext/paypal-payment/create | ||
/api/ext/paypal-payment/execute | ||
``` |