Share via

Payment button works everywhere except in Iraq

engcanada 46 Reputation points
2023-07-04T16:46:38.1266667+00:00

Hi,

The following code work everywhere except for victors in Iraq:


             $(document).ready(function () {
                  $("#checkout-stripe").click(function () {
                    var movie = new Object();
                    movie.UnitPrice = @vblplan;
                    movie.Description = '@Html.Raw(vblplantype)';
                    movie.Successit = location.protocol + "//" + location.host + "/shared/thankyou?redirect_status=$@Html.Raw(vblplan +"("+ vblplantype +")")";
                    movie.Cancelit = "@strQueryString";
                    $.ajax({
                        url: '/api/StripePayment',
                        type: 'POST',
                        //dataType: 'json',
                        data: movie,
                        success: function (data, textStatus, xhr) {
                            window.location.href = data.SessionUrl;
                        },
                        error: function (xhr, textStatus, errorThrown) {
                            console.log('Error in Operation');
                        }
                    });
                });
             });



              <button type="button" class="btn btn-primary mt-1 mb-1 px-4" id="checkout-stripe">
                  Credit Card or Debit
              </button>







    public IHttpActionResult Post(StripeData stripeData)
    {
        var options = new SessionCreateOptions
        {
            LineItems = new List<SessionLineItemOptions>
            {
              new SessionLineItemOptions
              {
                PriceData = new SessionLineItemPriceDataOptions
                {
                  UnitAmount = stripeData.UnitPrice * 100,
                  Currency = "usd",
                  ProductData = new SessionLineItemPriceDataProductDataOptions
                  {
                    Name = stripeData.Description,
                  },
                },
                 AdjustableQuantity = new SessionLineItemAdjustableQuantityOptions
                {
                  Enabled = true,
                  Minimum = 1,
                  Maximum = 3,
                },
                Quantity = 1,
              },
            },
            Mode = "payment",
            SuccessUrl = stripeData.Successit,
            CancelUrl = stripeData.Cancelit,
           // CustomerEmail = stripeData.Customeremail,
        };
        var service = new SessionService();
        Session session = service.Create(options);

        HttpContext.Current.Response.Headers.Add("Location", session.Url);
        return Json(new { SessionUrl = session.Url });
    }
Developer technologies | .NET | Other
Developer technologies | ASP.NET Core | Other
0 comments No comments

2 answers

Sort by: Most helpful
  1. engcanada 46 Reputation points
    2023-07-05T18:16:19.78+00:00

    Thank you,

    Again, I have no issue navigating and clicking on the payment button from our locations in the US as well Canada and others so I cannot check my browser for errors since there are no issues. It is only our customers/visitors located in Iraq that complain about this and since I am not located there therefore I cannot check it. Unless there is another way of doing this from my end that I am not aware of.

    It is mind boggling!

    Regards

    Was this answer helpful?

    0 comments No comments

  2. Sreeju Nair 12,761 Reputation points
    2023-07-04T17:20:03.0633333+00:00

    Thank you for posting the query. Based on the code you shared, you have a button and a jQuery event handler that post the data to an API. I believe this part is working fine, is that assumption correct? You may use browser developer tools to see whether the button click event is correctly executed and the page is posted back to through Ajax.

    Now once the data is posted back, it seems you are using the Stripe Payment APIs to make the payment, and I guess you are facing a problem in the API call to Stripe, if this is correct, then there might be restrictions in Stripe Payment API that prevent the payment request based on some rules.

    Stripe uses Radar to protect the payments from Fraud. You may identify the restrictions from the Radar page of Stripe.

    https://stripe.com/docs/radar

    https://support.stripe.com/questions/block-a-card-based-on-location-using-radar

    So check your account whether there any restrictions enabled, otherwise, contact stripe support to look into your specific issue.

    Hope this helps.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.