Пример #1
0
        /// <summary>
        /// Captures payment
        /// </summary>
        /// <param name="order">Order</param>
        /// <param name="processPaymentResult">Process payment result</param>
        public void Capture(Order order, ref ProcessPaymentResult processPaymentResult)
        {
            InitSettings();

            string       authorizationID = processPaymentResult.AuthorizationTransactionId;
            DoCaptureReq req             = new DoCaptureReq();

            req.DoCaptureRequest                   = new DoCaptureRequestType();
            req.DoCaptureRequest.Version           = this.APIVersion;
            req.DoCaptureRequest.AuthorizationID   = authorizationID;
            req.DoCaptureRequest.Amount            = new BasicAmountType();
            req.DoCaptureRequest.Amount.Value      = order.OrderTotal.ToString("N", new CultureInfo("en-us"));
            req.DoCaptureRequest.Amount.currencyID = PaypalHelper.GetPaypalCurrency(IoC.Resolve <ICurrencyService>().PrimaryStoreCurrency);
            req.DoCaptureRequest.CompleteType      = CompleteCodeType.Complete;
            DoCaptureResponseType response = service2.DoCapture(req);

            string error   = string.Empty;
            bool   Success = PaypalHelper.CheckSuccess(response, out error);

            if (Success)
            {
                processPaymentResult.PaymentStatus            = PaymentStatusEnum.Paid;
                processPaymentResult.CaptureTransactionId     = response.DoCaptureResponseDetails.PaymentInfo.TransactionID;
                processPaymentResult.CaptureTransactionResult = response.Ack.ToString();
            }
            else
            {
                processPaymentResult.Error = error;
            }
        }
Пример #2
0
        /// <summary>
        /// Captures payment
        /// </summary>
        /// <param name="capturePaymentRequest">Capture payment request</param>
        /// <returns>Capture payment result</returns>
        public CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest)
        {
            var result = new CapturePaymentResult();

            string authorizationId = capturePaymentRequest.Order.AuthorizationTransactionId;
            var    req             = new DoCaptureReq();

            req.DoCaptureRequest                   = new DoCaptureRequestType();
            req.DoCaptureRequest.Version           = GetApiVersion();
            req.DoCaptureRequest.AuthorizationID   = authorizationId;
            req.DoCaptureRequest.Amount            = new BasicAmountType();
            req.DoCaptureRequest.Amount.value      = Math.Round(capturePaymentRequest.Order.OrderTotal, 2).ToString("N", new CultureInfo("en-us"));
            req.DoCaptureRequest.Amount.currencyID = PaypalHelper.GetPaypalCurrency(_currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId));
            req.DoCaptureRequest.CompleteType      = CompleteCodeType.COMPLETE;

            var service = GetService();
            DoCaptureResponseType response = service.DoCapture(req);

            string error;
            bool   success = PaypalHelper.CheckSuccess(response, out error);

            if (success)
            {
                result.NewPaymentStatus         = PaymentStatus.Paid;
                result.CaptureTransactionId     = response.DoCaptureResponseDetails.PaymentInfo.TransactionID;
                result.CaptureTransactionResult = response.Ack.ToString();
            }
            else
            {
                result.AddError(error);
            }
            return(result);
        }
Пример #3
0
    public string DoCaptureCode(string authorization_id, string amount)
    {
        CallerServices caller = new CallerServices();

        IAPIProfile profile = ProfileFactory.createSSLAPIProfile();

        profile.APIUsername     = "******";
        profile.APIPassword     = "******";
        profile.CertificateFile = @"~\MyTestCertificate.txt";
        profile.Environment     = "sandbox";
        caller.APIProfile       = profile;

        DoCaptureRequestType pp_request = new DoCaptureRequestType();

        pp_request.Version = "51.0";

        pp_request.AuthorizationID   = authorization_id;
        pp_request.Amount            = new BasicAmountType();
        pp_request.Amount.Value      = amount;
        pp_request.Amount.currencyID = CurrencyCodeType.GBP;
        pp_request.CompleteType      = CompleteCodeType.Complete;

        DoCaptureResponseType pp_response = new DoCaptureResponseType();

        pp_response = (DoCaptureResponseType)caller.Call("DoCapture", pp_request);
        return(pp_response.Ack.ToString());
    }
