sendAgreementPaymentRequest method
Allows sellers (proposers) to submit a payment request to buyers
(acceptors) for a specific charge amount for an agreement that includes a
VariablePaymentTerm. The payment request is created in
PENDING_APPROVAL status, at which point the buyer can accept
or reject it.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ResourceNotFoundException.
May throw ThrottlingException.
May throw ValidationException.
Parameter agreementId :
The unique identifier of the agreement for which the payment request is
being submitted. Use GetAgreementTerms to retrieve agreement
term details.
Parameter chargeAmount :
The amount requested to be charged to the buyer, positive decimal value in
the currency of the accepted term.
Parameter name :
A descriptive name for the payment request (5-64 characters).
Parameter termId :
The unique identifier of the VariablePaymentTerm for the
agreement that the payment request is being sent for.
Parameter clientToken :
A unique, case-sensitive identifier that you provide to ensure the
idempotency of the request.
Parameter description :
An optional detailed description of the payment request (1-2000
characters).
Implementation
Future<SendAgreementPaymentRequestOutput> sendAgreementPaymentRequest({
required String agreementId,
required String chargeAmount,
required String name,
required String termId,
String? clientToken,
String? description,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target':
'AWSMPCommerceService_v20200301.SendAgreementPaymentRequest'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'agreementId': agreementId,
'chargeAmount': chargeAmount,
'name': name,
'termId': termId,
'clientToken': clientToken ?? _s.generateIdempotencyToken(),
if (description != null) 'description': description,
},
);
return SendAgreementPaymentRequestOutput.fromJson(jsonResponse.body);
}