protected void Submit_Click(object sender, EventArgs e) { // Create request object DoVoidRequestType request = new DoVoidRequestType(); // (Required) Original authorization ID specifying the authorization to void or, to void an order, the order ID. // Important: If you are voiding a transaction that has been reauthorized, use the ID from the original authorization, and not the reauthorization. request.AuthorizationID = authorizationId.Value; // (Optional) Informational note about this void that is displayed to the buyer in email and in their transaction history. if (note.Value != string.Empty) { request.Note = note.Value; } // Invoke the API DoVoidReq wrapper = new DoVoidReq(); wrapper.DoVoidRequest = request; // Configuration map containing signature credentials and other required configuration. // For a full list of configuration parameters refer in wiki page // [https://github.com/paypal/sdk-core-dotnet/wiki/SDK-Configuration-Parameters] Dictionary<string, string> configurationMap = Configuration.GetAcctAndConfig(); // Create the PayPalAPIInterfaceServiceService service object to make the API call PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(configurationMap); // # API call // Invoke the DoVoid method in service wrapper object DoVoidResponseType doVoidResponse = service.DoVoid(wrapper); // Check for API return status setKeyResponseObjects(service, doVoidResponse); }
protected void Submit_Click(object sender, EventArgs e) { // Create request object DoVoidRequestType request = new DoVoidRequestType(); request.AuthorizationID = authorizationId.Value; if (note.Value != "") { request.Note = note.Value; } // Invoke the API DoVoidReq wrapper = new DoVoidReq(); wrapper.DoVoidRequest = request; PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); DoVoidResponseType doVoidResponse = service.DoVoid(wrapper); // Check for API return status setKeyResponseObjects(service, doVoidResponse); }
//#DoVoid API Operation //#Void an order or an authorization. public DoVoidResponseType DoVoidAPIOperation() { // Create the DoVoidResponseType object DoVoidResponseType responseDoVoidResponseType = new DoVoidResponseType(); try { // Create the DoVoidReq object DoVoidReq doVoid = new DoVoidReq(); // DoVoidRequest which takes mandatory params: // // * `Authorization ID` - Original authorization ID specifying the // authorization to void or, to void an order, the order ID. // `Important: // If you are voiding a transaction that has been reauthorized, use the // ID from the original authorization, and not the reauthorization.` DoVoidRequestType doVoidRequest = new DoVoidRequestType("9B2288061E685550E"); doVoid.DoVoidRequest = doVoidRequest; // Create the service wrapper object to make the API call PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService(); // # API call // Invoke the DoVoid method in service wrapper object responseDoVoidResponseType = service.DoVoid(doVoid); if (responseDoVoidResponseType != null) { // Response envelope acknowledgement string acknowledgement = "DoVoid API Operation - "; acknowledgement += responseDoVoidResponseType.Ack.ToString(); logger.Info(acknowledgement + "\n"); Console.WriteLine(acknowledgement + "\n"); // # Success values if (responseDoVoidResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS")) { // Authorization identification number you specified in the request logger.Info("Authorization ID : " + responseDoVoidResponseType.AuthorizationID + "\n"); Console.WriteLine("Authorization ID : " + responseDoVoidResponseType.AuthorizationID + "\n"); } // # Error Values else { List<ErrorType> errorMessages = responseDoVoidResponseType.Errors; foreach (ErrorType error in errorMessages) { logger.Debug("API Error Message : " + error.LongMessage); Console.WriteLine("API Error Message : " + error.LongMessage + "\n"); } } } } // # Exception log catch (System.Exception ex) { // Log the exception message logger.Debug("Error Message : " + ex.Message); Console.WriteLine("Error Message : " + ex.Message); } return responseDoVoidResponseType; }