Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/advanced-integration-v1/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,4 @@
}
}
}
}
}
12 changes: 8 additions & 4 deletions .devcontainer/advanced-integration-v2/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../../.devcontainer/advanced-integration-v2/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
"postCreateCommand": {
"Install Server Packages": "cd server/node && npm install",
"Install Client Packages": "cd client/html && npm install"
},
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
"Start server": "cd server/node && npm start",
"Start client": "cd client/html && npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8888],
"forwardPorts": [3000, 8080],
"portsAttributes": {
"8888": {
"3000": {
"label": "Preview of Advanced Checkout Flow",
"onAutoForward": "openBrowserOnce"
}
Expand Down
12 changes: 8 additions & 4 deletions .devcontainer/standard-integration/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,19 @@
// Use 'onCreateCommand' to run commands when creating the container.
"onCreateCommand": "bash ../.devcontainer/standard-integration/welcome-message.sh",
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "npm install",
"postCreateCommand": {
"Install Client Packages": "cd client/html && npm install",
"Install Server Packages": "cd server/node && npm install"
},
// Use 'postAttachCommand' to run commands when attaching to the container.
"postAttachCommand": {
"Start server": "npm start"
"Start client": "cd client/html && npm start",
"Start server": "cd server/node && npm start"
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
"forwardPorts": [8888],
"forwardPorts": [3000, 8080],
"portsAttributes": {
"8888": {
"3000": {
"label": "Preview of Standard Checkout Flow",
"onAutoForward": "openBrowserOnce"
}
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,6 @@ dist

# TernJS port file
.tern-port

# dotnet
*.sln
1 change: 0 additions & 1 deletion advanced-integration/v2/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions advanced-integration/v2/README.md

This file was deleted.

166 changes: 0 additions & 166 deletions advanced-integration/v2/client/checkout.js

This file was deleted.

4 changes: 4 additions & 0 deletions advanced-integration/v2/client/html/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Create an application to obtain credentials at
# https://developer.paypal.com/dashboard/applications/sandbox

PAYPAL_CLIENT_ID=YOUR_CLIENT_ID_GOES_HERE
2 changes: 2 additions & 0 deletions advanced-integration/v2/client/html/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
*.local
74 changes: 74 additions & 0 deletions advanced-integration/v2/client/html/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Advanced Integration with PayPal : HTML/JS

## Getting Started

This guide will walk you through setting up and running the HTML/JS Advanced Integration locally.

### Before You Code

1. **Setup a PayPal Account**

To get started, you'll need a developer, personal, or business account.

[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)

You'll then need to visit the [Developer Dashboard](https://developer.paypal.com/dashboard/) to obtain credentials and to make sandbox accounts.

2. **Create an Application**

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).

### Installation

```sh
npm install
```

### Configuration

1. Environmental Variables (.env)

- Rename the .env.example file to .env
- Update the following keys with their actual values -

```sh
PAYPAL_CLIENT_ID=<PAYPAL_CLIENT_ID>
```

2. Connecting the client and server (vite.config.js)

- Open vite.config.js in the root directory.
- Locate the proxy configuration object.
- Update the proxy key to match the server's address and port. For example:

```js
export default defineConfig({

server: {
proxy: {
"/api": {
target: "http://localhost:8080", // Replace with your server URL
changeOrigin: true,
},
},
},
});
```

3. Starting the development server

- **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.

- **Start the client**:

```sh
npm run dev
```

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).

### Additional Notes

- **Server Setup**: Make sure you have the server up and running before starting the client.
- **Environment Variables**: Carefully configure the environment variables in the .env file to match your setup.
- **Proxy Configuration**: The proxy setting in vite.config.js is crucial for routing API requests from the client to the server during development.
Loading