aboutsummaryrefslogtreecommitdiffstats
path: root/purchase/purchase.go
blob: 45940f256c2249852c3d018bb363699e2fc136d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package purchase

import (
	"github.com/teddywing/new-house-on-the-block/vendor/_nuts/github.com/fabioberger/coinbase-go"
)

func SendMoney(from_key string, from_secret string,
		to string, amount string) (transaction_id string, err error) {
	c := coinbase.ApiKeyClientSandbox(from_key, from_secret)

	params := &coinbase.TransactionParams{
		To:     to,
		Amount: amount,
		Notes:  "You just bought a house",
	}

	confirmation, err := c.SendMoney(params)
	if err != nil {
		return "", err
	} else {
		return confirmation.Transaction.Id, nil
	}
}