- ABP Framework version: v5.0.0
- UI type: MVC
- DB provider: EF Core
- Tiered (MVC) or Identity Server Separated (Angular): no
Hi,
We are experiencing three issues in our payment processes with stripe.
The first :
When you make a subscription everything goes well, the Payment/GatewaySelection page redirects to Payment/Stripe/PrePayment but this last page does not redirect to the stripe payment page. No errors in the logs. We can retrieve payment url from stripe logs and make payment however.
The second :
When we cancel a subscription the webhook customer.subscription.deleted is well marked as successful in the stripe logs, and we see it passed without error in the abp logs. However, there is no impact on the current edition of the tenant. We were expecting to have null as the editionid on the tenant to protect ourselves in the event that a customer no longer pays for their subscription.
The third :
Still in the webhook part we systematically notice the webhook checkout.session.completed in error in the stripe logs, we do not know the effects of this problem. On the abp logs side we see an exception:
2022-01-16 13:44:05.299 +00:00 [INF] Request starting HTTP/1.1 POST http://*******/payment/stripe/webhook application/json;+charset=utf-8 2186
2022-01-16 13:44:05.337 +00:00 [INF] Executing endpoint 'Volo.Payment.Stripe.StripeWebHookController.Webhook (Volo.Payment.Stripe.HttpApi)'
2022-01-16 13:44:05.339 +00:00 [INF] Route matched with {action = "Webhook", controller = "StripeWebHook", area = "", page = ""}. Executing controller action with signature System.Threading.Tasks.Task`1[Microsoft.AspNetCore.Mvc.IActionResult] Webhook() on controller Volo.Payment.Stripe.StripeWebHookController (Volo.Payment.Stripe.HttpApi).
2022-01-16 13:44:05.339 +00:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy
2022-01-16 13:44:05.787 +00:00 [INF] Executed action Volo.Payment.Stripe.StripeWebHookController.Webhook (Volo.Payment.Stripe.HttpApi) in 447.6455ms
2022-01-16 13:44:05.787 +00:00 [INF] Executed endpoint 'Volo.Payment.Stripe.StripeWebHookController.Webhook (Volo.Payment.Stripe.HttpApi)'
2022-01-16 13:44:06.866 +00:00 [ERR] An unhandled exception has occurred while executing the request.
Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'Volo.Payment.Requests.IPaymentRequestAppService.SetCurrencyAsync(Volo.Payment.Requests.SetPaymentRequestCurrencyDto)' has some invalid arguments
at CallSite.Target(Closure , CallSite , IPaymentRequestAppService , Object )
at Volo.Payment.Stripe.StripeWebHookController.kHxFUx2kvD(Event stripeEvent)
at Volo.Payment.Stripe.StripeWebHookController.Webhook()
at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.TaskOfIActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeActionMethodAsync>g__Awaited|12_0(ControllerActionInvoker invoker, ValueTask`1 actionResultValueTask)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeNextActionFilterAsync>g__Awaited|10_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Rethrow(ActionExecutedContextSealed context)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.<InvokeInnerFilterAsync>g__Awaited|13_0(ControllerActionInvoker invoker, Task lastTask, State next, Scope scope, Object state, Boolean isCompleted)
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 Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.Auditing.AbpAuditingMiddleware.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 Swashbuckle.AspNetCore.SwaggerUI.SwaggerUIMiddleware.Invoke(HttpContext httpContext)
at Swashbuckle.AspNetCore.Swagger.SwaggerMiddleware.Invoke(HttpContext httpContext, ISwaggerProvider swaggerProvider)
at Microsoft.AspNetCore.Authorization.AuthorizationMiddleware.Invoke(HttpContext context)
at IdentityServer4.Hosting.IdentityServerMiddleware.Invoke(HttpContext context, IEndpointRouter router, IUserSession session, IEventService events, IBackChannelLogoutService backChannelLogoutService)
at IdentityServer4.Hosting.MutualTlsEndpointMiddleware.Invoke(HttpContext context, IAuthenticationSchemeProvider schemes)
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at IdentityServer4.Hosting.BaseUrlMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Uow.AbpUnitOfWorkMiddleware.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 Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.InvokeAsync(HttpContext context, RequestDelegate next)
at Volo.Abp.AspNetCore.ExceptionHandling.AbpExceptionHandlingMiddleware.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 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.Builder.ApplicationBuilderAbpJwtTokenMiddlewareExtension.<>c__DisplayClass0_0.<<UseJwtTokenMiddleware>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Volo.Abp.AspNetCore.Tracing.AbpCorrelationIdMiddleware.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.ExceptionHandlerMiddleware.<Invoke>g__Awaited|6_0(ExceptionHandlerMiddleware middleware, HttpContext context, Task task)
Thank you in advance for your help.
11 Answer(s)
-
0
Hi @willignicolas@gmail.com
Can you find the payload of webhook request from Stripe dashboard?
The error says there are has some invalid arguments. If you can share the payload, we can investigate which one is it.
-
0
Can you find the payload of webhook request from Stripe dashboard?
The error says there are has some invalid arguments. If you can share the payload, we can investigate which one is it.
Hi,
There is the stripe request for "Second problem" for succeed customer.subscription.deleted web hook :
{ "id": "evt_****", "object": "event", "api_version": "2020-08-27", "created": 1642340712, "data": { "object": { "id": "sub_****", "object": "subscription", "application_fee_percent": null, "automatic_tax": { "enabled": false }, "billing_cycle_anchor": 1642340390, "billing_thresholds": null, "cancel_at": null, "cancel_at_period_end": false, "canceled_at": 1642340712, "collection_method": "charge_automatically", "created": 1642340390, "current_period_end": 1645018790, "current_period_start": 1642340390, "customer": "cus_****", "days_until_due": null, "default_payment_method": "pm_1KIYxVDVLD0zzxD3s0zT7SpZ", "default_source": null, "default_tax_rates": [ ], "discount": null, "ended_at": 1642340712, "items": { "object": "list", "data": [ { "id": "si_***", "object": "subscription_item", "billing_thresholds": null, "created": 1642340390, "metadata": { }, "plan": { "id": "price_****", "object": "plan", "active": true, "aggregate_usage": null, "amount": 7900, "amount_decimal": "7900", "billing_scheme": "per_unit", "created": 1641132281, "currency": "eur", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": "Normal", "product": "prod_KtHEhvInPraaIH", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "price": { "id": "price_***", "object": "price", "active": true, "billing_scheme": "per_unit", "created": 1641132281, "currency": "eur", "livemode": false, "lookup_key": null, "metadata": { }, "nickname": "Normal", "product": "prod_****", "recurring": { "aggregate_usage": null, "interval": "month", "interval_count": 1, "trial_period_days": null, "usage_type": "licensed" }, "tax_behavior": "unspecified", "tiers_mode": null, "transform_quantity": null, "type": "recurring", "unit_amount": 7900, "unit_amount_decimal": "7900" }, "quantity": 1, "subscription": "sub_****", "tax_rates": [ ] } ], "has_more": false, "total_count": 1, "url": "/v1/subscription_items?subscription=sub_1KIYxWDVLD0zzxD3iplrBPXt" }, "latest_invoice": "in_****", "livemode": false, "metadata": { }, "next_pending_invoice_item_invoice": null, "pause_collection": null, "payment_settings": { "payment_method_options": null, "payment_method_types": null }, "pending_invoice_item_interval": null, "pending_setup_intent": null, "pending_update": null, "plan": { "id": "price_****", "object": "plan", "active": true, "aggregate_usage": null, "amount": 7900, "amount_decimal": "7900", "billing_scheme": "per_unit", "created": 1641132281, "currency": "eur", "interval": "month", "interval_count": 1, "livemode": false, "metadata": { }, "nickname": "Normal", "product": "prod_****", "tiers_mode": null, "transform_usage": null, "trial_period_days": null, "usage_type": "licensed" }, "quantity": 1, "schedule": null, "start_date": 1642340390, "status": "canceled", "transfer_data": null, "trial_end": null, "trial_start": null } }, "livemode": false, "pending_webhooks": 3, "request": { "id": "req_****", "idempotency_key": null }, "type": "customer.subscription.deleted" }
-
0
And tere is the stripe request for "Third problem" for failed checkout.session.completed web hook :
{ "id": "evt_****", "object": "event", "api_version": "2020-08-27", "created": 1642340392, "data": { "object": { "id": "cs_test_****", "object": "checkout.session", "after_expiration": null, "allow_promotion_codes": null, "amount_subtotal": 7900, "amount_total": 7900, "automatic_tax": { "enabled": false, "status": null }, "billing_address_collection": null, "cancel_url": "****", "client_reference_id": null, "consent": null, "consent_collection": null, "currency": "eur", "customer": "cus_***", "customer_creation": "always", "customer_details": { "email": "****@gmail.com", "phone": null, "tax_exempt": "none", "tax_ids": [ ] }, "customer_email": null, "expires_at": 1642426660, "livemode": false, "locale": "auto", "metadata": { "PaymentRequestId": "46360d23-cca4-82ce-b4a1-3a******" }, "mode": "subscription", "payment_intent": null, "payment_method_options": { }, "payment_method_types": [ "card" ], "payment_status": "paid", "phone_number_collection": { "enabled": false }, "recovered_from": null, "setup_intent": null, "shipping": null, "shipping_address_collection": null, "shipping_options": [ ], "shipping_rate": null, "status": "complete", "submit_type": null, "subscription": "sub_****", "success_url": "*******/Payment/Stripe/PostPayment?SessionId={CHECKOUT_SESSION_ID}", "total_details": { "amount_discount": 0, "amount_shipping": 0, "amount_tax": 0 }, "url": null } }, "livemode": false, "pending_webhooks": 1, "request": { "id": "req_****", "idempotency_key": "354b1108-3311-4c91-ba79-*****" }, "type": "checkout.session.completed" }
Thanks for your help.
-
0
We've discovered an issue on our side. We'll release a patch version for it.
Also your credit is refunded.
-
0
We've discovered an issue on our side. We'll release a patch version for it.
Also your credit is refunded.
Your correction of this issue will fix my three problems?
As a reminder :
First => The stripe payement page is not opened. Second => The customer.subscription.deleted webhook is succeed but has no effect Third => The checkout.session.completed webhook is failed with exception.
Thanks for your feedback
-
0
Webhook operations such as your second & third operations will be solved in your situation.
The first : When you make a subscription everything goes well, the Payment/GatewaySelection page redirects to Payment/Stripe/PrePayment but this last page does not redirect to the stripe payment page. No errors in the logs. We can retrieve payment url from stripe logs and make payment however.
Payment redirection is made with javascript after the page is loaded. If you don't see any error on console, redirection should be done after a while
-
0
Payment redirection is made with javascript after the page is loaded. If you don't see any error on console, redirection should be done after a while
We don't have any error in console, the stripe payment page doesn't open.
No error in abp logs nether.
Tester on chrome and Edge with same result.
There is the abp log:
2022-01-17 20:24:12.831 +01:00 [INF] Request finished HTTP/2 POST https://localhost:44302/Saas/Tenants/SelectEditionToSubscription application/x-www-form-urlencoded;+charset=UTF-8 318 - 307 - - 1322.5072ms 2022-01-17 20:24:12.848 +01:00 [INF] Request starting HTTP/2 POST https://localhost:44302/Payment/GatewaySelection?paymentRequestId=1ecbf658-600f-cba8-2678-3a017bac0ec1 application/x-www-form-urlencoded;+charset=UTF-8 318 2022-01-17 20:24:12.888 +01:00 [INF] No CORS policy found for the specified request. 2022-01-17 20:24:12.892 +01:00 [INF] Executing endpoint '/Payment/GatewaySelection' 2022-01-17 20:24:12.905 +01:00 [INF] Route matched with {page = "/Payment/GatewaySelection", area = "", action = "", controller = ""}. Executing page /Payment/GatewaySelection 2022-01-17 20:24:12.906 +01:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2022-01-17 20:24:13.090 +01:00 [INF] Executing handler method Volo.Payment.Pages.Payment.GatewaySelectionModel.OnPostAsync - ModelState is "Valid" 2022-01-17 20:24:13.390 +01:00 [INF] Executed handler method OnPostAsync, returned result Microsoft.AspNetCore.Mvc.LocalRedirectResult. 2022-01-17 20:24:13.395 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:13.397 +01:00 [INF] Executing LocalRedirectResult, redirecting to /Payment/Stripe/PrePayment?paymentRequestId=1ecbf658-600f-cba8-2678-3a017bac0ec1. 2022-01-17 20:24:13.397 +01:00 [INF] Executed page /Payment/GatewaySelection in 491.6009ms 2022-01-17 20:24:13.397 +01:00 [INF] Executed endpoint '/Payment/GatewaySelection' 2022-01-17 20:24:13.400 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:13.427 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:13.430 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:13.438 +01:00 [INF] Request finished HTTP/2 POST https://localhost:44302/Payment/GatewaySelection?paymentRequestId=1ecbf658-600f-cba8-2678-3a017bac0ec1 application/x-www-form-urlencoded;+charset=UTF-8 318 - 307 - - 589.6527ms 2022-01-17 20:24:13.456 +01:00 [INF] Request starting HTTP/2 POST https://localhost:44302/Payment/Stripe/PrePayment?paymentRequestId=1ecbf658-600f-cba8-2678-3a017bac0ec1 application/x-www-form-urlencoded;+charset=UTF-8 318 2022-01-17 20:24:13.501 +01:00 [INF] No CORS policy found for the specified request. 2022-01-17 20:24:13.506 +01:00 [INF] Executing endpoint '/Payment/Stripe/PrePayment' 2022-01-17 20:24:13.520 +01:00 [INF] Route matched with {page = "/Payment/Stripe/PrePayment", area = "", action = "", controller = ""}. Executing page /Payment/Stripe/PrePayment 2022-01-17 20:24:13.520 +01:00 [INF] Skipping the execution of current filter as its not the most effective filter implementing the policy Microsoft.AspNetCore.Mvc.ViewFeatures.IAntiforgeryPolicy 2022-01-17 20:24:14.889 +01:00 [INF] Executing handler method Volo.Payment.Stripe.Pages.Payment.Stripe.PrePaymentModel.OnPostAsync - ModelState is "Valid" 2022-01-17 20:24:16.501 +01:00 [DBG] Batch acquisition of 0 triggers 2022-01-17 20:24:16.501 +01:00 [DBG] Calling Execute on job DEFAULT.Volo.Abp.BackgroundJobs.BackgroundJobWorker 2022-01-17 20:24:16.516 +01:00 [DBG] Trigger instruction : NoInstruction 2022-01-17 20:24:16.517 +01:00 [DBG] Batch acquisition of 1 triggers 2022-01-17 20:24:16.788 +01:00 [INF] Executed handler method OnPostAsync, returned result . 2022-01-17 20:24:16.788 +01:00 [INF] Executing an implicit handler method - ModelState is "Valid" 2022-01-17 20:24:16.788 +01:00 [INF] Executed an implicit handler method, returned result Microsoft.AspNetCore.Mvc.RazorPages.PageResult. 2022-01-17 20:24:16.816 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:16.839 +01:00 [INF] Executed page /Payment/Stripe/PrePayment in 3318.9242ms 2022-01-17 20:24:16.840 +01:00 [INF] Executed endpoint '/Payment/Stripe/PrePayment' 2022-01-17 20:24:16.842 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:16.896 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:16.900 +01:00 [DBG] Added 0 entity changes to the current audit log 2022-01-17 20:24:16.905 +01:00 [INF] Request finished HTTP/2 POST https://localhost:44302/Payment/Stripe/PrePayment?paymentRequestId=1ecbf658-600f-cba8-2678-3a017bac0ec1 application/x-www-form-urlencoded;+charset=UTF-8 318 - 200 - text/html;+charset=utf-8 3449.2118ms
there is a screen of chrome network console :
And our code :
public async Task<IActionResult> OnPostAsync() { var paymentRequest = await _subscriptionAppService.CreateSubscriptionAsync(EditionId, TenantId); return LocalRedirectPreserveMethod("/Payment/GatewaySelection?paymentRequestId=" + paymentRequest.Id); }
Thanks for your help
-
0
do you have any leads for this problem?
-
0
Hello,
Just Migrate from 5.0.0 to 5.1.2 but still the problem of redirection.
-
0
Webhook operations such as your second & third operations will be solved in your situation.
Hello,
Just Migrate to abp 5.1.3.
The Delete Webhook is still not working. (no error in abp or stripe side but stricly no effect on the tenant edition or endeditiondate)
This is a major problem because a customer that not pay the subscription anymore can continu to use our product.
I have describe this issue with detail and we have received the confirmation that it will be resolved on the next version but here we are.
Thanks for your quick help.
Nicolas
-
0
I've just tried, it's working in a basic demo.
endeditiondate will not be affected if a user ends the payment. The last period is still can be used until the end date. But end date will not be extended if the user hasn't paid the last bill.
I'm not sure is there an option in stripe for ending subscription immediately instead of canceling at end of the period, but if it can be done on stripe, it'll affect to abp application too. We handle PeriodEndDate from stripe.