1010
1111from .. import _legacy_response
1212from ..types import (
13+ invoice_pay_params ,
1314 invoice_list_params ,
1415 invoice_issue_params ,
1516 invoice_create_params ,
@@ -743,6 +744,7 @@ def pay(
743744 self ,
744745 invoice_id : str ,
745746 * ,
747+ shared_payment_token_id : str ,
746748 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
747749 # The extra values given here take precedence over values defined on the client or passed to this method.
748750 extra_headers : Headers | None = None ,
@@ -751,11 +753,16 @@ def pay(
751753 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
752754 idempotency_key : str | None = None ,
753755 ) -> Invoice :
754- """
755- This endpoint collects payment for an invoice using the customer's default
756- payment method. This action can only be taken on invoices with status "issued".
756+ """This endpoint collects payment for an invoice.
757+
758+ By default, it uses the
759+ customer's default payment method. Optionally, a shared payment token (SPT) can
760+ be provided to pay using agent-granted credentials instead. This action can only
761+ be taken on invoices with status "issued".
757762
758763 Args:
764+ shared_payment_token_id: The ID of a shared payment token granted by an agent to use for this payment.
765+
759766 extra_headers: Send extra headers
760767
761768 extra_query: Add additional query parameters to the request
@@ -770,6 +777,9 @@ def pay(
770777 raise ValueError (f"Expected a non-empty value for `invoice_id` but received { invoice_id !r} " )
771778 return self ._post (
772779 f"/invoices/{ invoice_id } /pay" ,
780+ body = maybe_transform (
781+ {"shared_payment_token_id" : shared_payment_token_id }, invoice_pay_params .InvoicePayParams
782+ ),
773783 options = make_request_options (
774784 extra_headers = extra_headers ,
775785 extra_query = extra_query ,
@@ -1542,6 +1552,7 @@ async def pay(
15421552 self ,
15431553 invoice_id : str ,
15441554 * ,
1555+ shared_payment_token_id : str ,
15451556 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
15461557 # The extra values given here take precedence over values defined on the client or passed to this method.
15471558 extra_headers : Headers | None = None ,
@@ -1550,11 +1561,16 @@ async def pay(
15501561 timeout : float | httpx .Timeout | None | NotGiven = not_given ,
15511562 idempotency_key : str | None = None ,
15521563 ) -> Invoice :
1553- """
1554- This endpoint collects payment for an invoice using the customer's default
1555- payment method. This action can only be taken on invoices with status "issued".
1564+ """This endpoint collects payment for an invoice.
1565+
1566+ By default, it uses the
1567+ customer's default payment method. Optionally, a shared payment token (SPT) can
1568+ be provided to pay using agent-granted credentials instead. This action can only
1569+ be taken on invoices with status "issued".
15561570
15571571 Args:
1572+ shared_payment_token_id: The ID of a shared payment token granted by an agent to use for this payment.
1573+
15581574 extra_headers: Send extra headers
15591575
15601576 extra_query: Add additional query parameters to the request
@@ -1569,6 +1585,9 @@ async def pay(
15691585 raise ValueError (f"Expected a non-empty value for `invoice_id` but received { invoice_id !r} " )
15701586 return await self ._post (
15711587 f"/invoices/{ invoice_id } /pay" ,
1588+ body = await async_maybe_transform (
1589+ {"shared_payment_token_id" : shared_payment_token_id }, invoice_pay_params .InvoicePayParams
1590+ ),
15721591 options = make_request_options (
15731592 extra_headers = extra_headers ,
15741593 extra_query = extra_query ,
0 commit comments