opsdisk/pygumroad

Gumroad Ping

Closed this issue · 3 comments

Hi! Any shot of this getting updated to include Gumroad Ping and the resource subscriptions part of the API call so it can wait for a new sale and act based upon the HTTP POST request for a new sale?
https://app.gumroad.com/api#resource-subscriptions

Hi @EposVox - thanks for taking the time to submit an issue. I haven't used that endpoint before. Reading the docs, it doesn't look too complicated. Is it basically configuring a resource subscription to call back to a web hook URL? You can add this snippet and see if it works for you...note I haven't tested it though.

def subscribe_to_a_resource(self, resource_name, post_url):
    """Subscribe to a resource. Currently there are 8 supported resource names - "sale", "refund", "dispute", "dispute_won", "cancellation", "subscription_updated", "subscription_ended", and "subscription_restarted"."""

    payload = {
        "resource_name": resource_name,
        "post_url": post_url,
    }

    response = self.api_query("/v2/resource_subscriptions", method="PUT", payload=payload)

    json_response = response.json()

    return json_response

Were you ever able to test this @EposVox ?

Closing this out.