Пример #4
0
        // A helper method used by APIResponse.aspx that returns select response parameters
        // of interest. You must process API response objects as applicable to your application
        private void setKeyResponseObjects(PayPalAPIInterfaceServiceService service, DoCaptureResponseType doCaptureResponse)
        {
            Dictionary <string, string> responseParams = new Dictionary <string, string>();
            HttpContext CurrContext = HttpContext.Current;

            CurrContext.Items.Add("Response_keyResponseObject", responseParams);

            CurrContext.Items.Add("Response_apiName", "DoCapture");
            CurrContext.Items.Add("Response_redirectURL", null);
            CurrContext.Items.Add("Response_requestPayload", service.getLastRequest());
            CurrContext.Items.Add("Response_responsePayload", service.getLastResponse());

            if (doCaptureResponse.Ack.Equals(AckCodeType.FAILURE) ||
                (doCaptureResponse.Errors != null && doCaptureResponse.Errors.Count > 0))
            {
                CurrContext.Items.Add("Response_error", doCaptureResponse.Errors);
            }
            else
            {
                CurrContext.Items.Add("Response_error", null);
                responseParams.Add("Transaction Id", doCaptureResponse.DoCaptureResponseDetails.PaymentInfo.TransactionID);
                responseParams.Add("Payment status", doCaptureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus.ToString());
                responseParams.Add("Pending reason", doCaptureResponse.DoCaptureResponseDetails.PaymentInfo.PendingReason.ToString());
            }
            Server.Transfer("../APIResponse.aspx");
        }
Пример #5
0
        public override CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest)
        {
            var result   = new DoCaptureResponseType();
            var settings = CommonServices.Settings.LoadSetting <PayPalExpressPaymentSettings>(capturePaymentRequest.Order.StoreId);

            // build the request
            var req = new DoCaptureReq
            {
                DoCaptureRequest = new DoCaptureRequestType()
            };

            //execute request
            using (var service = new PayPalAPIAASoapBinding())
            {
                service.Url = PayPalHelper.GetPaypalServiceUrl(settings);
                service.RequesterCredentials = PayPalHelper.GetPaypalApiCredentials(settings);
                result = service.DoCapture(req);
            }

            var capturePaymentResult = new CapturePaymentResult();

            if (result.Ack == AckCodeType.Success)
            {
                capturePaymentResult.CaptureTransactionId     = result.DoCaptureResponseDetails.PaymentInfo.TransactionID;
                capturePaymentResult.CaptureTransactionResult = "Success";
            }
            else
            {
                capturePaymentResult.CaptureTransactionResult = "Error";
                capturePaymentResult.Errors.Add(result.Errors.FirstOrDefault().LongMessage);
            }

            return(capturePaymentResult);
        }
Пример #6
0
    public void DoCapture()
    {
        DoCaptureSample       sample = new DoCaptureSample();
        DoCaptureResponseType responseDoCaptureResponseType = sample.DoCaptureAPIOperation();

        Assert.IsNotNull(responseDoCaptureResponseType);
        // Please change the sample inputs according to the documentation in the sample for the following assertion:
        // Assert.AreEqual(responseDoCaptureResponseType.Ack.ToString().ToUpper(), "SUCCESS");
    }
Пример #7
0
        /// <summary>
        /// Captures payment
        /// </summary>
        /// <param name="capturePaymentRequest">Capture payment request</param>
        /// <returns>Capture payment result</returns>
        public CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest)
        {
            var result = new CapturePaymentResult();

            string authorizationId = capturePaymentRequest.Order.AuthorizationTransactionId;
            var    req             = new DoCaptureReq();

            req.DoCaptureRequest                   = new DoCaptureRequestType();
            req.DoCaptureRequest.Version           = GetApiVersion();
            req.DoCaptureRequest.AuthorizationID   = authorizationId;
            req.DoCaptureRequest.Amount            = new BasicAmountType();
            req.DoCaptureRequest.Amount.Value      = Math.Round(capturePaymentRequest.Order.OrderTotal, 2).ToString("N", new CultureInfo("en-us"));
            req.DoCaptureRequest.Amount.currencyID = PaypalHelper.GetPaypalCurrency(_currencyService.GetCurrencyById(_currencySettings.PrimaryStoreCurrencyId));
            req.DoCaptureRequest.CompleteType      = CompleteCodeType.Complete;

            using (var service2 = new PayPalAPIAASoapBinding())
            {
                if (!_paypalDirectPaymentSettings.UseSandbox)
                {
                    service2.Url = "https://api-3t.paypal.com/2.0/";
                }
                else
                {
                    service2.Url = "https://api-3t.sandbox.paypal.com/2.0/";
                }

                service2.RequesterCredentials                       = new CustomSecurityHeaderType();
                service2.RequesterCredentials.Credentials           = new UserIdPasswordType();
                service2.RequesterCredentials.Credentials.Username  = _paypalDirectPaymentSettings.ApiAccountName;
                service2.RequesterCredentials.Credentials.Password  = _paypalDirectPaymentSettings.ApiAccountPassword;
                service2.RequesterCredentials.Credentials.Signature = _paypalDirectPaymentSettings.Signature;
                service2.RequesterCredentials.Credentials.Subject   = "";

                DoCaptureResponseType response = service2.DoCapture(req);

                string error   = "";
                bool   success = PaypalHelper.CheckSuccess(response, out error);
                if (success)
                {
                    result.NewPaymentStatus         = PaymentStatus.Paid;
                    result.CaptureTransactionId     = response.DoCaptureResponseDetails.PaymentInfo.TransactionID;
                    result.CaptureTransactionResult = response.Ack.ToString();
                }
                else
                {
                    result.AddError(error);
                }
            }
            return(result);
        }
