@@ -1136,7 +1136,13 @@ export namespace CheckoutSessionListResponse {
11361136}
11371137
11381138export interface CheckoutSessionCreateParams {
1139- checkoutSession : {
1139+ checkoutSession :
1140+ | CheckoutSessionCreateParams . ProductCheckoutSession
1141+ | CheckoutSessionCreateParams . AddPaymentMethodCheckoutSession ;
1142+ }
1143+
1144+ export namespace CheckoutSessionCreateParams {
1145+ export interface ProductCheckoutSession {
11401146 /**
11411147 * The URL to redirect to after the purchase is cancelled or fails
11421148 */
@@ -1152,11 +1158,7 @@ export interface CheckoutSessionCreateParams {
11521158 */
11531159 successUrl : string ;
11541160
1155- /**
1156- * The type of checkout session to create. Currently only `product` and
1157- * `add_payment_method` are supported. All other types will throw an error.
1158- */
1159- type : 'product' | 'purchase' | 'invoice' | 'add_payment_method' ;
1161+ type : 'product' ;
11601162
11611163 /**
11621164 * Metadata that will get added to the purchase or subscription created when this
@@ -1172,23 +1174,52 @@ export interface CheckoutSessionCreateParams {
11721174
11731175 /**
11741176 * The quantity of the purchase or subscription created when this checkout session
1175- * succeeds. Ignored if the checkout session is of type `invoice`.
1177+ * succeeds. Ignored if the checkout session is of type `invoice`. If not provided, defaults to 1.
11761178 */
11771179 quantity ?: number ;
11781180
1181+ /**
1182+ * The ID of the price the customer shall purchase.
1183+ */
1184+ priceId : string ;
1185+ }
1186+
1187+ export interface AddPaymentMethodCheckoutSession {
1188+ /**
1189+ * The URL to redirect to after the purchase is cancelled or fails
1190+ */
1191+ cancelUrl : string ;
1192+
1193+ /**
1194+ * The id of the Customer for this purchase session, as defined in your system
1195+ */
1196+ customerExternalId : string ;
1197+
1198+ /**
1199+ * The URL to redirect to after the purchase is successful
1200+ */
1201+ successUrl : string ;
1202+
11791203 /**
11801204 * The id of the subscription that the payment method will be added to as the
11811205 * default payment method.
11821206 */
1183- targetSubscriptionId ?: string ;
1207+ targetSubscriptionId : string ;
1208+
1209+ type : 'add_payment_method' ;
11841210
11851211 /**
1186- * The id of the price to purchase. Required if the checkout session is of type
1187- * `product`. Ignored if the checkout session is of type `purchase`, `invoice`, or
1188- * `add_payment_method`.
1212+ * Metadata that will get added to the purchase or subscription created when this
1213+ * checkout session succeeds. Ignored if the checkout session is of type `invoice`.
11891214 */
1190- priceId ?: string ;
1191- } ;
1215+ outputMetadata ?: Record < string , unknown > ;
1216+
1217+ /**
1218+ * The name of the purchase or subscription created when this checkout session
1219+ * succeeds. Ignored if the checkout session is of type `invoice`.
1220+ */
1221+ outputName ?: string ;
1222+ }
11921223}
11931224
11941225export interface CheckoutSessionListParams {
0 commit comments