protected void Page_Load(object sender, EventArgs e) { try { int projectId = 0; string signPassword = "******"; Client client = new Client(projectId, signPassword); // This throws if callback didn't came from us MacroCallbackData data = client.GetMacroCallbackData(Request.Params); // See documentation for additional status codes if (data.Status == 1) { // Payment was successful, here you should proceed with providing service to an user } else { throw new NotImplementedException("Unexpected status"); } MacroCallbackResponse response = new MacroCallbackResponse(MacroCallbackResponseStatus.Ok); Response.Write(response.ToString()); } catch (Exception ex) { throw; } }
protected void ButtonCreateMacroPayment_Click(object sender, EventArgs e) { // This is used to make a request try { string siteUrl = Request.Url.GetLeftPart(UriPartial.Authority); int projectId = 0; string signPassword = "******"; Client client = new Client(projectId, signPassword); // Make a new request MacroRequest request = client.NewMacroRequest(); // Should be saved somewhere and unique for every request. request.OrderId = "ORDER0001"; request.Amount = 1000; request.Currency = "EUR"; request.Country = "LT"; request.AcceptUrl = siteUrl + "/Accept.aspx"; request.CancelUrl = siteUrl + "/Cancel.aspx"; request.CallbackUrl = siteUrl + "/MacroCallback.aspx"; // Change this to "true" if you want to test request.Test = false; string redirectUrl = client.BuildRequestUrl(request); Response.Redirect(redirectUrl); } catch (Exception ex) { this.LabelErrorMessage.Visible = true; } }
protected void ButtonRepeatMacroPayment_Click(object sender, EventArgs e) { try { string siteUrl = Request.Url.GetLeftPart(UriPartial.Authority); int projectId = 0; string signPassword = "******"; Client client = new Client(projectId, signPassword); // Change this to unique OrderId which should be saved on your system string orderId = "ORDER0001"; string redirectUrl = client.BuildRepeatRequestUrl(orderId); Response.Redirect(redirectUrl); } catch (Exception ex) { this.LabelErrorMessage.Visible = true; } }
protected void ButtonSendMicroAnswer_Click(object sender, EventArgs e) { // This is used when your system didn't respond in time (after several repeated callbacks) // and no answer has been provided to our side (i.e. "OK Your account has been filled. Thank you!") try { int projectId = 0; string signPassword = "******"; Client client = new Client(projectId, signPassword); MicroAnswer microAnswer = client.NewMicroAnswer(); microAnswer.SmsId = 1; microAnswer.Message = "Your account has been filled. Thank you!"; client.SendMicroAnswer(microAnswer); } catch (Exception ex) { throw; } }
protected void Page_Load(object sender, EventArgs e) { try { int projectId = 0; string signPassword = "******"; Client client = new Client(projectId, signPassword); // This throws if callback didn't came from us ICallbackData data = client.GetMicroCallbackData(Request.Params); // Callback identity check passed and here you can provide services below MicroCallbackResponse response = new MicroCallbackResponse(MicroCallbackResponseStatus.Ok, "Thank you!"); Response.Write(response.ToString()); } catch (Exception ex) { throw; } }