@hyperse/paypal-node-sdk
Version:
NodeJS SDK for PayPal Checkout APIs
38 lines (37 loc) • 1.78 kB
TypeScript
import { HttpRequestBase } from '../core/HttpRequestBase.js';
import { type BaseOrderHeaders, type CheckoutPaymentIntent, type OrderApplicationContext, type PaymentSourceRequest, type PurchaseUnitRequest } from '../types/type-order.js';
export type OrdersCreateRequestBody = {
intent: CheckoutPaymentIntent;
/**
* The payment source definition.
*/
payment_source?: PaymentSourceRequest;
/**
* An array of purchase units. Each purchase unit establishes a contract between a payer and the payee.
* Each purchase unit represents either a full or partial order that the payer intends to purchase from the payee.
*/
purchase_units: PurchaseUnitRequest[];
/**
* Customizes the payer experience during the approval process for the payment with PayPal.
*/
application_context?: OrderApplicationContext;
};
export interface OrdersCreateRequestHeaders extends BaseOrderHeaders {
'PayPal-Partner-Attribution-Id'?: string;
Prefer?: string;
}
/**
* Creates an order.
* @see {@link https://developer.paypal.com/api/orders/v2/#orders_create}
*/
export declare class OrdersCreateRequest extends HttpRequestBase<OrdersCreateRequestHeaders, OrdersCreateRequestBody> {
constructor();
payPalPartnerAttributionId(payPalPartnerAttributionId: string): this;
/**
* 1. 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.
* 2. return=representation. The server returns a complete resource representation, including the current state of the resource.
* @default `return=minimal`
*/
prefer(prefer: string): this;
requestBody(order: OrdersCreateRequestBody): this;
}