1
0
Fork 0
mirror of https://github.com/i1v/googleplay synced 2024-09-21 12:19:26 +00:00
googleplay/purchase.go
2023-02-06 18:32:42 -06:00

28 lines
642 B
Go

package googleplay
import (
"net/http"
"net/url"
"strings"
)
// Purchase app. Only needs to be done once per Google account.
func (h Header) Purchase(app string) error {
body := make(url.Values)
body.Set("doc", app)
req, err := http.NewRequest(
"POST", "https://android.clients.google.com/fdfe/purchase",
strings.NewReader(body.Encode()),
)
if err != nil {
return err
}
h.Set_Auth(req.Header)
h.Set_Device(req.Header)
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
res, err := Client.Do(req)
if err != nil {
return err
}
return res.Body.Close()
}