Skip to content

Commit

Permalink
Add onBehalfOf type to PaymentRequest (#592)
Browse files Browse the repository at this point in the history
* Add onBehalfOf type to PaymentRequest

* Invalid tests
  • Loading branch information
awalker-stripe authored Apr 5, 2024
1 parent a91238b commit 1259510
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/types/src/invalid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
});
7 changes: 7 additions & 0 deletions tests/types/src/valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 5 additions & 0 deletions types/stripe-js/payment-request.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 1259510

Please sign in to comment.