DEV Community

manuel
manuel

Posted on • Originally published at defer.cc on

A Simple PAYONE Integration in Golang

If you want to process payments with Payone, here is a simple package.

How to use it #

import "https://github.com/mnlwldr/payone"
Enter fullscreen mode Exit fullscreen mode

Usage #

response, err := sendRequest(parameters)
Enter fullscreen mode Exit fullscreen mode

Parameters #

You can find the documentation for PAYONE here

parameters := url.Values{}
// classic payone accoint informations.
parameters.Set("aid", "")
parameters.Set("mid", "")
parameters.Set("portalid", "")
parameters.Set("key", "") // the key has to be hashed as md5
parameters.Set("mode", "test") // can be "live" for actual transactions
parameters.Set("api_version", "3.8")
parameters.Set("encoding", "UTF-8")
// payment type parameters
parameters.Set("clearingtype", "wlt")
parameters.Set("wallettype", "PPE")
parameters.Set("request", "authorization")
parameters.Set("narrative_text", "Just a test")
parameters.Set("reference", fmt.Sprintf("%d", rand.Intn(100)))
parameters.Set("currency", "EUR")
parameters.Set("amount", "1234") // in cent
parameters.Set("successurl", "https://example.com/success")
parameters.Set("errorurl", "https://example.com/error")
parameters.Set("backurl", "https://example.com/back")
// personal data. Not everything is mandatory
parameters.Set("salutation", "Frau")
parameters.Set("title", "")
parameters.Set("firstname", "Maraike")
parameters.Set("lastname", "Musterfrau")
parameters.Set("street", "Musterstrasse")
parameters.Set("zip", "12345")
parameters.Set("city", "Somewhere over the rainbow")
parameters.Set("country", "DE")
parameters.Set("email", "maraike.musterfrau@example.com")
parameters.Set("language", "de")
parameters.Set("gender", "f")
Enter fullscreen mode Exit fullscreen mode

Response #

type Response struct {
   Status string
   TxId string
   UserId string
   RedirectUrl string
   Token string
}
Enter fullscreen mode Exit fullscreen mode

Go Reference

AWS GenAI LIVE image

Real challenges. Real solutions. Real talk.

From technical discussions to philosophical debates, AWS and AWS Partners examine the impact and evolution of gen AI.

Learn more

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay