forked from Mirrors/go-iap
Added a function to revoke subscription
This commit is contained in:
@@ -92,7 +92,8 @@ func (c *Client) CancelSubscription(packageName string, subscriptionID string, t
|
||||
return err
|
||||
}
|
||||
|
||||
// RefundSubscription refunds a user's subscription purchase.
|
||||
// RefundSubscription refunds a user's subscription purchase, but the subscription remains valid
|
||||
// until its expiration time and it will continue to recur.
|
||||
func (c *Client) RefundSubscription(packageName string, subscriptionID string, token string) error {
|
||||
service, err := androidpublisher.New(c.httpClient)
|
||||
if err != nil {
|
||||
@@ -104,3 +105,17 @@ func (c *Client) RefundSubscription(packageName string, subscriptionID string, t
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
// RevokeSubscription refunds and immediately revokes a user's subscription purchase.
|
||||
// Access to the subscription will be terminated immediately and it will stop recurring.
|
||||
func (c *Client) RevokeSubscription(packageName string, subscriptionID string, token string) error {
|
||||
service, err := androidpublisher.New(c.httpClient)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
ps := androidpublisher.NewPurchasesSubscriptionsService(service)
|
||||
err = ps.Revoke(packageName, subscriptionID, token).Do()
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user