From bfb99db3809eccbc239bc3abf41f5fd1a61378f0 Mon Sep 17 00:00:00 2001 From: Adam Walker Date: Thu, 4 Apr 2024 13:08:20 -0700 Subject: [PATCH 1/2] Add onBehalfOf type to PaymentRequest --- tests/types/src/valid.ts | 7 +++++++ types/stripe-js/payment-request.d.ts | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/tests/types/src/valid.ts b/tests/types/src/valid.ts index 6c5042c8..d474423f 100644 --- a/tests/types/src/valid.ts +++ b/tests/types/src/valid.ts @@ -3184,6 +3184,13 @@ const paymentRequest: PaymentRequest = stripe.paymentRequest({ }, }); +const paymentRequestOBO: PaymentRequest = stripe.paymentRequest({ + country: 'US', + currency: 'usd', + total: {label: 'Demo total', amount: 1000}, + onBehalfOf: 'acct_123', +}); + paymentRequest.canMakePayment().then((result) => { if (result) { const {applePay}: CanMakePaymentResult = result; diff --git a/types/stripe-js/payment-request.d.ts b/types/stripe-js/payment-request.d.ts index 502dd850..f8b01c01 100644 --- a/types/stripe-js/payment-request.d.ts +++ b/types/stripe-js/payment-request.d.ts @@ -237,6 +237,11 @@ export interface PaymentRequestOptions { */ applePay?: ApplePayOption; + /** + * The Stripe account ID which is the business of record. + */ + onBehalfOf?: string; + /** * @deprecated * Use disableWallets instead. From 8a9f1e7a2d0368a9e7977c5bd72f2bfc33422412 Mon Sep 17 00:00:00 2001 From: Adam Walker Date: Thu, 4 Apr 2024 13:24:56 -0700 Subject: [PATCH 2/2] Invalid tests --- tests/types/src/invalid.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/types/src/invalid.ts b/tests/types/src/invalid.ts index b2107e6c..f8ea9275 100644 --- a/tests/types/src/invalid.ts +++ b/tests/types/src/invalid.ts @@ -416,3 +416,18 @@ stripe // @ts-expect-error mandate_data is not a valid parameter result.confirmationToken.mandate_data; }); + +const paymentRequest = stripe.paymentRequest({ + country: 'US', + currency: 'usd', + total: { + label: 'Demo total', + amount: 1000, + }, + // @ts-expect-error Type 'number' is not assignable to type 'string'. + onBehalfOf: 123, +}); +paymentRequest.update({ + // @ts-expect-error Object literal may only specify known properties, and 'onBehalfOf' does not exist in type 'PaymentRequestUpdateOptions'. + onBehalfOf: 'acct_123', +});