Skip to content

Commit f61c97a

Browse files
authored
Add multiple language support for Standard & Advanced Integration (#152)
1 parent a70265b commit f61c97a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+11686
-351
lines changed

.devcontainer/advanced-integration-v1/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@
3737
}
3838
}
3939
}
40-
}
40+
}

.devcontainer/advanced-integration-v2/devcontainer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@
66
// Use 'onCreateCommand' to run commands when creating the container.
77
"onCreateCommand": "bash ../../.devcontainer/advanced-integration-v2/welcome-message.sh",
88
// Use 'postCreateCommand' to run commands after the container is created.
9-
"postCreateCommand": "npm install",
9+
"postCreateCommand": {
10+
"Install Server Packages": "cd server/node && npm install",
11+
"Install Client Packages": "cd client/html && npm install"
12+
},
1013
// Use 'postAttachCommand' to run commands when attaching to the container.
1114
"postAttachCommand": {
12-
"Start server": "npm start"
15+
"Start server": "cd server/node && npm start",
16+
"Start client": "cd client/html && npm start"
1317
},
1418
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
"forwardPorts": [8888],
19+
"forwardPorts": [3000, 8080],
1620
"portsAttributes": {
17-
"8888": {
21+
"3000": {
1822
"label": "Preview of Advanced Checkout Flow",
1923
"onAutoForward": "openBrowserOnce"
2024
}

.devcontainer/standard-integration/devcontainer.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@
66
// Use 'onCreateCommand' to run commands when creating the container.
77
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
88
// Use 'postCreateCommand' to run commands after the container is created.
9-
"postCreateCommand": "npm install",
9+
"postCreateCommand": {
10+
"Install Client Packages": "cd client/html && npm install",
11+
"Install Server Packages": "cd server/node && npm install"
12+
},
1013
// Use 'postAttachCommand' to run commands when attaching to the container.
1114
"postAttachCommand": {
12-
"Start server": "npm start"
15+
"Start client": "cd client/html && npm start",
16+
"Start server": "cd server/node && npm start"
1317
},
1418
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
"forwardPorts": [8888],
19+
"forwardPorts": [3000, 8080],
1620
"portsAttributes": {
17-
"8888": {
21+
"3000": {
1822
"label": "Preview of Standard Checkout Flow",
1923
"onAutoForward": "openBrowserOnce"
2024
}

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,6 @@ dist
9999

100100
# TernJS port file
101101
.tern-port
102+
103+
# dotnet
104+
*.sln

advanced-integration/v2/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

advanced-integration/v2/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

advanced-integration/v2/client/checkout.js

Lines changed: 0 additions & 166 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Create an application to obtain credentials at
2+
# https://developer.paypal.com/dashboard/applications/sandbox
3+
4+
PAYPAL_CLIENT_ID=YOUR_CLIENT_ID_GOES_HERE
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
*.local
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Advanced Integration with PayPal : HTML/JS
2+
3+
## Getting Started
4+
5+
This guide will walk you through setting up and running the HTML/JS Advanced Integration locally.
6+
7+
### Before You Code
8+
9+
1. **Setup a PayPal Account**
10+
11+
To get started, you'll need a developer, personal, or business account.
12+
13+
[Sign Up](https://www.paypal.com/signin/client?flow=provisionUser) or [Log In](https://www.paypal.com/signin?returnUri=https%253A%252F%252Fdeveloper.paypal.com%252Fdashboard&intent=developer)
14+
15+
You'll then need to visit the [Developer Dashboard](https://developer.paypal.com/dashboard/) to obtain credentials and to make sandbox accounts.
16+
17+
2. **Create an Application**
18+
19+
Once you've setup a PayPal account, you'll need to obtain a **Client ID** and **Secret**. [Create a sandbox application](https://developer.paypal.com/dashboard/applications/sandbox/create).
20+
21+
### Installation
22+
23+
```sh
24+
npm install
25+
```
26+
27+
### Configuration
28+
29+
1. Environmental Variables (.env)
30+
31+
- Rename the .env.example file to .env
32+
- Update the following keys with their actual values -
33+
34+
```sh
35+
PAYPAL_CLIENT_ID=<PAYPAL_CLIENT_ID>
36+
```
37+
38+
2. Connecting the client and server (vite.config.js)
39+
40+
- Open vite.config.js in the root directory.
41+
- Locate the proxy configuration object.
42+
- Update the proxy key to match the server's address and port. For example:
43+
44+
```js
45+
export default defineConfig({
46+
47+
server: {
48+
proxy: {
49+
"/api": {
50+
target: "http://localhost:8080", // Replace with your server URL
51+
changeOrigin: true,
52+
},
53+
},
54+
},
55+
});
56+
```
57+
58+
3. Starting the development server
59+
60+
- **Start the server**: Follow the instructions in the server's README to start it. Typically, this involves running npm run dev or a similar command in the server directory.
61+
62+
- **Start the client**:
63+
64+
```sh
65+
npm run dev
66+
```
67+
68+
This will start the development server, and you should be able to access the Advanced Checkout Page in your browser at `http://localhost:3000` (or the port specfied in the terminal output).
69+
70+
### Additional Notes
71+
72+
- **Server Setup**: Make sure you have the server up and running before starting the client.
73+
- **Environment Variables**: Carefully configure the environment variables in the .env file to match your setup.
74+
- **Proxy Configuration**: The proxy setting in vite.config.js is crucial for routing API requests from the client to the server during development.

0 commit comments

Comments
 (0)