Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit ee7146a

Browse files
authored
Merge pull request #4170 from philippsander/patch-3
updated installation manual
2 parents 0678247 + 06c953a commit ee7146a

File tree

1 file changed

+78
-53
lines changed

1 file changed

+78
-53
lines changed

docs/guide/integrations/paypal-payments.md

Lines changed: 78 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -7,104 +7,129 @@ Vue Storefront is supporting PayPal payments with PayPal Payment extension for [
77
![Architecture diagram](../images/paypal.svg)
88

99

10-
## Installation:
10+
## Installation
1111

12-
By hand (preferred):
13-
```shell
14-
$ git clone [email protected]:develodesign/vsf-payment-paypal.git ./vue-storefront/src/modules/paypal
15-
```
12+
By hand (preferer):
1613

17-
Or as dependency. Add the extension to your Vue Storefront `package.json` using:
1814
```shell
19-
$ yarn add vsf-payment-paypal -W
15+
$ git clone [email protected]:develodesign/vsf-payment-paypal.git ./vue-storefront/src/modules/paypal
2016
```
2117

22-
Add the following as well to your `config/local.json` Set `paypal.env` to `sandbox` or `production`.
2318
```json
2419
"paypal": {
25-
"env": "sandbox",
20+
"clientId": "",
2621
"endpoint": {
27-
"create": "http://localhost:8080/api/ext/payment-paypal/create",
28-
"execute": "http://localhost:8080/api/ext/payment-paypal/execute"
22+
"complete": "http://localhost:8080/api/ext/paypal/complete",
23+
"setExpressCheckout": "http://localhost:8080/api/ext/paypal/setExpressCheckout"
2924
}
3025
}
3126
```
3227

33-
Enable cart sync with the server (for corrected totals calculation by getters):
28+
## Registration the Paypal module
3429

35-
```json
36-
"cart": {
37-
...
38-
"synchronize": true,
39-
"synchronize_totals": true
40-
}
41-
```
42-
43-
Integrate the PayPal Button to Order Review component in the theme folder:
30+
Open in you editor `./src/modules/index.ts`
4431

45-
```shell
46-
cp ./src/modules/paypal/components/core/blocks/Checkout/OrderReview.vue ./src/themes/default/components/core/blocks/Checkout/OrderReview.vue
47-
```
48-
49-
Registration the Paypal module. Go to `./src/modules/index.ts`
5032
```js
5133
...
52-
import { GoogleAnalytics } from './google-analytics';
5334
import { Paypal } from './paypal';
5435

5536
export const registerModules: VueStorefrontModule[] = [
56-
...
57-
GoogleAnalytics,
37+
...,
5838
Paypal
5939
]
6040
```
6141

42+
## Paypal payment Checkout Review
43+
44+
Under your theme `components/core/blocks/Checkout/OrderReview.vue` add the following import to your script
45+
46+
```js
47+
import PaypalButton from '@develodesign/vsf-payment-paypal/components/Button'
48+
49+
export default {
50+
components: {
51+
...
52+
PaypalButton
53+
},
54+
...
55+
computed: {
56+
payment () {
57+
return this.$store.state.checkout.paymentDetails
58+
}
59+
},
60+
```
61+
62+
And to you template add the paypal button before `button-full`:
63+
64+
```html
65+
<paypal-button v-if="payment.paymentMethod === 'paypal_express'"/>
66+
<button-full
67+
v-else
68+
@click.native="placeOrder"
69+
data-testid="orderReviewSubmit"
70+
class="place-order-btn"
71+
:disabled="$v.orderReview.$invalid"
72+
>
73+
{{ $t('Place the order') }}
74+
</button-full>
75+
```
6276
6377
## PayPal payment API extension
6478
65-
Install the additional extension for `vue-storefront-api`:
79+
Setup dependency to api:
80+
`cd ../vue-storefront-api`
81+
`yarn add -W @paypal/checkout-server-sdk`
82+
`yarn add -W paypal-nvp-api`
83+
84+
Install extension to `vue-storefront-api`:
85+
6686
```shell
67-
$ mkdir -p ../vue-storefront-api/src/api/extensions/payment-paypal
68-
$ cp -f ./api-ext/index.js ../vue-storefront-api/src/api/extensions/payment-paypal/
87+
$ cp -fr src/modules/paypal/api/paypal ../vue-storefront-api/src/api/extensions/
6988
```
7089
71-
Go to api config `./vue-storefront-api/config/local.json` and register the Paypal API extension:
72-
```
90+
Go to api config `./vue-storefront-api/config/local.json` and register the Paypal Api extension:
91+
92+
```json
7393
"registeredExtensions": [
7494
...
75-
"payment-paypal"
95+
"paypal"
7696
]
7797
```
7898
7999
And add the `paypal` settings to `extensions` key:
80-
```
100+
101+
Add the following also to your `config/local.json` need set `paypal.env` to `sandbox` or `live`.
102+
103+
```json
81104
"extensions": {
82-
"mailchimp": {
83-
...
84-
},
85105
"paypal": {
86-
"api": "https://api.sandbox.paypal.com",
87-
"client": "",
88-
"secret": ""
89-
}
106+
"env": "sandbox",
107+
"clientId": "",
108+
"secret": "",
109+
"username": "",
110+
"password": "",
111+
"signature": ""
112+
},
113+
...
90114
}
91115
```
92116
93-
## Magento 2 integration
117+
## Magento2 integration
94118
95-
This API extension executes payment to the PayPal gateway. It uses `develodesign/m2-paypal-payment` [The custom Paypal payment method for Magento2](https://github.com/develodesign/m2-paypal-payment) composer module, so you have to install it in your Magento instance.
119+
Turn on Paypal Express and provide the API credentials using the built in Paypal module. Enable only Express Checkout.
120+
121+
Other Paypal methods are not supported or tested right now.
96122
97123
## Customization
98124
99-
Also, we can use the `paypal.style` option for a more customizable PayPal button view. For more info [PayPal](https://developer.paypal.com/demo/checkout/#/pattern/checkout).
125+
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).
126+
127+
In Button.vue, the button takes prop styling
100128
101129
```json
102-
"paypal": {
103-
...
104-
"style": {
105-
"size": "small",
106-
"color": "gold",
107-
"shape": "pill"
108-
}
130+
"style": {
131+
"size": "small",
132+
"color": "gold",
133+
"shape": "pill"
109134
}
110135
```

0 commit comments

Comments
 (0)