Total Lines | 39 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package main |
||
2 | |||
3 | import ( |
||
4 | "context" |
||
5 | "fmt" |
||
6 | "log" |
||
7 | |||
8 | "golang.org/x/oauth2" |
||
9 | |||
10 | "github.com/VictorAvelar/mollie-api-go/mollie" |
||
11 | "github.com/VictorAvelar/mollie-api-go/mollie/connect" |
||
12 | ) |
||
13 | |||
14 | func main() { |
||
15 | c := oauth2.Config{ |
||
16 | ClientID: "your client id", |
||
17 | ClientSecret: "your client secret", |
||
18 | Endpoint: connect.Endpoint, |
||
19 | } |
||
20 | secured := c.Client(context.TODO(), nil) |
||
21 | |||
22 | config := mollie.NewConfig(true, "") |
||
23 | |||
24 | client, err := mollie.NewClient(secured, config) |
||
25 | if err != nil { |
||
26 | log.Fatal(err) |
||
27 | } |
||
28 | |||
29 | output, err := client.Methods.List(nil) |
||
30 | if err != nil { |
||
31 | return |
||
32 | } |
||
33 | |||
34 | /* |
||
35 | Now you should see a list of the enabled payment methods for your |
||
36 | account. |
||
37 | */ |
||
38 | for _, o := range output.Embedded.Methods { |
||
39 | fmt.Printf("Id: %s | Name: %s", o.ID, o.Description) |
||
40 | } |
||
42 |