1

I'm using Skrill payment method in my asp.net web application.

When clicked on booking button it redirects to the Skrill for payments as:

protected void btnBook_Click(object sender, EventArgs e)
{
    // Mastercard   5438311234567890
    // Visa         4000001234567890
    // Amex         371234500012340

    string url = "https://pay.skrill.com/?";

    // Merchant Details
    url += "pay_to_email=" + "demoqco@sun-fish.com";
    url += "&recipient_description=" + "Banquet Halls Booking System";
    url += "&language=" + "EN";
    url += "&status_url=" + "";

    // Customer Details
    url += "&country=" + "Pakistan";

    // Payment Details
    url += "&amount=" + string.Format("{0:0.00}", (double.Parse(lblGrandTotal.Text) / 110.00));
    url += "&currency=" + "USD";
    url += "&amount2_description=" + Persons.Text + ":";
    url += "&amount2=" + lblPersons.Text;
    url += "&amount3_description=" + PerHeadRate.Text + ":";
    url += "&amount3=" + lblPerHeadRate.Text;
    url += "&amount4_description=" + Tax.Text + ":";
    url += "&amount4=" + lblTax.Text + "%";
    url += "&detail1_description=" + "Booking ID:";
    url += "&detail1_text=" + objDLBkg.SelectLastBkID();
    url += "&detail2_description=" + "Description:";
    url += "&detail2_text=" + "View all bookings in your Account.";
    url += "&detail3_description=" + "Banquet Hall:";
    url += "&detail3_text=" + lblBqtName.Text;
    url += "&detail4_description=" + "Booking Date:";
    url += "&detail4_text=" + DateTime.Now.Date.ToString("MM/dd/yyyy");

    // Split Gateway
    url += "&payment_methods=" + "WLT,ACC";

    Response.Redirect(url);
}

And shows error on redirect to Skrill:

JBWEB000065: HTTP Status 400 -


JBWEB000309: type JBWEB000067: Status report
JBWEB000068: message
JBWEB000069: description JBWEB000120: The request sent by the client was syntactically incorrect.


JBoss Web/7.5.9.Final-redhat-1

How I can solve it? Where I'm wrong?

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 2
    Not every character is valid in literal form in query string, some need to be escaped, and you don't do any escaping. – Evk Dec 21 '17 at 08:58

2 Answers2

0

Try to encode your querystring parameters to escape special characters, an example of how to do that are available in answer HERE :

string url = string.Format("https://yourdomain.com/api/add?t={0}&mac={1}&portName={2}&name={3}&location={4}&description={5}&comment={6}",
            HttpUtility.UrlEncode(appToken),
            HttpUtility.UrlEncode(macAddress),
            HttpUtility.UrlEncode(PortName),
            HttpUtility.UrlEncode(name),
            HttpUtility.UrlEncode(Location),
            HttpUtility.UrlEncode(description),
            HttpUtility.UrlEncode(Comment));

And similar error is reported here: JBWEB000069

Frix33
  • 1,231
  • 10
  • 27
0

I've figured out that there is a special character % used in my redirect server-URL that's caused the error here:

url += "&amount4=" + lblTax.Text + "%";

Just removed % character from URL and it worked.