Class: CryptomateApi::Payment

Inherits:
Base
  • Object
show all
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.

Class Method Summary collapse

Class 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",



32
33
34
# File 'lib/cryptomate_api/payment.rb', line 32

def create_payments_request(token_address, amount, blockchain)
  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",



59
60
61
# File 'lib/cryptomate_api/payment.rb', line 59

def get_listed_tokens(blockchain)
  get("/commerce/payments/#{blockchain}/tokens")
end

.pending_paymentsObject

Returns all the pending payments. cryptomate.me/docs/payments#pending-payments Response: [

{
  "id": "String",
  "token_address": "String",
  "wallet_address": "String",
  "amount": "Decimal",
}

]



47
48
49
# File 'lib/cryptomate_api/payment.rb', line 47

def pending_payments
  get('/commerce/payments/list')
end