Class: CryptomateApi::Payment
- Defined in:
- lib/cryptomate_api/payment.rb
Overview
Once the customer has completed the payment, you will receive a webhook notification (configurable in Management API). This notification will contain the status of the payment.
Instance Method Summary collapse
-
#create_payments_request(token_address, amount, blockchain) ⇒ Object
Creates a new payment request.
-
#get_listed_tokens(blockchain) ⇒ Object
Retrieves all the listed tokens to create payments.
-
#pending_payments ⇒ Object
Returns all the pending payments.
Methods inherited from Base
Constructor Details
This class inherits a constructor from CryptomateApi::Base
Instance Method Details
#create_payments_request(token_address, amount, blockchain) ⇒ Object
Creates a new payment request. cryptomate.me/docs/payments#create-payments-request Response:
"id": "String",
"token_address": "String",
"wallet_address": "String",
"amount": "Decimal",
31 32 33 |
# File 'lib/cryptomate_api/payment.rb', line 31 def create_payments_request(token_address, amount, blockchain) self.class.post('/commerce/payments/create', body: { token_address:, amount:, blockchain: }.to_json) end |
#get_listed_tokens(blockchain) ⇒ Object
Retrieves all the listed tokens to create payments. In the response you will see the token name and it’s address on the blockchain. cryptomate.me/docs/payments#get-listed-tokens Response:
"Token name 1": "String",
"Token name 2": "String",
58 59 60 |
# File 'lib/cryptomate_api/payment.rb', line 58 def get_listed_tokens(blockchain) self.class.get("/commerce/payments/#{blockchain}/tokens") end |
#pending_payments ⇒ Object
Returns all the pending payments. cryptomate.me/docs/payments#pending-payments Response: [
{
"id": "String",
"token_address": "String",
"wallet_address": "String",
"amount": "Decimal",
}
]
46 47 48 |
# File 'lib/cryptomate_api/payment.rb', line 46 def pending_payments self.class.get('/commerce/payments/list') end |