voidAuthorizedPayment method
Voids, or cancels, an authorized payment, by ID. You cannot void an authorized payment that has been fully captured.
Parameter authorizationId: The PayPal-generated ID for the authorized payment to void.
Parameter payPalAuthAssertion: An API-caller-provided JSON Web Token (JWT) assertion that identifies the merchant. For details, see PayPal-Auth-Assertion.
Note:For three party transactions in which a partner is managing the API calls on behalf of a merchant, the partner must identify the merchant using either a PayPal-Auth-Assertion header or an access token with target_subject.
Implementation
Future<void> voidAuthorizedPayment(String authorizationId,
{String? payPalAuthAssertion}) async {
var url = _payPalHttpClient.getUrl(
'/v2/payments/authorizations/$authorizationId/void',
);
Map<String, String> headers = {};
if (payPalAuthAssertion != null) {
headers['PayPal-Auth-Assertion'] = payPalAuthAssertion;
}
await _payPalHttpClient.post(url, headers: headers);
}