Example #1
0
        public IPaymentResponse Charge(PaymentRequest request)
        {
            var referenceId = request.Id.ToString();
            var req         = new AdyenPaymentRequest
            {
                Amount = new AdyenAmount
                {
                    Currency = request.Currency,
                    Value    = AdyenAmount.FormatAmountToMinorUnits(request.Currency, request.TotalAmount)
                },
                CountryCode     = request.Country,
                MerchantAccount = Setting.MerchantAccount,
                Reference       = referenceId,
                Description     = request.Description,
                ReturnUrl       = !string.IsNullOrWhiteSpace(request.ReturnUrl) ? request.ReturnUrl : Setting.ReturnUrl
            };

            var resp = new AdyenApi(Setting).CreatePayment(req);

            return(new RedirectResponse(resp.Url, request.Id)
            {
                paymemtMethodReferenceId = referenceId
            });
        }
        public IPaymentResponse Charge(PaymentRequest request)
        {
            var referenceId = request.Id.ToString();
            var req         = new AdyenPaymentRequest
            {
                Amount = new AdyenAmount
                {
                    Currency = request.Currency,
                    Value    = (long)request.TotalAmount
                },
                CountryCode     = request.Country,
                MerchantAccount = Setting.MerchantAccount,
                Reference       = referenceId,
                Description     = request.Description,
                ReturnUrl       = Setting.ReturnUrl
            };

            var resp = new AdyenApi(Setting).CreatePayment(req);

            return(new RedirectResponse(resp.Url, request.Id)
            {
                paymemtMethodReferenceId = referenceId
            });
        }