Skip to content

Latest commit

 

History

History
3683 lines (2551 loc) · 116 KB

api-reference.md

File metadata and controls

3683 lines (2551 loc) · 116 KB

Reference

Source: PaypalClient

Orders

Source: Orders

authorizeOrder(request: Orders.AuthorizeOrderRequest, options?: RequestOptions): ApiPromise<OrderAuthorizeResponse, Orders.AuthorizeOrderError>

Description

Authorizes payment for an order. To successfully authorize payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response. Note: For error handling and troubleshooting, see Orders v2 errors.

Direct Usage

try {
  const response = await client.orders.authorizeOrder({ id: "some example string" });
  // TODO: Handle 'response' of type OrderAuthorizeResponse
} catch (err) {
  // TODO: Handle 'err' of type Orders.AuthorizeOrderError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.authorizeOrder({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type OrderAuthorizeResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order for which to authorize.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalRequestId? string The server stores keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. It is mandatory for all single-step create order calls (E.g. Create Order Request with payment source information like Card, PayPal.vault_id, PayPal.billing_agreement_id, etc).
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalClientMetadataId? string -
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
body? OrderAuthorizeRequest -

Response

Direct: await client.orders.authorizeOrder(request)

As ApiResult: await client.orders.authorizeOrder(request).asApiResult()

  • OnSuccess: ApiResult<OrderAuthorizeResponse, Orders.AuthorizeOrderError>, with result.value of type OrderAuthorizeResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

captureOrder(request: Orders.CaptureOrderRequest, options?: RequestOptions): ApiPromise<Order, Orders.CaptureOrderError>

Description

Captures payment for an order. To successfully capture payment for an order, the buyer must first approve the order or a valid payment_source must be provided in the request. A buyer can approve the order upon being redirected to the rel:approve URL that was returned in the HATEOAS links in the create order response. Note: For error handling and troubleshooting, see Orders v2 errors.

Direct Usage

try {
  const response = await client.orders.captureOrder({ id: "some example string" });
  // TODO: Handle 'response' of type Order
} catch (err) {
  // TODO: Handle 'err' of type Orders.CaptureOrderError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.captureOrder({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Order
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order for which to capture a payment.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalRequestId? string The server stores keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. It is mandatory for all single-step create order calls (E.g. Create Order Request with payment source information like Card, PayPal.vault_id, PayPal.billing_agreement_id, etc).
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalClientMetadataId? string -
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
body? OrderCaptureRequest -

Response

Direct: await client.orders.captureOrder(request)

As ApiResult: await client.orders.captureOrder(request).asApiResult()

  • OnSuccess: ApiResult<Order, Orders.CaptureOrderError>, with result.value of type Order
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

confirmOrder(request: Orders.ConfirmOrderRequestParams, options?: RequestOptions): ApiPromise<Order, Orders.ConfirmOrderError>

Description

Payer confirms their intent to pay for the the Order with the given payment source.

Direct Usage

try {
  const response = await client.orders.confirmOrder({ id: "some example string" });
  // TODO: Handle 'response' of type Order
} catch (err) {
  // TODO: Handle 'err' of type Orders.ConfirmOrderError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.confirmOrder({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Order
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order for which the payer confirms their intent to pay.
payPalClientMetadataId? string -
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
body? ConfirmOrderRequest -

Response

Direct: await client.orders.confirmOrder(request)

As ApiResult: await client.orders.confirmOrder(request).asApiResult()

  • OnSuccess: ApiResult<Order, Orders.ConfirmOrderError>, with result.value of type Order
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

createOrder(request: Orders.CreateOrderRequest, options?: RequestOptions): ApiPromise<Order, Orders.CreateOrderError>

Description

Creates an order. Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see checkout or multiparty checkout. Note: For error handling and troubleshooting, see Orders v2 errors.

Direct Usage

try {
  const response = await client.orders.createOrder({
    body: {
      intent: CheckoutPaymentIntent.Capture,
      purchaseUnits: [{ amount: { currencyCode: "some example string", value: "some example string" } }],
    },
  });
  // TODO: Handle 'response' of type Order
} catch (err) {
  // TODO: Handle 'err' of type Orders.CreateOrderError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.createOrder({
  body: {
    intent: CheckoutPaymentIntent.Capture,
    purchaseUnits: [{ amount: { currencyCode: "some example string", value: "some example string" } }],
  },
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Order
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalRequestId? string The server stores keys for 6 hours. The API callers can request the times to up to 72 hours by speaking to their Account Manager. It is mandatory for all single-step create order calls (E.g. Create Order Request with payment source information like Card, PayPal.vault_id, PayPal.billing_agreement_id, etc).
payPalPartnerAttributionId? string -
payPalClientMetadataId? string -
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
body OrderRequest -

Response

Direct: await client.orders.createOrder(request)

As ApiResult: await client.orders.createOrder(request).asApiResult()

  • OnSuccess: ApiResult<Order, Orders.CreateOrderError>, with result.value of type Order
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

createOrderTracking(request: Orders.CreateOrderTrackingRequest, options?: RequestOptions): ApiPromise<Order, Orders.CreateOrderTrackingError>

Description

Adds tracking information for an Order.

Direct Usage

try {
  const response = await client.orders.createOrderTracking({
    id: "some example string",
    body: { captureId: "some example string" },
  });
  // TODO: Handle 'response' of type Order
} catch (err) {
  // TODO: Handle 'err' of type Orders.CreateOrderTrackingError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.createOrderTracking({
  id: "some example string",
  body: { captureId: "some example string" },
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Order
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order that the tracking information is associated with.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
body OrderTrackerRequest -

Response

Direct: await client.orders.createOrderTracking(request)

As ApiResult: await client.orders.createOrderTracking(request).asApiResult()

  • OnSuccess: ApiResult<Order, Orders.CreateOrderTrackingError>, with result.value of type Order
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getOrder(request: Orders.GetOrderRequest, options?: RequestOptions): ApiPromise<Order, Orders.GetOrderError>

Description

Shows details for an order, by ID. Note: For error handling and troubleshooting, see Orders v2 errors.

Direct Usage

try {
  const response = await client.orders.getOrder({ id: "some example string" });
  // TODO: Handle 'response' of type Order
} catch (err) {
  // TODO: Handle 'err' of type Orders.GetOrderError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.getOrder({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Order
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order for which to show details.
fields? string A comma-separated list of fields that should be returned for the order. Valid filter field is payment_source.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.

Response

Direct: await client.orders.getOrder(request)

As ApiResult: await client.orders.getOrder(request).asApiResult()

  • OnSuccess: ApiResult<Order, Orders.GetOrderError>, with result.value of type Order
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

patchOrder(request: Orders.PatchOrderRequest, options?: RequestOptions): ApiPromise<undefined, Orders.PatchOrderError>

Description

Updates an order with a CREATED or APPROVED status. You cannot update an order with the COMPLETED status.

To make an update, you must provide a reference_id. If you omit this value with an order that contains only one purchase unit, PayPal sets the value to default which enables you to use the path: "/purchase_units/@reference_id=='default'/{attribute-or-object}". Merchants and partners can add Level 2 and 3 data to payments to reduce risk and payment processing costs. For more information about processing payments, see checkout or multiparty checkout.

Note: For error handling and troubleshooting, see Orders v2 errors.
Patchable attributes or objects:

AttributeOpNotes
intentreplace
payerreplace, addUsing replace op for payer will replace the whole payer object with the value sent in request.
purchase_unitsreplace, add
purchase_units[].custom_idreplace, add, remove
purchase_units[].descriptionreplace, add, remove
purchase_units[].payee.emailreplace
purchase_units[].shipping.namereplace, add
purchase_units[].shipping.email_addressreplace, add
purchase_units[].shipping.phone_numberreplace, add
purchase_units[].shipping.optionsreplace, add
purchase_units[].shipping.addressreplace, add
purchase_units[].shipping.typereplace, add
purchase_units[].soft_descriptorreplace, remove
purchase_units[].amountreplace
purchase_units[].itemsreplace, add, remove
purchase_units[].invoice_idreplace, add, remove
purchase_units[].payment_instructionreplace
purchase_units[].payment_instruction.disbursement_modereplaceBy default, disbursement_mode is INSTANT.
purchase_units[].payment_instruction.payee_receivable_fx_rate_idreplace, add, remove
purchase_units[].payment_instruction.platform_feesreplace, add, remove
purchase_units[].supplementary_data.airlinereplace, add, remove
purchase_units[].supplementary_data.cardreplace, add, remove
application_context.client_configurationreplace, add

Direct Usage

try {
  await client.orders.patchOrder({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Orders.PatchOrderError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.patchOrder({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order to update.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
body? Patch[] -

Response

Direct: await client.orders.patchOrder(request)

As ApiResult: await client.orders.patchOrder(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Orders.PatchOrderError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

updateOrderTracking(request: Orders.UpdateOrderTrackingRequest, options?: RequestOptions): ApiPromise<undefined, Orders.UpdateOrderTrackingError>

Description

Updates or cancels the tracking information for a PayPal order, by ID. Updatable attributes or objects: Attribute Op Notes items replace Using replace op for items will replace the entire items object with the value sent in request. notify_payer replace, add status replace Only patching status to CANCELLED is currently supported.

Direct Usage

try {
  await client.orders.updateOrderTracking({ id: "some example string", trackerId: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Orders.UpdateOrderTrackingError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.orders.updateOrderTracking({
  id: "some example string",
  trackerId: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the order that the tracking information is associated with.
trackerId string The order tracking ID.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
body? Patch[] -

Response

Direct: await client.orders.updateOrderTracking(request)

As ApiResult: await client.orders.updateOrderTracking(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Orders.UpdateOrderTrackingError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

Payments

Source: Payments

captureAuthorizedPayment(request: Payments.CaptureAuthorizedPaymentRequest, options?: RequestOptions): ApiPromise<CapturedPayment, Payments.CaptureAuthorizedPaymentError>

Description

Captures an authorized payment, by ID.

Direct Usage

try {
  const response = await client.payments.captureAuthorizedPayment({ authorizationId: "some example string" });
  // TODO: Handle 'response' of type CapturedPayment
} catch (err) {
  // TODO: Handle 'err' of type Payments.CaptureAuthorizedPaymentError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.captureAuthorizedPayment({
  authorizationId: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type CapturedPayment
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
authorizationId string The PayPal-generated ID for the authorized payment to capture.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalRequestId? string The server stores keys for 45 days.
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion. Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.
body? CaptureRequest -

Response

Direct: await client.payments.captureAuthorizedPayment(request)

As ApiResult: await client.payments.captureAuthorizedPayment(request).asApiResult()

  • OnSuccess: ApiResult<CapturedPayment, Payments.CaptureAuthorizedPaymentError>, with result.value of type CapturedPayment
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getAuthorizedPayment(request: Payments.GetAuthorizedPaymentRequest, options?: RequestOptions): ApiPromise<PaymentAuthorization, Payments.GetAuthorizedPaymentError>

Description

Shows details for an authorized payment, by ID.

Direct Usage

try {
  const response = await client.payments.getAuthorizedPayment({ authorizationId: "some example string" });
  // TODO: Handle 'response' of type PaymentAuthorization
} catch (err) {
  // TODO: Handle 'err' of type Payments.GetAuthorizedPaymentError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.getAuthorizedPayment({
  authorizationId: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type PaymentAuthorization
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
authorizationId string The ID of the authorized payment for which to show details.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion. Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.

Response

Direct: await client.payments.getAuthorizedPayment(request)

As ApiResult: await client.payments.getAuthorizedPayment(request).asApiResult()

  • OnSuccess: ApiResult<PaymentAuthorization, Payments.GetAuthorizedPaymentError>, with result.value of type PaymentAuthorization
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getCapturedPayment(request: Payments.GetCapturedPaymentRequest, options?: RequestOptions): ApiPromise<CapturedPayment, Payments.GetCapturedPaymentError>

Description

Shows details for a captured payment, by ID.

Direct Usage

try {
  const response = await client.payments.getCapturedPayment({ captureId: "some example string" });
  // TODO: Handle 'response' of type CapturedPayment
} catch (err) {
  // TODO: Handle 'err' of type Payments.GetCapturedPaymentError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.getCapturedPayment({ captureId: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type CapturedPayment
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
captureId string The PayPal-generated ID for the captured payment for which to show details.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.

Response

Direct: await client.payments.getCapturedPayment(request)

As ApiResult: await client.payments.getCapturedPayment(request).asApiResult()

  • OnSuccess: ApiResult<CapturedPayment, Payments.GetCapturedPaymentError>, with result.value of type CapturedPayment
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getRefund(request: Payments.GetRefundRequest, options?: RequestOptions): ApiPromise<Refund, Payments.GetRefundError>

Description

Shows details for a refund, by ID.

Direct Usage

try {
  const response = await client.payments.getRefund({ refundId: "some example string" });
  // TODO: Handle 'response' of type Refund
} catch (err) {
  // TODO: Handle 'err' of type Payments.GetRefundError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.getRefund({ refundId: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Refund
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
refundId string The PayPal-generated ID for the refund for which to show details.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion. Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.

Response

Direct: await client.payments.getRefund(request)

As ApiResult: await client.payments.getRefund(request).asApiResult()

  • OnSuccess: ApiResult<Refund, Payments.GetRefundError>, with result.value of type Refund
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

reauthorizePayment(request: Payments.ReauthorizePaymentRequest, options?: RequestOptions): ApiPromise<PaymentAuthorization, Payments.ReauthorizePaymentError>

Description

Reauthorizes an authorized PayPal account payment, by ID. To ensure that funds are still available, reauthorize a payment after its initial three-day honor period expires. Within the 29-day authorization period, you can issue multiple re-authorizations after the honor period expires. If 30 days have transpired since the date of the original authorization, you must create an authorized payment instead of reauthorizing the original authorized payment. A reauthorized payment itself has a new honor period of three days. You can reauthorize an authorized payment from 4 to 29 days after the 3-day honor period. The allowed amount depends on context and geography, for example in US it is up to 115% of the original authorized amount, not to exceed an increase of $75 USD. Supports only the amount request parameter.

Direct Usage

try {
  const response = await client.payments.reauthorizePayment({ authorizationId: "some example string" });
  // TODO: Handle 'response' of type PaymentAuthorization
} catch (err) {
  // TODO: Handle 'err' of type Payments.ReauthorizePaymentError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.reauthorizePayment({
  authorizationId: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type PaymentAuthorization
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
authorizationId string The PayPal-generated ID for the authorized payment to reauthorize.
payPalRequestId? string The server stores keys for 45 days.
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion. Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.
body? ReauthorizeRequest -

Response

Direct: await client.payments.reauthorizePayment(request)

As ApiResult: await client.payments.reauthorizePayment(request).asApiResult()

  • OnSuccess: ApiResult<PaymentAuthorization, Payments.ReauthorizePaymentError>, with result.value of type PaymentAuthorization
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

refundCapturedPayment(request: Payments.RefundCapturedPaymentRequest, options?: RequestOptions): ApiPromise<Refund, Payments.RefundCapturedPaymentError>

Description

Refunds a captured payment, by ID. For a full refund, include an empty payload in the JSON request body. For a partial refund, include an amount object in the JSON request body.

Direct Usage

try {
  const response = await client.payments.refundCapturedPayment({ captureId: "some example string" });
  // TODO: Handle 'response' of type Refund
} catch (err) {
  // TODO: Handle 'err' of type Payments.RefundCapturedPaymentError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.refundCapturedPayment({
  captureId: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Refund
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
captureId string The PayPal-generated ID for the captured payment to refund.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalRequestId? string The server stores keys for 45 days.
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion. Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.
body? RefundRequest -

Response

Direct: await client.payments.refundCapturedPayment(request)

As ApiResult: await client.payments.refundCapturedPayment(request).asApiResult()

  • OnSuccess: ApiResult<Refund, Payments.RefundCapturedPaymentError>, with result.value of type Refund
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

voidPayment(request: Payments.VoidPaymentRequest, options?: RequestOptions): ApiPromise<PaymentAuthorization, Payments.VoidPaymentError>

Description

Voids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been fully captured.

Direct Usage

try {
  const response = await client.payments.voidPayment({ authorizationId: "some example string" });
  // TODO: Handle 'response' of type PaymentAuthorization
} catch (err) {
  // TODO: Handle 'err' of type Payments.VoidPaymentError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.payments.voidPayment({ authorizationId: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type PaymentAuthorization
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
authorizationId string The PayPal-generated ID for the authorized payment to void.
payPalMockResponse? string PayPal's REST API uses a request header to invoke negative testing in the sandbox. This header configures the sandbox into a negative testing state for transactions that include the merchant.
payPalAuthAssertion? string An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion. Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.
payPalRequestId? string The server stores keys for 45 days.
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"

Response

Direct: await client.payments.voidPayment(request)

As ApiResult: await client.payments.voidPayment(request).asApiResult()

  • OnSuccess: ApiResult<PaymentAuthorization, Payments.VoidPaymentError>, with result.value of type PaymentAuthorization
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

Vault

Source: Vault

createPaymentToken(request: Vault.CreatePaymentTokenRequest, options?: RequestOptions): ApiPromise<PaymentTokenResponse, Vault.CreatePaymentTokenError>

Description

Creates a Payment Token from the given payment source and adds it to the Vault of the associated customer.

Direct Usage

try {
  const response = await client.vault.createPaymentToken({ body: { paymentSource: {} } });
  // TODO: Handle 'response' of type PaymentTokenResponse
} catch (err) {
  // TODO: Handle 'err' of type Vault.CreatePaymentTokenError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.vault.createPaymentToken({ body: { paymentSource: {} } }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type PaymentTokenResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
payPalRequestId? string The server stores keys for 3 hours.
body PaymentTokenRequest Payment Token creation with a financial instrument and an optional customer_id.

Response

Direct: await client.vault.createPaymentToken(request)

As ApiResult: await client.vault.createPaymentToken(request).asApiResult()

  • OnSuccess: ApiResult<PaymentTokenResponse, Vault.CreatePaymentTokenError>, with result.value of type PaymentTokenResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

createSetupToken(request: Vault.CreateSetupTokenRequest, options?: RequestOptions): ApiPromise<SetupTokenResponse, Vault.CreateSetupTokenError>

Description

Creates a Setup Token from the given payment source and adds it to the Vault of the associated customer.

Direct Usage

try {
  const response = await client.vault.createSetupToken({ body: { paymentSource: {} } });
  // TODO: Handle 'response' of type SetupTokenResponse
} catch (err) {
  // TODO: Handle 'err' of type Vault.CreateSetupTokenError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.vault.createSetupToken({ body: { paymentSource: {} } }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type SetupTokenResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
payPalRequestId? string The server stores keys for 3 hours.
body SetupTokenRequest Setup Token creation with a instrument type optional financial instrument details and customer_id.

Response

Direct: await client.vault.createSetupToken(request)

As ApiResult: await client.vault.createSetupToken(request).asApiResult()

  • OnSuccess: ApiResult<SetupTokenResponse, Vault.CreateSetupTokenError>, with result.value of type SetupTokenResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

deletePaymentToken(request: Vault.DeletePaymentTokenRequest, options?: RequestOptions): ApiPromise<undefined, Vault.DeletePaymentTokenError>

Description

Delete the payment token associated with the payment token id.

Direct Usage

try {
  await client.vault.deletePaymentToken({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Vault.DeletePaymentTokenError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.vault.deletePaymentToken({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string ID of the payment token.

Response

Direct: await client.vault.deletePaymentToken(request)

As ApiResult: await client.vault.deletePaymentToken(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Vault.DeletePaymentTokenError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getPaymentToken(request: Vault.GetPaymentTokenRequest, options?: RequestOptions): ApiPromise<PaymentTokenResponse, Vault.GetPaymentTokenError>

Description

Returns a readable representation of vaulted payment source associated with the payment token id.

Direct Usage

try {
  const response = await client.vault.getPaymentToken({ id: "some example string" });
  // TODO: Handle 'response' of type PaymentTokenResponse
} catch (err) {
  // TODO: Handle 'err' of type Vault.GetPaymentTokenError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.vault.getPaymentToken({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type PaymentTokenResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string ID of the payment token.

Response

Direct: await client.vault.getPaymentToken(request)

As ApiResult: await client.vault.getPaymentToken(request).asApiResult()

  • OnSuccess: ApiResult<PaymentTokenResponse, Vault.GetPaymentTokenError>, with result.value of type PaymentTokenResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getSetupToken(request: Vault.GetSetupTokenRequest, options?: RequestOptions): ApiPromise<SetupTokenResponse, Vault.GetSetupTokenError>

Description

Returns a readable representation of temporarily vaulted payment source associated with the setup token id.

Direct Usage

try {
  const response = await client.vault.getSetupToken({ id: "some example string" });
  // TODO: Handle 'response' of type SetupTokenResponse
} catch (err) {
  // TODO: Handle 'err' of type Vault.GetSetupTokenError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.vault.getSetupToken({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type SetupTokenResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string ID of the setup token.

Response

Direct: await client.vault.getSetupToken(request)

As ApiResult: await client.vault.getSetupToken(request).asApiResult()

  • OnSuccess: ApiResult<SetupTokenResponse, Vault.GetSetupTokenError>, with result.value of type SetupTokenResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

listCustomerPaymentTokens(request: Vault.ListCustomerPaymentTokensRequest, options?: RequestOptions): ApiPromise<CustomerVaultPaymentTokensResponse, Vault.ListCustomerPaymentTokensError>

Description

Returns all payment tokens for a customer.

Direct Usage

try {
  const response = await client.vault.listCustomerPaymentTokens({ customerId: "some example string" });
  // TODO: Handle 'response' of type CustomerVaultPaymentTokensResponse
} catch (err) {
  // TODO: Handle 'err' of type Vault.ListCustomerPaymentTokensError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.vault.listCustomerPaymentTokens({
  customerId: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type CustomerVaultPaymentTokensResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
customerId string A unique identifier representing a specific customer in merchant's/partner's system or records.
pageSize? number A non-negative, non-zero integer indicating the maximum number of results to return at one time.
Default: 5
page? number A non-negative, non-zero integer representing the page of the results.
Default: 1
totalRequired? boolean A boolean indicating total number of items (total_items) and pages (total_pages) are expected to be returned in the response.
Default: false

Response

Direct: await client.vault.listCustomerPaymentTokens(request)

As ApiResult: await client.vault.listCustomerPaymentTokens(request).asApiResult()

  • OnSuccess: ApiResult<CustomerVaultPaymentTokensResponse, Vault.ListCustomerPaymentTokensError>, with result.value of type CustomerVaultPaymentTokensResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

TransactionSearch

Source: TransactionSearch

searchBalances(request: TransactionSearch.SearchBalancesRequest, options?: RequestOptions): ApiPromise<BalancesResponse, TransactionSearch.SearchBalancesError>

Description

List all balances. Specify date time to list balances for that time that appear in the response. Notes: It takes a maximum of three hours for balances to appear in the list balances call. This call lists balances upto the previous three years.

Direct Usage

try {
  const response = await client.transactionSearch.searchBalances();
  // TODO: Handle 'response' of type BalancesResponse
} catch (err) {
  // TODO: Handle 'err' of type TransactionSearch.SearchBalancesError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.transactionSearch.searchBalances().asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type BalancesResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
asOfTime? string List balances in the response at the date time provided, will return the last refreshed balance in the system when not provided.
currencyCode? string Filters the transactions in the response by a three-character ISO-4217 currency code for the PayPal transaction currency.

Response

Direct: await client.transactionSearch.searchBalances(request)

As ApiResult: await client.transactionSearch.searchBalances(request).asApiResult()

  • OnSuccess: ApiResult<BalancesResponse, TransactionSearch.SearchBalancesError>, with result.value of type BalancesResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

searchTransactions(request: TransactionSearch.SearchTransactionsRequest, options?: RequestOptions): ApiPromise<SearchResponse, TransactionSearch.SearchTransactionsError>

Description

Lists transactions. Specify one or more query parameters to filter the transaction that appear in the response. Notes: If you specify one or more optional query parameters, the ending_balance response field is empty. It takes a maximum of three hours for executed transactions to appear in the list transactions call. This call lists transaction for the previous three years.

Direct Usage

try {
  const response = await client.transactionSearch.searchTransactions({
    startDate: "some example string",
    endDate: "some example string",
  });
  // TODO: Handle 'response' of type SearchResponse
} catch (err) {
  // TODO: Handle 'err' of type TransactionSearch.SearchTransactionsError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.transactionSearch.searchTransactions({
  startDate: "some example string",
  endDate: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type SearchResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
startDate string Filters the transactions in the response by a start date and time, in Internet date and time format. Seconds are required. Fractional seconds are optional.
endDate string Filters the transactions in the response by an end date and time, in Internet date and time format. Seconds are required. Fractional seconds are optional. The maximum supported range is 31 days.
transactionId? string Filters the transactions in the response by a PayPal transaction ID. A valid transaction ID is 17 characters long, except for an order ID, which is 19 characters long. Note: A transaction ID is not unique in the reporting system. The response can list two transactions with the same ID. One transaction can be balance affecting while the other is non-balance affecting.
transactionType? string Filters the transactions in the response by a PayPal transaction event code. See Transaction event codes.
transactionStatus? string Filters the transactions in the response by a PayPal transaction status code. Value is: Status code Description D PayPal or merchant rules denied the transaction. P The transaction is pending. The transaction was created but waits for another payment process to complete, such as an ACH transaction, before the status changes to S. S The transaction successfully completed without a denial and after any pending statuses. V A successful transaction was reversed and funds were refunded to the original sender.
transactionAmount? string Filters the transactions in the response by a gross transaction amount range. Specify the range as TO, where is the lower limit of the gross PayPal transaction amount and is the upper limit of the gross transaction amount. Specify the amounts in lower denominations. For example, to search for transactions from $5.00 to $10.05, specify [500 TO 1005]. Note:The values must be URL encoded.
transactionCurrency? string Filters the transactions in the response by a three-character ISO-4217 currency code for the PayPal transaction currency.
paymentInstrumentType? string Filters the transactions in the response by a payment instrument type. Value is either: CREDITCARD. Returns a direct credit card transaction with a corresponding value. DEBITCARD. Returns a debit card transaction with a corresponding value. If you omit this parameter, the API does not apply this filter.
storeId? string Filters the transactions in the response by a store ID.
terminalId? string Filters the transactions in the response by a terminal ID.
fields? string Indicates which fields appear in the response. Value is a single field or a comma-separated list of fields. The transaction_info value returns only the transaction details in the response. To include all fields in the response, specify fields=all. Valid fields are: transaction_info. The transaction information. Includes the ID of the PayPal account of the payee, the PayPal-generated transaction ID, the PayPal-generated base ID, the PayPal reference ID type, the transaction event code, the date and time when the transaction was initiated and was last updated, the transaction amounts including the PayPal fee, any discounts, insurance, the transaction status, and other information about the transaction. payer_info. The payer information. Includes the PayPal customer account ID and the payer's email address, primary phone number, name, country code, address, and whether the payer is verified or unverified. shipping_info. The shipping information. Includes the recipient's name, the shipping method for this order, the shipping address for this order, and the secondary address associated with this order. auction_info. The auction information. Includes the name of the auction site, the auction site URL, the ID of the customer who makes the purchase in the auction, and the date and time when the auction closes. cart_info. The cart information. Includes an array of item details, whether the item amount or the shipping amount already includes tax, and the ID of the invoice for PayPal-generated invoices. incentive_info. An array of incentive detail objects. Each object includes the incentive, such as a special offer or coupon, the incentive amount, and the incentive program code that identifies a merchant loyalty or incentive program. store_info. The store information. Includes the ID of the merchant store and the terminal ID for the checkout stand in the merchant store.
Default: "transaction_info"
balanceAffectingRecordsOnly? string Indicates whether the response includes only balance-impacting transactions or all transactions. Value is either: Y. The default. The response includes only balance transactions. N. The response includes all transactions.
Default: "Y"
pageSize? number The number of items to return in the response. So, the combination of page=1 and page_size=20 returns the first 20 items. The combination of page=2 and page_size=20 returns the next 20 items.
Default: 100
page? number The zero-relative start index of the entire list of items that are returned in the response. So, the combination of page=1 and page_size=20 returns the first 20 items.
Default: 1

Response

Direct: await client.transactionSearch.searchTransactions(request)

As ApiResult: await client.transactionSearch.searchTransactions(request).asApiResult()

  • OnSuccess: ApiResult<SearchResponse, TransactionSearch.SearchTransactionsError>, with result.value of type SearchResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

Subscriptions

Source: Subscriptions

activateBillingPlan(request: Subscriptions.ActivateBillingPlanRequest, options?: RequestOptions): ApiPromise<undefined, Subscriptions.ActivateBillingPlanError>

Description

Activates a plan, by ID.

Direct Usage

try {
  await client.subscriptions.activateBillingPlan({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.ActivateBillingPlanError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.activateBillingPlan({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the plan.

Response

Direct: await client.subscriptions.activateBillingPlan(request)

As ApiResult: await client.subscriptions.activateBillingPlan(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.ActivateBillingPlanError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

activateSubscription(request: Subscriptions.ActivateSubscriptionRequestParams, options?: RequestOptions): ApiPromise<undefined, Subscriptions.ActivateSubscriptionError>

Description

Activates the subscription.

Direct Usage

try {
  await client.subscriptions.activateSubscription({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.ActivateSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.activateSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
body? ActivateSubscriptionRequest -

Response

Direct: await client.subscriptions.activateSubscription(request)

As ApiResult: await client.subscriptions.activateSubscription(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.ActivateSubscriptionError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

cancelSubscription(request: Subscriptions.CancelSubscriptionRequestParams, options?: RequestOptions): ApiPromise<undefined, Subscriptions.CancelSubscriptionError>

Description

Cancels the subscription.

Direct Usage

try {
  await client.subscriptions.cancelSubscription({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.CancelSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.cancelSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
body? CancelSubscriptionRequest -

Response

Direct: await client.subscriptions.cancelSubscription(request)

As ApiResult: await client.subscriptions.cancelSubscription(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.CancelSubscriptionError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

captureSubscription(request: Subscriptions.CaptureSubscriptionRequestParams, options?: RequestOptions): ApiPromise<SubscriptionTransactionDetails, Subscriptions.CaptureSubscriptionError>

Description

Captures an authorized payment from the subscriber on the subscription.

Direct Usage

try {
  const response = await client.subscriptions.captureSubscription({ id: "some example string" });
  // TODO: Handle 'response' of type SubscriptionTransactionDetails
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.CaptureSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.captureSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type SubscriptionTransactionDetails
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
payPalRequestId? string The server stores keys for 72 hours.
body? CaptureSubscriptionRequest -

Response

Direct: await client.subscriptions.captureSubscription(request)

As ApiResult: await client.subscriptions.captureSubscription(request).asApiResult()

  • OnSuccess: ApiResult<SubscriptionTransactionDetails, Subscriptions.CaptureSubscriptionError>, with result.value of type SubscriptionTransactionDetails
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

createBillingPlan(request: Subscriptions.CreateBillingPlanRequest, options?: RequestOptions): ApiPromise<BillingPlan, Subscriptions.CreateBillingPlanError>

Description

Creates a plan that defines pricing and billing cycle details for subscriptions.

Direct Usage

try {
  const response = await client.subscriptions.createBillingPlan();
  // TODO: Handle 'response' of type BillingPlan
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.CreateBillingPlanError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.createBillingPlan().asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type BillingPlan
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalRequestId? string The server stores keys for 72 hours.
body? PlanRequest -

Response

Direct: await client.subscriptions.createBillingPlan(request)

As ApiResult: await client.subscriptions.createBillingPlan(request).asApiResult()

  • OnSuccess: ApiResult<BillingPlan, Subscriptions.CreateBillingPlanError>, with result.value of type BillingPlan
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

createSubscription(request: Subscriptions.CreateSubscriptionRequestParams, options?: RequestOptions): ApiPromise<Subscription, Subscriptions.CreateSubscriptionError>

Description

Creates a subscription.

Direct Usage

try {
  const response = await client.subscriptions.createSubscription();
  // TODO: Handle 'response' of type Subscription
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.CreateSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.createSubscription().asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Subscription
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, status and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"
payPalRequestId? string The server stores keys for 72 hours.
payPalClientMetadataId? string The PayPal Client Metadata Id(CMID) is used to provide device-specific information to PayPal's risk engine. This is crucial for transactions that require device-specific risk assessments. Merchants typically use the Paypal SDK that automatically submits the CMID or they use tools like Fraudnet JS for web or Magnes JS for mobile to generate the CMID on the frontend and then pass it to the API as part of the request headers.
body? CreateSubscriptionRequest -

Response

Direct: await client.subscriptions.createSubscription(request)

As ApiResult: await client.subscriptions.createSubscription(request).asApiResult()

  • OnSuccess: ApiResult<Subscription, Subscriptions.CreateSubscriptionError>, with result.value of type Subscription
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

deactivateBillingPlan(request: Subscriptions.DeactivateBillingPlanRequest, options?: RequestOptions): ApiPromise<undefined, Subscriptions.DeactivateBillingPlanError>

Description

Deactivates a plan, by ID.

Direct Usage

try {
  await client.subscriptions.deactivateBillingPlan({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.DeactivateBillingPlanError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.deactivateBillingPlan({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the plan.

Response

Direct: await client.subscriptions.deactivateBillingPlan(request)

As ApiResult: await client.subscriptions.deactivateBillingPlan(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.DeactivateBillingPlanError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getBillingPlan(request: Subscriptions.GetBillingPlanRequest, options?: RequestOptions): ApiPromise<BillingPlan, Subscriptions.GetBillingPlanError>

Description

Shows details for a plan, by ID.

Direct Usage

try {
  const response = await client.subscriptions.getBillingPlan({ id: "some example string" });
  // TODO: Handle 'response' of type BillingPlan
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.GetBillingPlanError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.getBillingPlan({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type BillingPlan
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the plan.

Response

Direct: await client.subscriptions.getBillingPlan(request)

As ApiResult: await client.subscriptions.getBillingPlan(request).asApiResult()

  • OnSuccess: ApiResult<BillingPlan, Subscriptions.GetBillingPlanError>, with result.value of type BillingPlan
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

getSubscription(request: Subscriptions.GetSubscriptionRequest, options?: RequestOptions): ApiPromise<Subscription, Subscriptions.GetSubscriptionError>

Description

Shows details for a subscription, by ID.

Direct Usage

try {
  const response = await client.subscriptions.getSubscription({ id: "some example string" });
  // TODO: Handle 'response' of type Subscription
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.GetSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.getSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type Subscription
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
fields? string List of fields that are to be returned in the response. Possible value for fields are last_failed_payment and plan.

Response

Direct: await client.subscriptions.getSubscription(request)

As ApiResult: await client.subscriptions.getSubscription(request).asApiResult()

  • OnSuccess: ApiResult<Subscription, Subscriptions.GetSubscriptionError>, with result.value of type Subscription
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

listBillingPlans(request: Subscriptions.ListBillingPlansRequest, options?: RequestOptions): ApiPromise<PlanCollection, Subscriptions.ListBillingPlansError>

Description

Lists billing plans.

Direct Usage

try {
  const response = await client.subscriptions.listBillingPlans();
  // TODO: Handle 'response' of type PlanCollection
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.ListBillingPlansError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.listBillingPlans().asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type PlanCollection
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
productId? string Filters the response by a Product ID.
pageSize? number The number of items to return in the response.
Default: 10
page? number A non-zero integer which is the start index of the entire list of items to return in the response. The combination of page=1 and page_size=20 returns the first 20 items. The combination of page=2 and page_size=20 returns the next 20 items.
Default: 1
totalRequired? boolean Indicates whether to show the total count in the response.
Default: false
prefer? string The preferred server response upon successful completion of the request. Value is: return=minimal. The server returns a minimal response to optimize communication between the API caller and the server. A minimal response includes the id, name, description and HATEOAS links. return=representation. The server returns a complete resource representation, including the current state of the resource.
Default: "return=minimal"

Response

Direct: await client.subscriptions.listBillingPlans(request)

As ApiResult: await client.subscriptions.listBillingPlans(request).asApiResult()

  • OnSuccess: ApiResult<PlanCollection, Subscriptions.ListBillingPlansError>, with result.value of type PlanCollection
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

listSubscriptionTransactions(request: Subscriptions.ListSubscriptionTransactionsRequest, options?: RequestOptions): ApiPromise<TransactionsList, Subscriptions.ListSubscriptionTransactionsError>

Description

Lists transactions for a subscription.

Direct Usage

try {
  const response = await client.subscriptions.listSubscriptionTransactions({
    id: "some example string",
    startTime: "some example string",
    endTime: "some example string",
  });
  // TODO: Handle 'response' of type TransactionsList
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.ListSubscriptionTransactionsError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.listSubscriptionTransactions({
  id: "some example string",
  startTime: "some example string",
  endTime: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type TransactionsList
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
startTime string The start time of the range of transactions to list.
endTime string The end time of the range of transactions to list.

Response

Direct: await client.subscriptions.listSubscriptionTransactions(request)

As ApiResult: await client.subscriptions.listSubscriptionTransactions(request).asApiResult()

  • OnSuccess: ApiResult<TransactionsList, Subscriptions.ListSubscriptionTransactionsError>, with result.value of type TransactionsList
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

listSubscriptions(request: Subscriptions.ListSubscriptionsRequest, options?: RequestOptions): ApiPromise<SubscriptionCollection, Subscriptions.ListSubscriptionsError>

Description

List all subscriptions for merchant account.

Direct Usage

try {
  const response = await client.subscriptions.listSubscriptions();
  // TODO: Handle 'response' of type SubscriptionCollection
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.ListSubscriptionsError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.listSubscriptions().asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type SubscriptionCollection
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
planIds? string Filters the response by list of plan IDs. Filter supports upto 70 plan IDs. URLs should not exceed a length of 2000 characters.
statuses? string Filters the response by list of subscription statuses.
createdAfter? string Filters the response by subscription creation start time for a range of subscriptions.
createdBefore? string Filters the response by subscription creation end time for a range of subscriptions.
statusUpdatedBefore? string Filters the response by status update start time for a range of subscriptions.
statusUpdatedAfter? string Filters the response by status update end time for a range of subscriptions.
filter? string Filter the response using complex expressions that could use comparison operators like ge, gt, le, lt and logical operators such as 'and' and 'or'.
pageSize? number The number of items to return in the response.
Default: 10
page? number A non-zero integer which is the start index of the entire list of items to return in the response. The combination of page=1 and page_size=20 returns the first 20 items. The combination of page=2 and page_size=20 returns the next 20 items.
Default: 1
customerIds? string[] Filters the response by comma separated vault customer IDs (FSS subscriptions only).

Response

Direct: await client.subscriptions.listSubscriptions(request)

As ApiResult: await client.subscriptions.listSubscriptions(request).asApiResult()

  • OnSuccess: ApiResult<SubscriptionCollection, Subscriptions.ListSubscriptionsError>, with result.value of type SubscriptionCollection
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

patchBillingPlan(request: Subscriptions.PatchBillingPlanRequest, options?: RequestOptions): ApiPromise<undefined, Subscriptions.PatchBillingPlanError>

Description

Updates a plan with the CREATED or ACTIVE status. For an INACTIVE plan, you can make only status updates. You can patch these attributes and objects: Attribute or object Operations description replace payment_preferences.auto_bill_outstanding replace taxes.percentage replace payment_preferences.payment_failure_threshold replace payment_preferences.setup_fee replace payment_preferences.setup_fee_failure_action replace name replace

Direct Usage

try {
  await client.subscriptions.patchBillingPlan({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.PatchBillingPlanError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.patchBillingPlan({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the plan.
body? Patch[] -

Response

Direct: await client.subscriptions.patchBillingPlan(request)

As ApiResult: await client.subscriptions.patchBillingPlan(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.PatchBillingPlanError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

patchSubscription(request: Subscriptions.PatchSubscriptionRequest, options?: RequestOptions): ApiPromise<undefined, Subscriptions.PatchSubscriptionError>

Description

Updates a subscription which could be in ACTIVE or SUSPENDED status. You can override plan level default attributes by providing customised values for plan path in the patch request. You cannot update attributes that have already completed (Example - trial cycles can’t be updated if completed). Once overridden, changes to plan resource will not impact subscription. Any price update will not impact billing cycles within next 10 days (Applicable only for subscriptions funded by PayPal account). Following are the fields eligible for patch. Attribute or object Operations billing_info.outstanding_balance replace custom_id add,replace plan.billing_cycles[@sequence==n]. pricing_scheme.fixed_price add,replace plan.billing_cycles[@sequence==n]. pricing_scheme.tiers replace plan.billing_cycles[@sequence==n]. total_cycles replace plan.payment_preferences. auto_bill_outstanding replace plan.payment_preferences. payment_failure_threshold replace plan.taxes.inclusive add,replace plan.taxes.percentage add,replace shipping_amount add,replace start_time replace subscriber.shipping_address add,replace subscriber.payment_source (for subscriptions funded by card payments) replace

Direct Usage

try {
  await client.subscriptions.patchSubscription({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.PatchSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.patchSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID for the subscription.
body? Patch[] -

Response

Direct: await client.subscriptions.patchSubscription(request)

As ApiResult: await client.subscriptions.patchSubscription(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.PatchSubscriptionError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

reviseSubscription(request: Subscriptions.ReviseSubscriptionRequest, options?: RequestOptions): ApiPromise<ModifySubscriptionResponse, Subscriptions.ReviseSubscriptionError>

Description

Updates the quantity of the product or service in a subscription. You can also use this method to switch the plan and update the shipping_amount, shipping_address values for the subscription. This type of update requires the buyer's consent.

Direct Usage

try {
  const response = await client.subscriptions.reviseSubscription({ id: "some example string" });
  // TODO: Handle 'response' of type ModifySubscriptionResponse
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.ReviseSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.reviseSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: Use 'result.value' of type ModifySubscriptionResponse
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
body? ModifySubscriptionRequest -

Response

Direct: await client.subscriptions.reviseSubscription(request)

As ApiResult: await client.subscriptions.reviseSubscription(request).asApiResult()

  • OnSuccess: ApiResult<ModifySubscriptionResponse, Subscriptions.ReviseSubscriptionError>, with result.value of type ModifySubscriptionResponse
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

suspendSubscription(request: Subscriptions.SuspendSubscriptionRequest, options?: RequestOptions): ApiPromise<undefined, Subscriptions.SuspendSubscriptionError>

Description

Suspends the subscription.

Direct Usage

try {
  await client.subscriptions.suspendSubscription({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.SuspendSubscriptionError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.suspendSubscription({ id: "some example string" }).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID of the subscription.
body? SuspendSubscription -

Response

Direct: await client.subscriptions.suspendSubscription(request)

As ApiResult: await client.subscriptions.suspendSubscription(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.SuspendSubscriptionError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw

updateBillingPlanPricingSchemes(request: Subscriptions.UpdateBillingPlanPricingSchemesRequest, options?: RequestOptions): ApiPromise<undefined, Subscriptions.UpdateBillingPlanPricingSchemesError>

Description

Updates pricing for a plan. For example, you can update a regular billing cycle from $5 per month to $7 per month.

Direct Usage

try {
  await client.subscriptions.updateBillingPlanPricingSchemes({ id: "some example string" });
} catch (err) {
  // TODO: Handle 'err' of type Subscriptions.UpdateBillingPlanPricingSchemesError, discriminated with 'err.payload.kind'
}

Usage as ApiResult

const result = await client.subscriptions.updateBillingPlanPricingSchemes({
  id: "some example string",
}).asApiResult();
// TODO: Use 'result.status' and 'result.headers' to read the raw response status and headers
if (result.ok) {
  // TODO: The call succeeded and resolves to no body
} else {
  // TODO: Handle 'result', discriminated with 'result.payload.kind'
}

Parameters

Name Type Description
id string The ID for the plan.
body? UpdatePricingSchemesRequest -

Response

Direct: await client.subscriptions.updateBillingPlanPricingSchemes(request)

As ApiResult: await client.subscriptions.updateBillingPlanPricingSchemes(request).asApiResult()

  • OnSuccess: ApiResult<undefined, Subscriptions.UpdateBillingPlanPricingSchemesError>, with result.value of type undefined
  • OnError: result.payload discriminated on kind, with result.message

Thrown: PaypalError on any operational failure — a caller abort and a programmer error stay outside the family and reach you raw