Broadleaf Microservices
  • v1.0.0-latest-prod

PayPal Payment Services API Client

Client used for interacting with the PayPal payment service related APIs.

createOrder

Parameters

Parameter Type Required? Description

cartId

string

✅

The cart ID for this request

request

CreateOrderRequestBodyWithModules

✅

The request to create the Order

options

ClientCallOptions

❌

The options to the HTTP call

=== Response

The created OrderResponseBodyWithModules.

=== Example

[source,js] ---- import { PayPalPaymentServicesClient } from '@broadleaf/paypal-checkout-js'; import { ClientOptions } from '@broadleaf/commerce-core';

const options: ClientOptions = { applicationToken, baseHost, locale: currentLocale, preview, }; const client = new PayPalPaymentServicesClient(options); const createOrderResponse = await client.createPayPalOrder(cartId, createOrderRequest); ----

== getOrder

=== Parameters

[cols="2,2,^,5"]

|Parameter |Type |Required? |Description

|cartId |string |✅ |The cart ID for this request

|paypalOrderId |string |✅ |The ID of the PayPal Order to fetch

|options |ClientCallOptions |❌ |The options to the HTTP call

Response

The details of the OrderResponseBodyWithModules.

Example

import { PayPalPaymentServicesClient } from '@broadleaf/paypal-checkout-js';
import { ClientOptions } from '@broadleaf/commerce-core';

const options: ClientOptions = {
applicationToken,
baseHost,
locale: currentLocale,
preview,
};
const client = new PayPalPaymentServicesClient(options);
const getOrderResponse = await client.getPayPalOrder(cartId, paypalOrderId);