Example #1
0
        public IPaymentResponse Charge(PaymentRequest request)
        {
            var callbackUrl = PaymentHelper.GetCallbackUrl(this, nameof(Notify), Context);
            var req         = new MolliePaymentRequest
            {
                Amount = new Amount
                {
                    Currency = request.Currency,
                    Value    = request.TotalAmount.ToString("#.00")
                },
                Description = request.Description,
                RedirectUrl = Setting.RedirectUrl,
                WebhookUrl  = callbackUrl
            };

            var resp = new MollieApi(Setting.ApiToken).CreatePayment(req);

            return(new RedirectResponse(resp.Links.Checkout.Href, request.Id)
            {
                paymemtMethodReferenceId = resp.Id
            });
        }
Example #2
0
        public IPaymentResponse Charge(PaymentRequest request)
        {
            var callbackUrl = PaymentHelper.GetCallbackUrl(this, nameof(Notify), Context);
            var req         = new MolliePaymentRequest
            {
                Amount = new Amount
                {
                    Currency = request.Currency,
                    Value    = CurrencyDecimalPlaceConverter.ToDecimalPlaceString(request.Currency, request.TotalAmount)
                },
                Description = request.Description,
                RedirectUrl = !string.IsNullOrWhiteSpace(request.ReturnUrl) ? request.ReturnUrl : Setting.RedirectUrl,
                WebhookUrl  = callbackUrl,
                Metadata    = request.Id.ToString()
            };

            var resp = new MollieApi(Setting.ApiToken).CreatePayment(req);

            return(new RedirectResponse(resp.Links.Checkout.Href, request.Id)
            {
                paymemtMethodReferenceId = resp.Id
            });
        }