Payment of an arbitrary amount

If it is necessary to enable the buyers to specify the amount of payment themselves (e.g. to top up their accounts or make donations), you can place a form with the amount input field on your website. You can also specify the amount which will be offered in this form by default.

The code generating the request to ROBOKASSA needs to be placed at the payment page of the Merchant's website. ROBOKASSA will return the html code of the form (see below) in response to this request.

Top up my account

Code samples:

using System; using System.Text; using System.Globalization; using System.Security.Cryptography; public partial class Init : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // регистрационная информация (логин, пароль #1) // registration info (login, password #1) string sMrchLogin = "demo"; string sMrchPass1 = "password_1"; // номер заказа // number of order int nInvId = 0; // описание заказа // order description string sDesc = "Пополнение счета ROBOKASSA"; // сумма по умолчания в форме ввода // default sum string sDefaultSum = "10"; // тип товара // code of goods string sShpItem = "2"; // язык // language string sCulture = "en"; // кодировка // encoding string sEncoding = "utf-8"; // формирование подписи // generate signature string sCrcBase = string.Format("{0}::{1}:{2}:shp_Item={3}", sMrchLogin, nInvId, sMrchPass1, sShpItem); MD5CryptoServiceProvider md5 = new MD5CryptoServiceProvider(); byte[] bSignature = md5.ComputeHash(Encoding.UTF8.GetBytes(sCrcBase)); StringBuilder sbSignature = new StringBuilder(); foreach (byte b in bSignature) sbSignature.AppendFormat("{0:x2}", b); string sCrc = sbSignature.ToString(); // HTML-страница с кассой // ROBOKASSA HTML-page // ltKassa is System.Web.UI.WebControls.Literal; ltKassa.Text = "<script language=JavaScript " + "src=\"https://auth.robokassa.ru/Merchant/PaymentForm/FormFLS.js?" + "MerchantLogin=" + sMrchLogin + "&DefaultSum=" + sDefaultSum + "&InvoiceID=" + nInvId + "&shp_Item=" + sShpItem + "&SignatureValue=" + sCrc + "&Description=" + sDesc + "&Culture=" + sCulture + "&Encoding=" + sEncoding + "\"></script>"; } }

Parameters:

  • MerchantLogin - merchant login in ROBOKASSA service/registration;
  • OutSum - the order price in the currency the Merchant has chosen through the administrative interface;
  • DefaultSum - the amount displayed in the form by default;
  • InvoiceID - number of Order;
  • Description - order description;
  • Culture - the language used by the customer;
  • Encoding - HTML-code encoding returned by JavaScript;
  • SignatureValue - MD5 signature;
  • shp_Item - user parameter;
See our documentation to learn more about these parameters.
Задать вопрос