Method: Creatary::API.charge_by_code
- Defined in:
- lib/creatary/api/charging.rb
.charge_by_code(user, code) ⇒ Hash
Requests for charging or payment to the subscriber account in the operator billing system byt charging code.
26 27 28 29 30 31 32 33 34 |
# File 'lib/creatary/api/charging.rb', line 26 def self.charge_by_code(user, code) begin payload = JSON.generate({'method' => 'CODE', 'charging_code' => code.to_s}) response = dispatch_to_server(:post, '/api/1/charge/request', user, payload) JSON.parse response rescue Creatary::ServiceUnavailable raise Creatary::ServiceUnavailable.new 'The charging service is not available. If you are using the service on a persona, i.e.: through the sandbox, then remember to set the balance of that persona' end end |