{"action":"closed","number":146,"pull_request":{"url":"https://api.github.com/repos/peterkeen/payola/pulls/146","id":40166740,"html_url":"https://github.com/peterkeen/payola/pull/146","diff_url":"https://github.com/peterkeen/payola/pull/146.diff","patch_url":"https://github.com/peterkeen/payola/pull/146.patch","issue_url":"https://api.github.com/repos/peterkeen/payola/issues/146","number":146,"state":"closed","locked":false,"title":"Support for canceling subscription at period end","user":{"login":"jharbert","id":753580,"avatar_url":"https://avatars.githubusercontent.com/u/753580?v=3","gravatar_id":"","url":"https://api.github.com/users/jharbert","html_url":"https://github.com/jharbert","followers_url":"https://api.github.com/users/jharbert/followers","following_url":"https://api.github.com/users/jharbert/following{/other_user}","gists_url":"https://api.github.com/users/jharbert/gists{/gist_id}","starred_url":"https://api.github.com/users/jharbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jharbert/subscriptions","organizations_url":"https://api.github.com/users/jharbert/orgs","repos_url":"https://api.github.com/users/jharbert/repos","events_url":"https://api.github.com/users/jharbert/events{/privacy}","received_events_url":"https://api.github.com/users/jharbert/received_events","type":"User","site_admin":false},"body":"This change allows us to pass the `at_period_end` argument to Stripe that signifies that the subscription is to remain active until the end of the subscription period.\r\n\r\n```ruby\r\nPayola::CancelSubscription.call(subscription, { at_period_end: true })\r\n```\r\n\r\nI'm skipping over the `subscription.cancel!` call if this argument exists, so in order to cancel the subscription the user must monitor for the `customer.subscription.deleted` webhook that Stripe will send upon subscription cancelation:\r\n\r\n```ruby\r\nconfig.subscribe 'customer.subscription.deleted' do |event|\r\n  subscription = Subscription.find_by(stripe_id: event.data.object.id)\r\n  subscription.cancel!\r\nend \r\n```\r\n\r\nPlease let me know if this is kosher or if you'd like this handled in a different manner.  Thanks!","created_at":"2015-07-16T19:34:11Z","updated_at":"2015-07-16T23:44:11Z","closed_at":"2015-07-16T23:44:11Z","merged_at":"2015-07-16T23:44:11Z","merge_commit_sha":"935b779cc38b5a7df46a6ae26ace1733376684d1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/peterkeen/payola/pulls/146/commits","review_comments_url":"https://api.github.com/repos/peterkeen/payola/pulls/146/comments","review_comment_url":"https://api.github.com/repos/peterkeen/payola/pulls/comments{/number}","comments_url":"https://api.github.com/repos/peterkeen/payola/issues/146/comments","statuses_url":"https://api.github.com/repos/peterkeen/payola/statuses/f081e50edf0863e1a77540575f5b9baf63e48bd9","head":{"label":"jharbert:master","ref":"master","sha":"f081e50edf0863e1a77540575f5b9baf63e48bd9","user":{"login":"jharbert","id":753580,"avatar_url":"https://avatars.githubusercontent.com/u/753580?v=3","gravatar_id":"","url":"https://api.github.com/users/jharbert","html_url":"https://github.com/jharbert","followers_url":"https://api.github.com/users/jharbert/followers","following_url":"https://api.github.com/users/jharbert/following{/other_user}","gists_url":"https://api.github.com/users/jharbert/gists{/gist_id}","starred_url":"https://api.github.com/users/jharbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jharbert/subscriptions","organizations_url":"https://api.github.com/users/jharbert/orgs","repos_url":"https://api.github.com/users/jharbert/repos","events_url":"https://api.github.com/users/jharbert/events{/privacy}","received_events_url":"https://api.github.com/users/jharbert/received_events","type":"User","site_admin":false},"repo":{"id":39149224,"name":"payola","full_name":"jharbert/payola","owner":{"login":"jharbert","id":753580,"avatar_url":"https://avatars.githubusercontent.com/u/753580?v=3","gravatar_id":"","url":"https://api.github.com/users/jharbert","html_url":"https://github.com/jharbert","followers_url":"https://api.github.com/users/jharbert/followers","following_url":"https://api.github.com/users/jharbert/following{/other_user}","gists_url":"https://api.github.com/users/jharbert/gists{/gist_id}","starred_url":"https://api.github.com/users/jharbert/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jharbert/subscriptions","organizations_url":"https://api.github.com/users/jharbert/orgs","repos_url":"https://api.github.com/users/jharbert/repos","events_url":"https://api.github.com/users/jharbert/events{/privacy}","received_events_url":"https://api.github.com/users/jharbert/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jharbert/payola","description":"Drop-in Rails engine for accepting payments with Stripe","fork":true,"url":"https://api.github.com/repos/jharbert/payola","forks_url":"https://api.github.com/repos/jharbert/payola/forks","keys_url":"https://api.github.com/repos/jharbert/payola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jharbert/payola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jharbert/payola/teams","hooks_url":"https://api.github.com/repos/jharbert/payola/hooks","issue_events_url":"https://api.github.com/repos/jharbert/payola/issues/events{/number}","events_url":"https://api.github.com/repos/jharbert/payola/events","assignees_url":"https://api.github.com/repos/jharbert/payola/assignees{/user}","branches_url":"https://api.github.com/repos/jharbert/payola/branches{/branch}","tags_url":"https://api.github.com/repos/jharbert/payola/tags","blobs_url":"https://api.github.com/repos/jharbert/payola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jharbert/payola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jharbert/payola/git/refs{/sha}","trees_url":"https://api.github.com/repos/jharbert/payola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jharbert/payola/statuses/{sha}","languages_url":"https://api.github.com/repos/jharbert/payola/languages","stargazers_url":"https://api.github.com/repos/jharbert/payola/stargazers","contributors_url":"https://api.github.com/repos/jharbert/payola/contributors","subscribers_url":"https://api.github.com/repos/jharbert/payola/subscribers","subscription_url":"https://api.github.com/repos/jharbert/payola/subscription","commits_url":"https://api.github.com/repos/jharbert/payola/commits{/sha}","git_commits_url":"https://api.github.com/repos/jharbert/payola/git/commits{/sha}","comments_url":"https://api.github.com/repos/jharbert/payola/comments{/number}","issue_comment_url":"https://api.github.com/repos/jharbert/payola/issues/comments{/number}","contents_url":"https://api.github.com/repos/jharbert/payola/contents/{+path}","compare_url":"https://api.github.com/repos/jharbert/payola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jharbert/payola/merges","archive_url":"https://api.github.com/repos/jharbert/payola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jharbert/payola/downloads","issues_url":"https://api.github.com/repos/jharbert/payola/issues{/number}","pulls_url":"https://api.github.com/repos/jharbert/payola/pulls{/number}","milestones_url":"https://api.github.com/repos/jharbert/payola/milestones{/number}","notifications_url":"https://api.github.com/repos/jharbert/payola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jharbert/payola/labels{/name}","releases_url":"https://api.github.com/repos/jharbert/payola/releases{/id}","created_at":"2015-07-15T16:56:03Z","updated_at":"2015-07-15T16:56:03Z","pushed_at":"2015-07-16T17:14:39Z","git_url":"git://github.com/jharbert/payola.git","ssh_url":"git@github.com:jharbert/payola.git","clone_url":"https://github.com/jharbert/payola.git","svn_url":"https://github.com/jharbert/payola","homepage":"http://www.payola.io","size":1843,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"peterkeen:master","ref":"master","sha":"6d8497c11feace8831c9721db03679cea5d332fd","user":{"login":"peterkeen","id":13977,"avatar_url":"https://avatars.githubusercontent.com/u/13977?v=3","gravatar_id":"","url":"https://api.github.com/users/peterkeen","html_url":"https://github.com/peterkeen","followers_url":"https://api.github.com/users/peterkeen/followers","following_url":"https://api.github.com/users/peterkeen/following{/other_user}","gists_url":"https://api.github.com/users/peterkeen/gists{/gist_id}","starred_url":"https://api.github.com/users/peterkeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterkeen/subscriptions","organizations_url":"https://api.github.com/users/peterkeen/orgs","repos_url":"https://api.github.com/users/peterkeen/repos","events_url":"https://api.github.com/users/peterkeen/events{/privacy}","received_events_url":"https://api.github.com/users/peterkeen/received_events","type":"User","site_admin":false},"repo":{"id":24691293,"name":"payola","full_name":"peterkeen/payola","owner":{"login":"peterkeen","id":13977,"avatar_url":"https://avatars.githubusercontent.com/u/13977?v=3","gravatar_id":"","url":"https://api.github.com/users/peterkeen","html_url":"https://github.com/peterkeen","followers_url":"https://api.github.com/users/peterkeen/followers","following_url":"https://api.github.com/users/peterkeen/following{/other_user}","gists_url":"https://api.github.com/users/peterkeen/gists{/gist_id}","starred_url":"https://api.github.com/users/peterkeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterkeen/subscriptions","organizations_url":"https://api.github.com/users/peterkeen/orgs","repos_url":"https://api.github.com/users/peterkeen/repos","events_url":"https://api.github.com/users/peterkeen/events{/privacy}","received_events_url":"https://api.github.com/users/peterkeen/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peterkeen/payola","description":"Drop-in Rails engine for accepting payments with Stripe","fork":false,"url":"https://api.github.com/repos/peterkeen/payola","forks_url":"https://api.github.com/repos/peterkeen/payola/forks","keys_url":"https://api.github.com/repos/peterkeen/payola/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peterkeen/payola/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peterkeen/payola/teams","hooks_url":"https://api.github.com/repos/peterkeen/payola/hooks","issue_events_url":"https://api.github.com/repos/peterkeen/payola/issues/events{/number}","events_url":"https://api.github.com/repos/peterkeen/payola/events","assignees_url":"https://api.github.com/repos/peterkeen/payola/assignees{/user}","branches_url":"https://api.github.com/repos/peterkeen/payola/branches{/branch}","tags_url":"https://api.github.com/repos/peterkeen/payola/tags","blobs_url":"https://api.github.com/repos/peterkeen/payola/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peterkeen/payola/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peterkeen/payola/git/refs{/sha}","trees_url":"https://api.github.com/repos/peterkeen/payola/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peterkeen/payola/statuses/{sha}","languages_url":"https://api.github.com/repos/peterkeen/payola/languages","stargazers_url":"https://api.github.com/repos/peterkeen/payola/stargazers","contributors_url":"https://api.github.com/repos/peterkeen/payola/contributors","subscribers_url":"https://api.github.com/repos/peterkeen/payola/subscribers","subscription_url":"https://api.github.com/repos/peterkeen/payola/subscription","commits_url":"https://api.github.com/repos/peterkeen/payola/commits{/sha}","git_commits_url":"https://api.github.com/repos/peterkeen/payola/git/commits{/sha}","comments_url":"https://api.github.com/repos/peterkeen/payola/comments{/number}","issue_comment_url":"https://api.github.com/repos/peterkeen/payola/issues/comments{/number}","contents_url":"https://api.github.com/repos/peterkeen/payola/contents/{+path}","compare_url":"https://api.github.com/repos/peterkeen/payola/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peterkeen/payola/merges","archive_url":"https://api.github.com/repos/peterkeen/payola/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peterkeen/payola/downloads","issues_url":"https://api.github.com/repos/peterkeen/payola/issues{/number}","pulls_url":"https://api.github.com/repos/peterkeen/payola/pulls{/number}","milestones_url":"https://api.github.com/repos/peterkeen/payola/milestones{/number}","notifications_url":"https://api.github.com/repos/peterkeen/payola/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peterkeen/payola/labels{/name}","releases_url":"https://api.github.com/repos/peterkeen/payola/releases{/id}","created_at":"2014-10-01T19:00:40Z","updated_at":"2015-07-16T16:07:14Z","pushed_at":"2015-07-16T23:44:12Z","git_url":"git://github.com/peterkeen/payola.git","ssh_url":"git@github.com:peterkeen/payola.git","clone_url":"https://github.com/peterkeen/payola.git","svn_url":"https://github.com/peterkeen/payola","homepage":"http://www.payola.io","size":1843,"stargazers_count":569,"watchers_count":569,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":53,"mirror_url":null,"open_issues_count":25,"forks":53,"open_issues":25,"watchers":569,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/peterkeen/payola/pulls/146"},"html":{"href":"https://github.com/peterkeen/payola/pull/146"},"issue":{"href":"https://api.github.com/repos/peterkeen/payola/issues/146"},"comments":{"href":"https://api.github.com/repos/peterkeen/payola/issues/146/comments"},"review_comments":{"href":"https://api.github.com/repos/peterkeen/payola/pulls/146/comments"},"review_comment":{"href":"https://api.github.com/repos/peterkeen/payola/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/peterkeen/payola/pulls/146/commits"},"statuses":{"href":"https://api.github.com/repos/peterkeen/payola/statuses/f081e50edf0863e1a77540575f5b9baf63e48bd9"}},"merged":true,"mergeable":null,"mergeable_state":"unknown","merged_by":{"login":"peterkeen","id":13977,"avatar_url":"https://avatars.githubusercontent.com/u/13977?v=3","gravatar_id":"","url":"https://api.github.com/users/peterkeen","html_url":"https://github.com/peterkeen","followers_url":"https://api.github.com/users/peterkeen/followers","following_url":"https://api.github.com/users/peterkeen/following{/other_user}","gists_url":"https://api.github.com/users/peterkeen/gists{/gist_id}","starred_url":"https://api.github.com/users/peterkeen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterkeen/subscriptions","organizations_url":"https://api.github.com/users/peterkeen/orgs","repos_url":"https://api.github.com/users/peterkeen/repos","events_url":"https://api.github.com/users/peterkeen/events{/privacy}","received_events_url":"https://api.github.com/users/peterkeen/received_events","type":"User","site_admin":false},"comments":1,"review_comments":0,"commits":1,"additions":6,"deletions":3,"changed_files":1}}