deletePaymentSession method

Future<DeletePaymentSessionResponse> deletePaymentSession({
  1. required String paymentManagerArn,
  2. required String paymentSessionId,
  3. String? userId,
})

Deletes a payment session. This permanently removes the payment session record.

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

Parameter paymentManagerArn : The payment manager ARN. Must match the session's paymentManagerArn.

Parameter paymentSessionId : The payment session ID to delete.

Parameter userId : The user ID making the delete request. Must match the session's userId.

Implementation

Future<DeletePaymentSessionResponse> deletePaymentSession({
  required String paymentManagerArn,
  required String paymentSessionId,
  String? userId,
}) async {
  final headers = <String, String>{
    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/deletePaymentSession',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return DeletePaymentSessionResponse.fromJson(response);
}