-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #128 from wsmoak/add_payment_resource
Add resource for External Payments
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
$: << File.expand_path(File.dirname(__FILE__) + '/../lib') | ||
|
||
require "chargify_api_ares" | ||
|
||
Chargify.configure do |c| | ||
c.subdomain = ENV['CHARGIFY_SUBDOMAIN'] | ||
c.api_key = ENV['CHARGIFY_API_KEY'] | ||
end | ||
|
||
# Find a Chargify Subscription | ||
sub = Chargify::Subscription.find_by_customer_reference 'abc-123-def-456' | ||
|
||
# Record an external payment on the Chargify Subscription | ||
pmt = sub.payment( | ||
amount_in_cents: 2500, | ||
memo: "Pre-payment for..." | ||
) | ||
|
||
# Or, create the external payment directly: | ||
pmt = Chargify::Payment.create( | ||
subscription_id: sub.id, | ||
amount_in_cents: 2500, | ||
memo: "Pre-payment for..." | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Chargify | ||
class Payment < Base | ||
include ResponseHelper | ||
|
||
self.prefix = '/subscriptions/:subscription_id/' | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters