Skip to content

Commit

Permalink
docs: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
tianyingchun committed May 15, 2024
1 parent 9c65959 commit d6ceab8
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
5 changes: 5 additions & 0 deletions .changeset/breezy-windows-explode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hyperse-io/paypal-node-sdk": patch
---

update README.md
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ type(scope): Message in present tense
- orders
- payments
- customers
- webhook
- etc.

If a commit affects more than one package, separate them with a comma:
Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

This is a part of the next major PayPal SDK. It includes a simplified interface to only provide simple model objects and blueprints for HTTP calls. This repo currently contains functionality for PayPal Checkout APIs which includes [Orders V2](https://developer.paypal.com/docs/api/orders/v2/) and [Payments V2](https://developer.paypal.com/docs/api/payments/v2/).

Please refer to the [PayPal Checkout Integration Guide](https://developer.paypal.com/docs/checkout/) for more information. Also refer to [Setup your SDK](https://developer.paypal.com/docs/checkout/reference/server-integration/setup-sdk/) for additional information about setting up the SDK's.
Please refer to the [PayPal Checkout Integration Guide](https://developer.paypal.com/docs/checkout/) for more information.

## Usage

Expand All @@ -27,18 +27,18 @@ For contirbuting or referrring the samples, You can fork/refer this repository.
#### Code to Execute:

```javascript
import paypal from "@hyperse-io/paypal-node-sdk";
import { core, orders, payments } from "@hyperse-io/paypal-node-sdk";

// Creating an environment
let clientId = "<<PAYPAL-CLIENT-ID>>";
let clientSecret = "<<PAYPAL-CLIENT-SECRET>>";
// This sample uses SandboxEnvironment. In production, use LiveEnvironment
let environment = new paypal.core.SandboxEnvironment(clientId, clientSecret);
let client = new paypal.core.PayPalHttpClient(environment);
let environment = new core.SandboxEnvironment(clientId, clientSecret);
let client = new core.PayPalHttpClient(environment);

// Construct a request object and set desired parameters
// Here, OrdersCreateRequest() creates a POST request to /v2/checkout/orders
let request = new paypal.orders.OrdersCreateRequest();
let request = new orders.OrdersCreateRequest();
request.requestBody({
"intent": "CAPTURE",
"purchase_units": [
Expand Down Expand Up @@ -100,7 +100,7 @@ Before Capturing an order, it should be approved by the buyer using approve link

```javascript
let captureOrder = async function (orderId) {
request = new paypal.orders.OrdersCaptureRequest(orderId);
request = new orders.OrdersCaptureRequest(orderId);
request.requestBody({});
// Call API with your client and get a response for your call
let response = await client.execute(request);
Expand Down Expand Up @@ -225,11 +225,9 @@ $ PAYPAL_CLIENT_ID=YOUR_SANDBOX_CLIENT_ID PAYPAL_CLIENT_SECRET=YOUR_SANDBOX_CLIE

## Samples

You can start off by trying out [creating and capturing an order](https://github.com/paypal/Checkout-NodeJS-SDK/tree/master/samples/CaptureIntentExamples/runAll.js)
You can start off by trying out [creating and capturing an order](https://github.com/hyperse-io/paypal-node-sdk/tree/main/samples/CaptureIntentExamples/runAll.ts)

To try out different samples for both create and authorize intent check [this link](https://github.com/paypal/Checkout-NodeJS-SDK/tree/master/samples)

Note: Update the `payPalClient.js` with your sandbox client credentials or pass your client credentials as environment variable while executing the samples.
Note: Update the `payPalClient.ts` with your sandbox client credentials or pass your client credentials as environment variable while executing the samples.[creating and capturing an order](https://github.com/hyperse-io/paypal-node-sdk/tree/main/samples/CaptureIntentExamples/runAll.ts)

## Note

Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## typings

- `"@types/paypal__checkout-server-sdk": "^1.0.8"`
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
},
"dependencies": {
"@paypal/paypalhttp": "^1.0.1",
"@types/paypal__checkout-server-sdk": "^1.0.8",
"@types/paypal__paypalhttp": "^1.0.3"
},
"devDependencies": {
Expand Down

0 comments on commit d6ceab8

Please sign in to comment.