Playground for https://github.com/zhutik/adyen-api-go library. Contains examples for different usages of library methods and setups
go get github.com/zhutik/adyen-api-go
- Authorize
- Authorize encrypted (default)
- Save Recurring Payment
- Recurring List (saved payment methods)
- Capture
- Cancel
- Refund
- Directory Lookup call
- Hosted Payment Pages redirect (HPP)
- Refund or Cancel
- Notifications
main.go
script will use those variables to communicate with API
$ export ADYEN_CLIENT_TOKEN="YOUR_ADYEN_CLIENT_TOKEN"
$ export ADYEN_USERNAME="YOUR_ADYEN_API_USERNAME"
$ export ADYEN_PASSWORD="YOUR_API_PASSWORD"
$ export ADYEN_ACCOUNT="YOUR_MERCHANT_ACCOUNT"
Or, modify .default.env.template
cp .default.env.template .default.env
# modify/change .default.env and put your credentials
source .default.env
Settings explanation:
- ADYEN_CLIENT_TOKEN - Library token in Adyen, used to load external JS file from Adyen to validate Credit Card information
- ADYEN_USERNAME - Adyen API username, usually starts with ws@
- ADYEN_PASSWORD - Adyen API password for username
- ADYEN_ACCOUNT - Selected Merchant Account
update your configuration and make sure you specify additional parameters
# API settings for Adyen Hosted Payment pages
$ export ADYEN_HMAC="YOUR_HMAC_KEY"
$ export ADYEN_SKINCODE="YOUR_SKINCODE_ID"
$ export ADYEN_SHOPPER_LOCALE="YOUR_SHOPPER_LOCALE"
Note: Expose your configuration first (as shown above)
$ docker-compose up
# or
$ docker-compose up -d
# or
$ docker run -p 8080:8080 -e ADYEN_USERNAME=${ADYEN_USERNAME} -e ADYEN_PASSWORD=${ADYEN_PASSWORD} -e ADYEN_CLIENT_TOKEN=${ADYEN_CLIENT_TOKEN} -e ADYEN_ACCOUNT=${ADYEN_ACCOUNT} -e ADYEN_HMAC=${ADYEN_HMAC} -e ADYEN_SKINCODE=${ADYEN_SKINCODE} -e ADYEN_SHOPPER_LOCALE=${ADYEN_SHOPPER_LOCALE} zhutik/adyen-api-go-example go run main.go
Open http://localhost:8080
in your browser
# Install dependencies
$ go get -d -v ./...
$ go install -v ./...
$ go run main.go
Open http://localhost:8080
in your browser
Put credit card information.
Test credit cards could be found https://docs.adyen.com/support/integration#testcardnumbers
Please check initial library repository https://github.com/zhutik/adyen-api-go