Пример #8
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object

            DoCaptureRequestType request =
                new DoCaptureRequestType();

            request.AuthorizationID = authorizationId.Value;
            CurrencyCodeType currency = (CurrencyCodeType)
                                        Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue);

            request.Amount = new BasicAmountType(currency, amount.Value);
            if (completeType.SelectedIndex != 0)
            {
                request.CompleteType = (CompleteCodeType)
                                       Enum.Parse(typeof(CompleteCodeType), completeType.SelectedValue);
            }
            if (note.Value != "")
            {
                request.Note = note.Value;
            }
            if (invoiceId.Value != "")
            {
                request.InvoiceID = invoiceId.Value;
            }
            if (softDescriptor.Value != "")
            {
                request.Descriptor = softDescriptor.Value;
            }

            // Invoke the API
            DoCaptureReq wrapper = new DoCaptureReq();

            wrapper.DoCaptureRequest = request;
            PayPalAPIInterfaceServiceService service           = new PayPalAPIInterfaceServiceService();
            DoCaptureResponseType            doCaptureResponse =
                service.DoCapture(wrapper);


            // Check for API return status
            setKeyResponseObjects(service, doCaptureResponse);
        }
        /// <summary>
        /// Captures payment
        /// </summary>
        /// <param name="capturePaymentRequest">Capture payment request</param>
        /// <returns>Capture payment result</returns>
        public override CapturePaymentResult Capture(CapturePaymentRequest capturePaymentRequest)
        {
            var result = new CapturePaymentResult()
            {
                NewPaymentStatus = capturePaymentRequest.Order.PaymentStatus
            };

            var    settings        = CommonServices.Settings.LoadSetting <TSetting>(capturePaymentRequest.Order.StoreId);
            string authorizationId = capturePaymentRequest.Order.AuthorizationTransactionId;

            var req = new DoCaptureReq();

            req.DoCaptureRequest                   = new DoCaptureRequestType();
            req.DoCaptureRequest.Version           = PayPalHelper.GetApiVersion();
            req.DoCaptureRequest.AuthorizationID   = authorizationId;
            req.DoCaptureRequest.Amount            = new BasicAmountType();
            req.DoCaptureRequest.Amount.Value      = Math.Round(capturePaymentRequest.Order.OrderTotal, 2).ToString("N", new CultureInfo("en-us"));
            req.DoCaptureRequest.Amount.currencyID = (CurrencyCodeType)Enum.Parse(typeof(CurrencyCodeType), Helper.CurrencyCode, true);
            req.DoCaptureRequest.CompleteType      = CompleteCodeType.Complete;

            using (var service = new PayPalAPIAASoapBinding())
            {
                service.Url = PayPalHelper.GetPaypalServiceUrl(settings);
                service.RequesterCredentials = PayPalHelper.GetPaypalApiCredentials(settings);
                DoCaptureResponseType response = service.DoCapture(req);

                string error   = "";
                bool   success = PayPalHelper.CheckSuccess(_helper, response, out error);
                if (success)
                {
                    result.NewPaymentStatus         = PaymentStatus.Paid;
                    result.CaptureTransactionId     = response.DoCaptureResponseDetails.PaymentInfo.TransactionID;
                    result.CaptureTransactionResult = response.Ack.ToString();
                }
                else
                {
                    result.AddError(error);
                }
            }
            return(result);
        }
    // # DoCapture API Operation
    // Captures an authorized payment.
    public DoCaptureResponseType DoCaptureAPIOperation()
    {
        // Create the DoCaptureResponseType object
        DoCaptureResponseType responseDoCaptureResponseType = new DoCaptureResponseType();

        try
        {
            // Create the DoCapture object
            DoCaptureReq doCapture = new DoCaptureReq();

            // `Amount` to capture which takes mandatory params:
            //
            // * `currencyCode`
            // * `amount`
            BasicAmountType amount = new BasicAmountType(CurrencyCodeType.USD, "4.00");

            // `DoCaptureRequest` which takes mandatory params:
            //
            // * `Authorization ID` - Authorization identification number of the
            // payment you want to capture. This is the transaction ID returned from
            // DoExpressCheckoutPayment, DoDirectPayment, or CheckOut. For
            // point-of-sale transactions, this is the transaction ID returned by
            // the CheckOut call when the payment action is Authorization.
            // * `amount` - Amount to capture
            // * `CompleteCode` - Indicates whether or not this is your last capture.
            // It is one of the following values:
            // * Complete – This is the last capture you intend to make.
            // * NotComplete – You intend to make additional captures.
            // `Note:
            // If Complete, any remaining amount of the original authorized
            // transaction is automatically voided and all remaining open
            // authorizations are voided.`
            DoCaptureRequestType doCaptureRequest = new DoCaptureRequestType("O-4VR15106P7416533H", amount, CompleteCodeType.NOTCOMPLETE);
            doCapture.DoCaptureRequest = doCaptureRequest;

            // Create the service wrapper object to make the API call
            PayPalAPIInterfaceServiceService service = new PayPalAPIInterfaceServiceService();

            // # API call
            // Invoke the DoCapture method in service wrapper object
            responseDoCaptureResponseType = service.DoCapture(doCapture);

            if (responseDoCaptureResponseType != null)
            {
                // Response envelope acknowledgement
                string acknowledgement = "DoCapture API Operation - ";
                acknowledgement += responseDoCaptureResponseType.Ack.ToString();
                logger.Info(acknowledgement + "\n");
                Console.WriteLine(acknowledgement + "\n");

                // # Success values
                if (responseDoCaptureResponseType.Ack.ToString().Trim().ToUpper().Equals("SUCCESS"))
                {
                    // Authorization identification number
                    logger.Info("Authorization ID : " + responseDoCaptureResponseType.DoCaptureResponseDetails.AuthorizationID + "\n");
                    Console.WriteLine("Authorization ID : " + responseDoCaptureResponseType.DoCaptureResponseDetails.AuthorizationID + "\n");
                }
                // # Error Values
                else
                {
                    List <ErrorType> errorMessages = responseDoCaptureResponseType.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(responseDoCaptureResponseType);
    }
Пример #11
0
        public bool Capture(MerchantTribe.Payment.Transaction t, MerchantTribeApplication app)
        {
            PayPalAPI ppAPI = Utilities.PaypalExpressUtilities.GetPaypalAPI(app.CurrentStore);

            try
            {
                string OrderNumber = t.MerchantInvoiceNumber + System.Guid.NewGuid().ToString();

                DoCaptureResponseType captureResponse = ppAPI.DoCapture(t.PreviousTransactionNumber,
                                                                        "Thank you for your payment.",
                                                                        string.Format("{0:N}", t.Amount),
                                                                        PayPalAPI.GetCurrencyCodeType(app.CurrentStore.Settings.PayPal.Currency),
                                                                        OrderNumber);

                if ((captureResponse.Ack == AckCodeType.Success) || (captureResponse.Ack == AckCodeType.SuccessWithWarning))
                {
                    t.Result.ReferenceNumber = captureResponse.DoCaptureResponseDetails.PaymentInfo.TransactionID;

                    if (captureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.Pending)
                    {
                        t.Result.Succeeded               = true;
                        t.Result.ResponseCode            = "PENDING";
                        t.Result.ResponseCodeDescription = "PayPal Express Payment PENDING";
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message("Paypal Express Payment PENDING.", "OK", MerchantTribe.Payment.MessageType.Information));
                        return(true);
                    }
                    else if (captureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.InProgress)
                    {
                        t.Result.Succeeded               = true;
                        t.Result.ResponseCode            = "PENDING";
                        t.Result.ResponseCodeDescription = "PayPal Express Payment IN PROGRESS";
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message("Paypal Express Payment PENDING. In Progress.", "OK", MerchantTribe.Payment.MessageType.Information));
                        return(true);
                    }
                    else if (captureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.None)
                    {
                        t.Result.Succeeded               = true;
                        t.Result.ResponseCode            = "PENDING";
                        t.Result.ResponseCodeDescription = "PayPal Express Payment: No Status Yet";
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message("Paypal Express Payment PENDING. No Status Yet.", "OK", MerchantTribe.Payment.MessageType.Information));
                        return(true);
                    }
                    else if (captureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.Processed)
                    {
                        t.Result.Succeeded               = true;
                        t.Result.ResponseCode            = "PENDING";
                        t.Result.ResponseCodeDescription = "PayPal Express Payment PENDING";
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message("Paypal Express Payment PENDING.", "OK", MerchantTribe.Payment.MessageType.Information));
                        return(true);
                    }
                    else if (captureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus == PaymentStatusCodeType.Completed)
                    {
                        t.Result.Succeeded = true;
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message("PayPal Express Payment Captured Successfully.", "OK", MerchantTribe.Payment.MessageType.Information));
                        return(true);
                    }
                    else
                    {
                        t.Result.Succeeded = false;
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message("An error occurred while trying to capture your PayPal payment.", "", MerchantTribe.Payment.MessageType.Error));
                        return(false);
                    }
                }
                else
                {
                    t.Result.Succeeded = false;
                    t.Result.Messages.Add(new MerchantTribe.Payment.Message("Paypal Express Payment Charge Failed.", "", MerchantTribe.Payment.MessageType.Error));
                    foreach (ErrorType ppError in captureResponse.Errors)
                    {
                        t.Result.Messages.Add(new MerchantTribe.Payment.Message(ppError.LongMessage, ppError.ErrorCode, MerchantTribe.Payment.MessageType.Error));
                    }
                    return(false);
                }
            }
            finally
            {
                ppAPI = null;
            }
        }
