/** * PayPal Server SDKLib * * This file was automatically generated by APIMATIC v3.0 ( https://www.apimatic.io ). */ import { boolean, lazy, object, optional, Schema, string } from '../schema.js'; import { Money, moneySchema } from './money.js'; import { PlanOverride, planOverrideSchema } from './planOverride.js'; import { SubscriberRequest, subscriberRequestSchema, } from './subscriberRequest.js'; import { SubscriptionApplicationContext, subscriptionApplicationContextSchema, } from './subscriptionApplicationContext.js'; /** The create subscription request details. */ export interface CreateSubscriptionRequest { /** The ID of the plan. */ planId: string; /** The date and time, in [Internet date and time format](https://tools.ietf.org/html/rfc3339#section-5.6). Seconds are required while fractional seconds are optional. Note: The regular expression provides guidance but does not reject all invalid dates. */ startTime?: string; /** The quantity of the product in the subscription. */ quantity?: string; /** The currency and amount for a financial transaction, such as a balance or payment due. */ shippingAmount?: Money; /** The subscriber request information . */ subscriber?: SubscriberRequest; /** DEPRECATED. Indicates whether the subscription auto-renews after the billing cycles complete. */ autoRenewal?: boolean; /** DEPRECATED. The application context, which customizes the payer experience during the subscription approval process with PayPal. */ applicationContext?: SubscriptionApplicationContext; /** The custom id for the subscription. Can be invoice id. */ customId?: string; /** An inline plan object to customise the subscription. You can override plan level default attributes by providing customised values for the subscription in this object. */ plan?: PlanOverride; } export const createSubscriptionRequestSchema: Schema = lazy( () => object({ planId: ['plan_id', string()], startTime: ['start_time', optional(string())], quantity: ['quantity', optional(string())], shippingAmount: ['shipping_amount', optional(moneySchema)], subscriber: ['subscriber', optional(subscriberRequestSchema)], autoRenewal: ['auto_renewal', optional(boolean())], applicationContext: [ 'application_context', optional(subscriptionApplicationContextSchema), ], customId: ['custom_id', optional(string())], plan: ['plan', optional(planOverrideSchema)], }) );