Base solution for your next web application
Open Closed

Confirm PayPal Payment error #11152


User avatar
0
moonch created
  • What is your product version? .NET6
  • What is your product type : JQUERY CORE MVC
  • What is product framework type : .NET6

Dear Customer support, I am getting the following error on ConfirmPayment inside the PayPalPaymentAppService, please see attached image, although the payment record is commited AppSubscriptionPayments Db. Using localhost and sandbox test account.

your help is appreciated.


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Could you follow https://github.com/aspnetzero/aspnet-zero-core/issues/4465 ? We will test and fix this problem.

    Thanks,

  • User Avatar
    0
    moonch created

    Thank you, I can't open the link. is there another way to share it.

  • User Avatar
    0
    moonch created

    I would like to suggest the following fix.

    In Purchase.cshtml Line: <input type="hidden" name="Amount" value="@Model.Amount.ToString("F1", new CultureInfo("en-US", false))"/>

    Adding F1 forces one tenth decimal place which in my case is enough. I was getting 422 error because PayPal does not allow for more than two decimal places, for some reason althogh the server was sending two decimal places number, the client kept rendering with three decimal units. the above will force the client to hold for one decimal place which is compatable with PayPal policies.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @moonch

    Thanks. Since it is a private repository, you need to add your GitHub user on https://aspnetzero.com/LicenseManagement. Then, you can access the link.

    For your second suggestion, we will also consider this, I have updated the GitHub issue.

  • User Avatar
    0
    moonch created

    Thanks Ismail, I added my self to the Asp zero GitHub account.

    Just a question, when do you think we could have your feedback on this issue, I see that you added this to v11.3 milestone.

    We have only activated PayPal as our only payment method for now, If this is delayed this would affect our ability to sell to customers. so this is some what urgent for us. so we appreciate your response on this issue as soon as possible.

    Thank you.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    I think the fix which we will apply will be very simple. Could you change the ConfirmPayment action as shown below ?

    [HttpPost]
    [UnitOfWork(IsDisabled = true)]
    public async Task<ActionResult> ConfirmPayment(long paymentId, string paypalOrderId)
    {
    	try
    	{
    		var returnUrl = await UnitOfWorkManager.WithUnitOfWorkAsync(async () =>
    		{
    			await _payPalPaymentAppService.ConfirmPayment(paymentId, paypalOrderId);
    			return await GetSuccessUrlAsync(paymentId);
    		});
    
    		return Redirect(returnUrl);
    	}
    	catch (Exception exception)
    	{
    		Logger.Error(exception.Message, exception);
    
    		var returnUrl = await UnitOfWorkManager.WithUnitOfWorkAsync(
    			async () => await GetErrorUrlAsync(paymentId)
    		);
    
    		return Redirect(returnUrl);
    	}
    }