checkoutCompleteWithTokenizedPaymentV3 method
Implementation
Future<String?> checkoutCompleteWithTokenizedPaymentV3(String checkoutId,
{required Checkout checkout,
required String token,
required PaymentTokenType paymentTokenType,
required String idempotencyKey,
required String amount,
required String currencyCode,
bool deleteThisPartOfCache = false}) async {
final MutationOptions _options =
MutationOptions(document: gql(completeCheckoutWithTokenV3), variables: {
'checkoutId': checkoutId,
'payment': {
'paymentAmount': {'amount': amount, 'currencyCode': currencyCode},
'idempotencyKey': idempotencyKey,
'billingAddress': const {},
'paymentData': token,
'type': paymentTokenType.toString()
}
});
final QueryResult result = await _graphQLClient!.mutate(_options);
checkForError(
result,
key: 'checkoutCompleteWithTokenizedPaymentV3',
errorKey: 'checkoutUserErrors',
);
if (deleteThisPartOfCache) {
_graphQLClient!.cache.writeQuery(_options.asRequest, data: {});
}
return result.data?['checkoutCompleteWithTokenizedPaymentV3']['payment']
['id'];
}