Пример #12
0
        private void Capture(Transaction t)
        {
            PayPalAPI ppAPI = this.GetPaypalAPI();

            try
            {
                string OrderNumber = string.Empty;

                OrderNumber = t.MerchantInvoiceNumber;

                DoCaptureResponseType captureResponse = ppAPI.DoCapture(t.PreviousTransactionNumber, "Thank you for your payment.", String.Format("{0:N}", t.Amount), CurrencyCodeType.USD, OrderNumber);

                if ((captureResponse.Ack == AckCodeType.Success) || (captureResponse.Ack == AckCodeType.SuccessWithWarning))
                {
                    t.Result.ReferenceNumber = captureResponse.DoCaptureResponseDetails.PaymentInfo.TransactionID;
                    t.Result.Succeeded       = true;

                    switch (captureResponse.DoCaptureResponseDetails.PaymentInfo.PaymentStatus)
                    {
                    case PaymentStatusCodeType.Pending:
                        t.Result.Messages.Add(new Message("PayPal Pro Payment Pending", "", MessageType.Information));
                        t.Result.Succeeded = true;
                        break;

                    case PaymentStatusCodeType.InProgress:
                        t.Result.Messages.Add(new Message("PayPal Pro Payment In Progress", "", MessageType.Information));
                        t.Result.Succeeded = true;
                        break;

                    case PaymentStatusCodeType.None:
                        t.Result.Messages.Add(new Message("PayPal Pro Payment No Status Yet", "", MessageType.Information));
                        t.Result.Succeeded = true;
                        break;

                    case PaymentStatusCodeType.Processed:
                        t.Result.Messages.Add(new Message("PayPal Pro Charged Successfully", "", MessageType.Information));
                        t.Result.Succeeded = true;
                        break;

                    case PaymentStatusCodeType.Completed:
                        t.Result.Messages.Add(new Message("PayPal Pro Charged Successfully", "", MessageType.Information));
                        t.Result.Succeeded = true;
                        break;

                    default:
                        t.Result.Messages.Add(new Message("An error occured while attempting to capture this PayPal Payments Pro payment", "", MessageType.Information));
                        t.Result.Succeeded = false;
                        break;
                    }
                }
                else
                {
                    t.Result.Messages.Add(new Message("Paypal Payment Capture Failed.", "", MessageType.Warning));
                    foreach (ErrorType ppError in captureResponse.Errors)
                    {
                        t.Result.Messages.Add(new Message(ppError.LongMessage, ppError.ErrorCode, MessageType.Error));
                    }
                    t.Result.Succeeded = false;
                }
            }
            finally
            {
                ppAPI = null;
            }
        }
