Retrieves a payment instrument on your account, including the details that are specific to its payment method, such as a card's last four digits. Identify the instrument by its Amazon Resource Name (ARN) or by its ID. ListPaymentInstruments returns both.
To use this operation, you must have Amazon Web Services Identity and Access Management (IAM) permission for payments:GetPaymentInstrument. You can scope this permission to the instrument's ARN.
Parameters:
-
identifier
(PaymentInstrumentIdentifier)
–
The instrument to retrieve. Specify one of the following:
-
The Amazon Resource Name (ARN) of the instrument, as ListPaymentInstruments returns in arn. The ARN must be for an instrument on your account.
-
The ID of the instrument, as ListPaymentInstruments returns in id.
Raises:
-
AccessDeniedException
–
The request is denied because you don't have sufficient access to perform this operation. Verify that you have the required permissions and try again. This error is also returned, instead of ResourceNotFoundException, when you aren't authorized for the resource, so the response doesn't reveal whether the resource exists.
-
InternalServerException
–
The request processing failed because of an unknown error, exception, or failure. Retry your request.
-
ResourceNotFoundException
–
The requested resource couldn't be found. Verify that the resource ID is correct. This error is returned only when you're authorized for the resource.
-
ThrottlingException
–
The request was denied due to request throttling. Reduce the frequency of your requests and try again.
-
ValidationException
–
The request isn't valid. Check reason and fieldList for the cause, correct the request, and try again.
-
UnknownServiceError
–
The service returned an error code this client does not model.
Examples:
Invoke GetPaymentInstrument
>>> await client.get_payment_instrument(identifier='arn:aws:payments::123456789012:payment-instrument:1a2b3c4d-5e6f-7a8b-9c0d-111122223333')
Source code in docs_src/capo_payments/_services/async_payments.py
| async def get_payment_instrument(
self,
identifier: "capo_payments.types.payment_instrument_identifier.PaymentInstrumentIdentifier",
*,
config_overrides: Optional[AsyncPaymentsClientConfig] = None,
) -> "capo_payments.types.get_payment_instrument_response.GetPaymentInstrumentResponse":
"""<p>Retrieves a payment instrument on your account, including the details that are specific to its payment method, such as a card's last four digits. Identify the instrument by its Amazon Resource Name (ARN) or by its ID. <code>ListPaymentInstruments</code> returns both.</p> <p>To use this operation, you must have Amazon Web Services Identity and Access Management (IAM) permission for <code>payments:GetPaymentInstrument</code>. You can scope this permission to the instrument's ARN.</p>
Args:
identifier: <p>The instrument to retrieve. Specify one of the following:</p> <ul> <li> <p>The Amazon Resource Name (ARN) of the instrument, as <code>ListPaymentInstruments</code> returns in <code>arn</code>. The ARN must be for an instrument on your account.</p> </li> <li> <p>The ID of the instrument, as <code>ListPaymentInstruments</code> returns in <code>id</code>.</p> </li> </ul>
Raises:
capo_payments.errors.access_denied_exception.AccessDeniedException: <p>The request is denied because you don't have sufficient access to perform this operation. Verify that you have the required permissions and try again. This error is also returned, instead of <code>ResourceNotFoundException</code>, when you aren't authorized for the resource, so the response doesn't reveal whether the resource exists.</p>
capo_payments.errors.internal_server_exception.InternalServerException: <p>The request processing failed because of an unknown error, exception, or failure. Retry your request.</p>
capo_payments.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource couldn't be found. Verify that the resource ID is correct. This error is returned only when you're authorized for the resource.</p>
capo_payments.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of your requests and try again.</p>
capo_payments.errors.validation_exception.ValidationException: <p>The request isn't valid. Check <code>reason</code> and <code>fieldList</code> for the cause, correct the request, and try again.</p>
capo_payments.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
Invoke GetPaymentInstrument
>>> await client.get_payment_instrument(identifier='arn:aws:payments::123456789012:payment-instrument:1a2b3c4d-5e6f-7a8b-9c0d-111122223333')
"""
async def _handler(
req: "AsyncOperationRequest[capo_payments.types.get_payment_instrument_request.GetPaymentInstrumentRequest]",
) -> AsyncOperationResponse[
"capo_payments.types.get_payment_instrument_response.GetPaymentInstrumentResponse"
]:
import capo_payments._operations.aws_payments.get_payment_instrument
(
output,
http_response,
) = await capo_payments._operations.aws_payments.get_payment_instrument.async_get_payment_instrument(
req.options, req.input
)
return AsyncOperationResponse(output=output, response=http_response)
def _redact_output(
output: "capo_payments.types.get_payment_instrument_response.GetPaymentInstrumentResponse",
) -> dict[str, Any]:
import capo_payments.types.get_payment_instrument_response
return capo_payments.types.get_payment_instrument_response.redact_sensitive(
output
)
interceptors_, options_ = self.operation_options(
config_overrides,
OperationLogging("GetPaymentInstrument", redact_output=_redact_output),
)
input_: capo_payments.types.get_payment_instrument_request.GetPaymentInstrumentRequest = {
"identifier": identifier
}
response = await aexecute_pipeline(
AsyncOperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
await response.response.aclose()
return response.output
|