Open Closed

Payment Module Setup & Empty Errors #5927


User avatar
0
hinairusu created

Hi Team.

I have a blazor server Tiered setup, running v7.3.3. (Updated to v7.4.0 as part of trying to resolve this) I have installed the Payment module as per the page https://docs.abp.io/en/commercial/latest/modules/payment using ABP Suite. I have configured my appsettings to look like the following for local testing (I've included all the gateway options in case we wanted to set up the others):

{
  "App": {
    "SelfUrl": "https://localhost:44312",
    "DisablePII": "false"
  },
  "RemoteServices": {
    "Default": {
      "BaseUrl": "https://localhost:44325/"
    },
    "AbpAccountPublic": {
      "BaseUrl": "https://localhost:44391/"
    }
  },
  "Redis": {
    "Configuration": "127.0.0.1"
  },
  "AuthServer": {
    "Authority": "https://localhost:44391",
    "RequireHttpsMetadata": "true",
    "ClientId": "TheDragonsHoard_BlazorServerTiered",
    "ClientSecret": "1q2w3e*"
  },
  "StringEncryption": {
    "DefaultPassPhrase": "WibblyWobblyTestyWestyNumber1"
  },
  "Payment": {
    "PaymentWebOptions": {
      "CallbackUrl": "https://localhost:44312/PaymentConfirmation",
      "RootUrl": "",
      "GatewaySelectionCheckoutButtonStyle": "",
      "Gateways": {
        "Stripe": {
          "Name": "Stripe",
          "PrePaymentUrl": "/Subscribe",
          "PostPaymentUrl": "/PaymentConfirmation",
          "Order": "1",
          "Recommended": true,
          "ExtraInfos": [ "Test 1" ]
        },
        "Paypal": {
          "Name": "Paypal",
          "PrePaymentUrl": "/Subscribe",
          "PostPaymentUrl": "/PaymentConfirmation",
          "Order": "2",
          "Recommended": false,
          "ExtraInfos": [ "Test 2" ]
        }
      }
    },
    "Payu": {
      "Merchant": "TEST",
      "Signature": "SECRET_KEY",
      "LanguageCode": "en",
      "CurrencyCode": "USD",
      "VatRate": "0",
      "PriceType": "GROSS",
      "Shipping": "0",
      "Installment": "1",
      "TestOrder": "1",
      "Debug": "1"
    },
    "TwoCheckout": {
      "Signature": "SECRET_KEY",
      "CheckoutUrl": "https://secure.2checkout.com/order/checkout.php",
      "LanguageCode": "en",
      "CurrencyCode": "USD",
      "TestOrder": "1"
    },
    "PayPal": {
      "ClientId": "CLIENT_ID",
      "Secret": "SECRET",
      "CurrencyCode": "USD",
      "Environment": "Sandbox",
      "Locale": "en_US"
    },
    "Stripe": {
      "PublishableKey": "KEY",
      "SecretKey": "SECRET",
      "WebhookSecret":  "MY SECRET", 
      "PaymentMethodTypes": [ "alipay" ]
    },
    "Iyzico": {
      "ApiKey": "API_KEY",
      "SecretKey": "SECRET_KEY",
      "BaseUrl": "https://sandbox-api.iyzipay.com",
      "Locale": "en",
      "Currency": "USD"
    }
  }

I am aware that these values need subbing out for the actual used values, and in the case of Stripe I have got my secrets present for testing. My Depends on has the following listed in the modules: However: when I try setting up a new gateway: And after checking the console:

I assume that there only being stripe is why I don't see a Payment Gateway Selection popup when I try processing a payment.

What I need to solve:

  1. Why is Paypal not listed as an option.
  2. Why is it not letting me set a second Gateway Plan
  3. According to the docs, I set up a subscription by handing in a GUID to the PlanId property on PaymentRequestProductCreateDto. How exactly do I get this GUID code side, when the plans are not hard coded? (Your sample lists DemoAppData.Plan_2_Id, which seems to come from nowhere)

At this point I'm happy to share my solution, logs, or anything else you need. I've spent months trying to get this payment gateway up and running, and I'm running out of hope it'll ever actually work.


17 Answer(s)
  • User Avatar
    0
    hinairusu created

    Haviong checked the logs for the HttpApi.Host, I get the below:

    [21:13:58 WRN] Savepoints are disabled because Multiple Active Result Sets (MARS) is enabled. If 'SaveChanges' fails, then the transaction cannot be automatically rolled back to a known clean state. Instead, the transaction should be rolled back by the application before retrying 'SaveChanges'. See https://go.microsoft.com/fwlink/?linkid=2149338 for more information and examples. To identify the code which triggers this warning, call 'ConfigureWarnings(w => w.Throw(SqlServerEventId.SavepointsDisabledBecauseOfMARS))'. [21:13:58 ERR] Failed executing DbCommand (3ms) [Parameters=[@p0='?' (Size = 450), @p1='?' (DbType = Guid), @p2='?' (Size = 4000), @p3='?' (Size = 4000)], CommandType='Text', CommandTimeout='30'] SET IMPLICIT_TRANSACTIONS OFF; SET NOCOUNT ON; INSERT INTO [PayGatewayPlans] ([Gateway], [PlanId], [ExternalId], [ExtraProperties]) VALUES (@p0, @p1, @p2, @p3); [21:13:58 ERR] An exception occurred in the database while saving changes for context type 'Volo.Payment.EntityFrameworkCore.PaymentDbContext'. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_PayGatewayPlans'. Cannot insert duplicate key in object 'dbo.PayGatewayPlans'. The duplicate key value is (2e60ddf8-ea28-c3f2-3bcb-3a0e18803a3e, stripe). The statement has been terminated. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) ClientConnectionId:b1dce277-c7a9-44f2-8757-e7c6cf5ae230 Error Number:2627,State:1,Class:14 --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList1 entriesToSave, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken)Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_PayGatewayPlans'. Cannot insert duplicate key in object 'dbo.PayGatewayPlans'. The duplicate key value is (2e60ddf8-ea28-c3f2-3bcb-3a0e18803a3e, stripe). The statement has been terminated. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__208_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) ClientConnectionId:b1dce277-c7a9-44f2-8757-e7c6cf5ae230 Error Number:2627,State:1,Class:14 --- End of inner exception stack trace --- at Microsoft.EntityFrameworkCore.Update.ReaderModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Update.Internal.SqlServerModificationCommandBatch.ExecuteAsync(IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Update.Internal.BatchExecutor.ExecuteAsync(IEnumerable1 commandBatches, IRelationalConnection connection, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(IList1 entriesToSave, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.ChangeTracking.Internal.StateManager.SaveChangesAsync(StateManager stateManager, Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.DbContext.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Volo.Abp.EntityFrameworkCore.AbpDbContext`1.SaveChangesAsync(Boolean acceptAllChangesOnSuccess, CancellationToken cancellationToken) at Volo.Abp.Uow.UnitOfWork.SaveChangesAsync(CancellationToken cancellationToken) at Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.SaveChangesAsync(ActionExecutingContext context, IUnitOfWorkManager unitOfWorkManager) at Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.SaveChangesAsync(ActionExecutingContext context, IUnitOfWorkManager unitOfWorkManager) at Volo.Abp.AspNetCore.Mvc.Uow.AbpUowActionFilter.OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.

    [21:13:58 ERR] An error occurred while saving the entity changes. See the inner exception for details. Microsoft.EntityFrameworkCore.DbUpdateException: An error occurred while saving the entity changes. See the inner exception for details. ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Violation of PRIMARY KEY constraint 'PK_PayGatewayPlans'. Cannot insert duplicate key in object 'dbo.PayGatewayPlans'. The duplicate key value is (2e60ddf8-ea28-c3f2-3bcb-3a0e18803a3e, stripe). The statement has been terminated. at Microsoft.Data.SqlClient.SqlCommand.<>c.

    Which would indicate that we can't have multiple External Ids?

    The Docs however state:

    So, Multiple products? Multiple plans? Do we need to configure a plan and a gateway for each seperate product?

  • User Avatar
    0
    hinairusu created

    For more details on #3, this is the line I'm using for my product setup similar to the docs)

    and while I'm getting a sucess on my Payment Requests tab:

    It's not actually calling out or doing anything.

    It feels like something is broken with the payment module I can't see, or there is a config that's missing to click it all in to place.

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Hi,

    Why is Paypal not listed as an option.

    https://docs.abp.io/en/commercial/latest/modules/payment#subscriptions Subscription logic supports only Stripe for now. So, this payment plans are for subscription logic. If you configured your Secret Keys in appsettings.json you can make payments on your application by following Creating One-Time Payment documentation.

    Why is it not letting me set a second Gateway Plan

    It seems the error doesn't explain well, We'll update the error. But the reason is, you can add gateway plan per a gateway, you can't add 2 different plan from a gateway. Otherwise the subscription logic can't know which one is used while getting paid.

    According to the docs, I set up a subscription by handing in a GUID to the PlanId property on PaymentRequestProductCreateDto. How exactly do I get this GUID code side, when the plans are not hard coded? (Your sample lists DemoAppData.Plan_2_Id, which seems to come from nowhere)

    You should get a PaymentPlanId from the database and pass it as parameter, it'll automatically use the ExternalSubscriptionId from it. So the External Subscription Id should be a Price Id or Product Id from Stripe

  • User Avatar
    0
    hinairusu created

    Hi,

    Why is Paypal not listed as an option.

    https://docs.abp.io/en/commercial/latest/modules/payment#subscriptions Subscription logic supports only Stripe for now. So, this payment plans are for subscription logic. If you configured your Secret Keys in appsettings.json you can make payments on your application by following Creating One-Time Payment documentation.

    Why is it not letting me set a second Gateway Plan

    It seems the error doesn't explain well, We'll update the error. But the reason is, you can add gateway plan per a gateway, you can't add 2 different plan from a gateway. Otherwise the subscription logic can't know which one is used while getting paid.

    According to the docs, I set up a subscription by handing in a GUID to the PlanId property on PaymentRequestProductCreateDto. How exactly do I get this GUID code side, when the plans are not hard coded? (Your sample lists DemoAppData.Plan_2_Id, which seems to come from nowhere)

    You should get a PaymentPlanId from the database and pass it as parameter, it'll automatically use the ExternalSubscriptionId from it. So the External Subscription Id should be a Price Id or Product Id from Stripe

    Using that logic, I replaced my payment with the following: PaymentRequest.Products.Add(new PaymentRequestProductCreateDto() { Code = "OneTimePayment", Name = "Test Payment", Count = 1, UnitPrice = float.Parse(OneTimePrice.ToString()), TotalPrice = float.Parse(OneTimePrice.ToString()) });

    So it should then allow for other gateways as it is no longer a subscription. I am expecting to see this page: However that does not appear, I have no option of selecting my payment gateway, and the status is hung on waiting. The page also isn't redirecting anywhere, but I suspect thats because its not hitting the above payment gateway.

    If the idea is you set up one gateway plan per gateway, why is your UI a list for more to be included. That seems really poor design as that isn't clear at all.

    Fetching the ID from the DB I can do (as soon as I figure out what the correct call to fetch that is and what permissions I have to give to my users to be able to access it). I'll go test that side now and update this once I have more there,

  • User Avatar
    0
    hinairusu created

    Okay, so after updating to 7.4.0 and a lot of messing around, I can get it to hit the stripe API. But It uses none of the methods you have provided in your documentation. I can hit the API if I call var foobar = new PaymentRequestStartDto() { CancelUrl = "https://testurl.co.uk", PaymentRequestId = paymentRequest.Id, ReturnUrl = "https://testurl.com/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id }; _paymentRequestAppService.StartAsync("Stripe", foobar);

    which will give me a

    I still do not get the choice of payment gateways for my single option, and nothing redirects to the payment page. According to the stripe logs, I should be getting a JSON back with a checkout URL, but that's not hitting my system at all.

    if I do not call the StartAsync() method, it does not hit stripe.

  • User Avatar
    0
    hinairusu created

    This is the http.api log output for the request I'm making:

    Code for the calls: (this snip was from my test domain where I tried it externally visible incase it's a routing issue. Localhost I'm testing using the stripe CLI to intercept the responses - No difference in result between the two.) The second call is hitting the stripe API, the first is not. And still no redirect to pay.

  • User Avatar
    0
    hinairusu created

    New Update.

    if I go to the log in Stripe and grab the pay URL manually to test what happens if it did somehow load: Then I can pay and it redirects to the return URL, which I can catch on my side without too much issue. But, I can't process the complete from it, as the CompleteAsync takes a dictionary of <string,string> and I have no idea what should be going in those.

    Further, I get this: Showing that the webhook endpoint isn't actually catching the response from Stripe when I do actually post.

  • User Avatar
    0
    hinairusu created

    Could I get an update on this please?

  • User Avatar
    0
    hinairusu created

    To clarify, in case it isnt clear at this point.

    I have one prodduct I am handing in, which is not a subscription, for which I am expecting to see both the stripe and paypal payment gateways. I am not seeing either.

    I have one product which I am handing in, which is a subscription, which is not redirecting me to stripe correctly to process the payment.

    If I use the code listed above, I can register a hit against the stripe API, but it is not redirecting to the payment page in the response (it doesn't even seem to be getting the response!).

  • User Avatar
    0
    rivz created

    I have a same kind of problem. I have created a "one time payment", when i click "buy" on my page, it redirects me to "mypage.com/Payment/Stripe/PrePayment?paymentRequestId=requestnumbershere" and then it gives me "HTTP Error 500" but when i go to my stripe dashboard, i see the paymentrequest in logs, i can manualy open the link and go there and use my card and the payment is successful. After that i get redirected to my "shop" page.

    In web logs i have :

    [16:52:42 ERR] ---------- RemoteServiceErrorInfo ----------
    {
      "code": null,
      "message": "An internal error occurred during your request!",
      "details": null,
      "data": {},
      "validationErrors": null
    }
    
    [16:52:42 ERR] Object reference not set to an instance of an object.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Volo.Payment.Stripe.Pages.Payment.Stripe.PrePaymentModel.OnPostAsync()
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
    [16:52:42 INF] Executed page /Payment/Stripe/PrePayment in 4826.7507ms
    [16:52:42 INF] Executed endpoint '/Payment/Stripe/PrePayment'
    [16:52:42 ERR] An unhandled exception has occurred while executing the request.
    System.NullReferenceException: Object reference not set to an instance of an object.
       at Volo.Payment.Stripe.Pages.Payment.Stripe.PrePaymentModel.OnPostAsync()
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments)
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync()
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync()
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context)
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync()
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker)
       at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger)
       at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
       at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
       at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context)
       at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext()
    --- End of stack trace from previous location ---
       at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context)
    [16:52:42 INF] Request finished HTTP/1.1 POST https://localhost:44383/Payment/Stripe/PrePayment?paymentRequestId=5bb159f7-62e9-422d-3f9c-3a0e5a62756d application/x-www-form-urlencoded 182 - 500 - text/html;+charset=utf-8 4838.2090ms
    
    

    I will also add my ShopController.cs if its any help

     [HttpPost]
        [ActionName("OnPost")]
        [ValidateAntiForgeryToken]
        public async Task<IActionResult> OnPostAsync()
        {
            var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreateDto()
            {
                Currency = "EUR",
                Products = new List<PaymentRequestProductCreateDto>()
                {
                    new PaymentRequestProductCreateDto
                    {
                        Code = "prod_OnDAVUNq44gU1v",
                        Name = "1000 store credits",
                        Count = 1,
                        UnitPrice = 10,
                        TotalPrice = 10
                    }
                },
            });
    
            return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id);
        }
    

    Any help is welcome.

  • User Avatar
    0
    hinairusu created

    Hi Team!

    Any Update on this?

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    I have a same kind of problem. I have created a "one time payment", when i click "buy" on my page, it redirects me to "mypage.com/Payment/Stripe/PrePayment?paymentRequestId=requestnumbershere" and then it gives me "HTTP Error 500" but when i go to my stripe dashboard, i see the paymentrequest in logs, i can manualy open the link and go there and use my card and the payment is successful. After that i get redirected to my "shop" page.

    In web logs i have :

    [16:52:42 ERR] ---------- RemoteServiceErrorInfo ---------- 
    { 
      "code": null, 
      "message": "An internal error occurred during your request!", 
      "details": null, 
      "data": {}, 
      "validationErrors": null 
    } 
     
    [16:52:42 ERR] Object reference not set to an instance of an object. 
    System.NullReferenceException: Object reference not set to an instance of an object. 
       at Volo.Payment.Stripe.Pages.Payment.Stripe.PrePaymentModel.OnPostAsync() 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
    [16:52:42 INF] Executed page /Payment/Stripe/PrePayment in 4826.7507ms 
    [16:52:42 INF] Executed endpoint '/Payment/Stripe/PrePayment' 
    [16:52:42 ERR] An unhandled exception has occurred while executing the request. 
    System.NullReferenceException: Object reference not set to an instance of an object. 
       at Volo.Payment.Stripe.Pages.Payment.Stripe.PrePaymentModel.OnPostAsync() 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.ExecutorFactory.NonGenericTaskHandlerMethod.Execute(Object receiver, Object[] arguments) 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeHandlerMethodAsync() 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeNextPageFilterAsync() 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Rethrow(PageHandlerExecutedContext context) 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 
       at Microsoft.AspNetCore.Mvc.RazorPages.Infrastructure.PageActionInvoker.InvokeInnerFilterAsync() 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextExceptionFilterAsync>g__Awaited|26_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ExceptionContextSealed context) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeNextResourceFilter>g__Awaited|25_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Rethrow(ResourceExecutedContextSealed context) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeFilterPipelineAsync>g__Awaited|20_0(ResourceInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) 
       at Microsoft.AspNetCore.Mvc.Infrastructure.ResourceInvoker.<InvokeAsync>g__Logged|17_1(ResourceInvoker invoker) 
       at Microsoft.AspNetCore.Routing.EndpointMiddleware.<Invoke>g__AwaitRequestTask|6_0(Endpoint endpoint, Task requestTask, ILogger logger) 
       at Volo.Abp.AspNetCore.Serilog.AbpSerilogMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context) 
       at Volo.Abp.AspNetCore.MultiTenancy.MultiTenancyMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context) 
       at Volo.Abp.AspNetCore.Security.AbpSecurityHeadersMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Localization.RequestLocalizationMiddleware.Invoke(HttpContext context) 
       at Microsoft.AspNetCore.RequestLocalization.AbpRequestLocalizationMiddleware.InvokeAsync(HttpContext context, RequestDelegate next) 
       at Microsoft.AspNetCore.Builder.UseMiddlewareExtensions.<>c__DisplayClass6_1.<<UseMiddlewareInterface>b__1>d.MoveNext() 
    --- End of stack trace from previous location --- 
       at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddlewareImpl.Invoke(HttpContext context) 
    [16:52:42 INF] Request finished HTTP/1.1 POST https://localhost:44383/Payment/Stripe/PrePayment?paymentRequestId=5bb159f7-62e9-422d-3f9c-3a0e5a62756d application/x-www-form-urlencoded 182 - 500 - text/html;+charset=utf-8 4838.2090ms 
     
    

    I will also add my ShopController.cs if its any help

     [HttpPost] 
        [ActionName("OnPost")] 
        [ValidateAntiForgeryToken] 
        public async Task<IActionResult> OnPostAsync() 
        { 
            var paymentRequest = await _paymentRequestAppService.CreateAsync(new PaymentRequestCreateDto() 
            { 
                Currency = "EUR", 
                Products = new List<PaymentRequestProductCreateDto>() 
                { 
                    new PaymentRequestProductCreateDto 
                    { 
                        Code = "prod_OnDAVUNq44gU1v", 
                        Name = "1000 store credits", 
                        Count = 1, 
                        UnitPrice = 10, 
                        TotalPrice = 10 
                    } 
                }, 
            }); 
     
            return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id); 
        } 
    

    Any help is welcome.

    It seems there is an error on the PrePaymentModel class, I'll write back after investigation

  • User Avatar
    0
    enisn created
    Support Team .NET Developer

    Probably, PaymentRequestId is wrong and StartResult is null due to it according to the following code of PrePayment.cshtml.cs:

    Does it work in test environment?

  • User Avatar
    0
    hinairusu created

    I'm not even able to reach the Prepayment page myself, in either Test or Prod - it doesn't redirect at all.

  • User Avatar
    0
    rivz created

    So i got my module working, not sure how, just messed around with modules and settings.

  • User Avatar
    0
    hinairusu created

    So I've gotten stripe working thanks to a member of the community, and I can take payments. However, I cannot update the webhook so far.

    How does one go about getting this to update from Waiting exactly - as the Docs imply that the webhook manages this for you.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    Is the problem solved?

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09