public async Task <IActionResult> ReceiveConfirmation(string data)
        {
            if (data == null)
            {
                return(this.BadRequest());
            }

            dynamic paymentInfo = DirectPaymentsHelper.ProcessPaymentResult(
                data,
                this.directPaymentsConfiguration.SiteKey,
                this.directPaymentsConfiguration.CentralApiPublicKey);

            if (paymentInfo == null)
            {
                // if the returned PaymentInfo is null, it has not been parsed or verified successfully
                return(this.BadRequest());
            }

            // extract the orderId from the PaymentInfo
            string orderId;

            try
            {
                orderId = paymentInfo.OrderId;
            }
            catch
            {
                return(this.BadRequest());
            }

            if (orderId == null)
            {
                return(this.BadRequest());
            }

            // find the order in the database
            var order = await this.ordersService.GetByIdAsync(orderId);

            // check if the order does not exist or the payment has already been completed
            if (order == null || order.PaymentStatus != PaymentStatus.Pending)
            {
                return(this.RedirectToAction("My", "Orders"));
            }

            // mark the payment as completed
            await this.ordersService.SetPaymentStatus(orderId, PaymentStatus.Completed);

            return(this.RedirectToAction("My", "Orders"));
        }