UNPKG

@hyperse/paypal-node-sdk

Version:

NodeJS SDK for PayPal Checkout APIs

34 lines (33 loc) 1.18 kB
import { HttpRequestBase } from '../core/HttpRequestBase.js'; import {} from '../types/type-order.js'; /** * Creates an order. * @see {@link https://developer.paypal.com/api/orders/v2/#orders_create} */ export class OrdersCreateRequest extends HttpRequestBase { constructor() { super(); this.path = '/v2/checkout/orders?'; this.verb = 'POST'; this.headers = { 'Content-Type': 'application/json', }; } payPalPartnerAttributionId(payPalPartnerAttributionId) { this.headers['PayPal-Partner-Attribution-Id'] = payPalPartnerAttributionId; return 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) { this.headers['Prefer'] = prefer; return this; } requestBody(order) { this.body = order; return this; } }