Vidrio payment server: creating charges

After creating the payment server for Vidrio, I need to get it to handle the Stripe charge request. To do so, I’m using the Stripe Go library.

Here’s a complete example of creating a charge using the Stripe Go library.

package main
import (
func main() {
  stripeClient := &client.API{}
  stripeClient.Init("SECRET_KEY", nil)
  chargeParams := &stripe.ChargeParams{
    Amount: 2000,
    Currency: "usd",
    Desc: "Some description",
  ch, err := stripeClient.Charges.New(chargeParams)
  if err != nil { panic(err) }
  fmt.Printf("OK, %#v\n", ch)

This is now integrated into the payment server. The server creates a Stripe charge based on the POST request from the client on the Vidrio purchase page.

Get updates on Twitter

More by Jim

Tagged . All content copyright James Fisher 2017. This post is not associated with my employer. Found an error? Edit this page.