Пример #13
0
        protected void Submit_Click(object sender, EventArgs e)
        {
            // Create request object

            DoCaptureRequestType request =
                new DoCaptureRequestType();

            // (Required) Authorization identification number of the payment you want to capture. This is the transaction ID returned from DoExpressCheckoutPayment, DoDirectPayment, or CheckOut. For point-of-sale transactions, this is the transaction ID returned by the CheckOut call when the payment action is Authorization.
            request.AuthorizationID = authorizationId.Value;

            // (Required) Amount to capture.
            // Note: You must set the currencyID attribute to one of the three-character currency codes for any of the supported PayPal currencies.
            CurrencyCodeType currency = (CurrencyCodeType)
                                        Enum.Parse(typeof(CurrencyCodeType), currencyCode.SelectedValue);

            request.Amount = new BasicAmountType(currency, amount.Value);

            // (Required) Indicates whether or not this is your last capture. It is one of the following values:
            // * Complete – This is the last capture you intend to make.
            // * NotComplete – You intend to make additional captures.
            if (completeType.SelectedIndex != 0)
            {
                request.CompleteType = (CompleteCodeType)
                                       Enum.Parse(typeof(CompleteCodeType), completeType.SelectedValue);
            }
            // (Optional) An informational note about this settlement that is displayed to the buyer in email and in their transaction history.
            if (note.Value != string.Empty)
            {
                request.Note = note.Value;
            }
            // (Optional) Your invoice number or other identification number that is displayed to you and to the buyer in their transaction history. The value is recorded only if the authorization you are capturing is an Express Checkout order authorization.
            // Note: This value on DoCapture overwrites a value previously set on DoAuthorization.
            if (invoiceId.Value != string.Empty)
            {
                request.InvoiceID = invoiceId.Value;
            }
            // (Optional) Per transaction description of the payment that is passed to the buyer's credit card statement.
            //If you provide a value in this field, the full descriptor displayed on the buyer's statement has the following format:
            //<PP * | PAYPAL *><Merchant descriptor as set in the Payment Receiving Preferences><1 space><soft descriptor>
            //Character length and limitations: The soft descriptor can contain only the following characters:
            //Alphanumeric characters
            //- (dash)
            //* (asterisk)
            //. (period)
            //{space}
            //If you pass any other characters (such as ","), PayPal returns an error code.
            //The soft descriptor does not include the phone number, which can be toggled between your customer service number and PayPal's Customer Service number.
            //The maximum length of the soft descriptor is 22 characters. Of this, the PayPal prefix uses either 4 or 8 characters of the data format. Thus, the maximum length of the soft descriptor information that you can pass in this field is:
            //22 - len(<PP * | PAYPAL *>) - len(<Descriptor set in Payment Receiving Preferences> + 1)
            //For example, assume the following conditions:
            //The PayPal prefix toggle is set to PAYPAL * in PayPal's administration tools.
            //The merchant descriptor set in the Payment Receiving Preferences is set to EBAY.
            //The soft descriptor is passed in as JanesFlowerGifts LLC.
            //The resulting descriptor string on the credit card is:
            //PAYPAL *EBAY JanesFlow
            if (softDescriptor.Value != string.Empty)
            {
                request.Descriptor = softDescriptor.Value;
            }

            // Invoke the API
            DoCaptureReq wrapper = new DoCaptureReq();

            wrapper.DoCaptureRequest = 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 DoCapture method in service wrapper object
            DoCaptureResponseType doCaptureResponse =
                service.DoCapture(wrapper);


            // Check for API return status
            setKeyResponseObjects(service, doCaptureResponse);
        }