getPaymentSession method

Future<GetPaymentSessionResponse> getPaymentSession({
  1. required String paymentManagerArn,
  2. required String paymentSessionId,
  3. String? agentName,
  4. String? userId,
})

Get a payment session.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter paymentManagerArn : The ARN of the payment manager that owns this session.

Parameter paymentSessionId : The ID of the payment session to retrieve.

Parameter agentName : The agent name associated with this request, used for observability.

Parameter userId : The user ID associated with this payment session.

Implementation

Future<GetPaymentSessionResponse> getPaymentSession({
  required String paymentManagerArn,
  required String paymentSessionId,
  String? agentName,
  String? userId,
}) async {
  final headers = <String, String>{
    if (agentName != null)
      'X-Amzn-Bedrock-AgentCore-Payments-Agent-Name': agentName.toString(),
    if (userId != null)
      'X-Amzn-Bedrock-AgentCore-Payments-User-Id': userId.toString(),
  };
  final $payload = <String, dynamic>{
    'paymentManagerArn': paymentManagerArn,
    'paymentSessionId': paymentSessionId,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/payments/getPaymentSession',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return GetPaymentSessionResponse.fromJson(response);
}