title: Golang Gin Redirect and Render a Template with New Variables
body: <p>I am trying to pass some variables after some processes on my <code>Handler</code> function. How can I <code>redirect</code> to a new page an pass some json variables to this new template?</p>
  
  <pre class="lang-golang prettyprint-override"><code>// main package
  func main() {
      apiRoutes := gin.Default()
      apiRoutes.POST("api/ipg/send", controllers.GatewayIpgSendHandler)
      apiRoutes.GET("ipg/:token", controllers.GatewayIpgRequestHandler)
  
      // ... rest of the codes
  }
  
  
  // controllers package
  func GatewayIpgRequestHandler(context *gin.Context) {
      // some processes that lead to these variables.
      wage := 123
      amount := 13123
      redirectUrl := "www.test.com/callback"
  
  
      // What should I do here to pass those
      // three variables above to an existing `custom-view.tmpl` file
      // in my `templates` folder.
  
  }
  </code></pre>
  
  <p><a href="https://laravel.com/docs/7.x/redirects#redirecting-with-flashed-session-data" rel="nofollow noreferrer">Here is the php(laravel) equivalent</a> of what I want to do.</p>