Class: Telnyx::Resources::X402::CreditAccount
- Inherits:
-
Object
- Object
- Telnyx::Resources::X402::CreditAccount
- Defined in:
- lib/telnyx/resources/x402/credit_account.rb
Overview
Operations for x402 cryptocurrency payment transactions. Fund your Telnyx account using USDC stablecoin payments via the x402 protocol.
Instance Method Summary collapse
-
#create_quote(amount_usd:, request_options: {}) ⇒ Telnyx::Models::X402::CreditAccountCreateQuoteResponse
Creates a payment quote for the specified USD amount.
-
#initialize(client:) ⇒ CreditAccount
constructor
private
A new instance of CreditAccount.
-
#settle(id:, payment_signature: nil, header_payment_signature: nil, request_options: {}) ⇒ Telnyx::Models::X402::CreditAccountSettleResponse
Some parameter documentations has been truncated, see Models::X402::CreditAccountSettleParams for more details.
Constructor Details
#initialize(client:) ⇒ CreditAccount
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CreditAccount.
70 71 72 |
# File 'lib/telnyx/resources/x402/credit_account.rb', line 70 def initialize(client:) @client = client end |
Instance Method Details
#create_quote(amount_usd:, request_options: {}) ⇒ Telnyx::Models::X402::CreditAccountCreateQuoteResponse
Creates a payment quote for the specified USD amount. Returns payment details including the x402 payment requirements, network, and expiration time. The quote must be settled before it expires.
22 23 24 25 26 27 28 29 30 31 |
# File 'lib/telnyx/resources/x402/credit_account.rb', line 22 def create_quote(params) parsed, = Telnyx::X402::CreditAccountCreateQuoteParams.dump_request(params) @client.request( method: :post, path: "v2/x402/credit_account/quote", body: parsed, model: Telnyx::Models::X402::CreditAccountCreateQuoteResponse, options: ) end |
#settle(id:, payment_signature: nil, header_payment_signature: nil, request_options: {}) ⇒ Telnyx::Models::X402::CreditAccountSettleResponse
Some parameter documentations has been truncated, see Models::X402::CreditAccountSettleParams for more details.
Settles an x402 payment using the quote ID and a signed payment authorization. The payment signature can be provided via the ‘PAYMENT-SIGNATURE` header or the `payment_signature` body parameter. Settlement is idempotent — submitting the same quote ID multiple times returns the existing transaction.
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/telnyx/resources/x402/credit_account.rb', line 54 def settle(params) parsed, = Telnyx::X402::CreditAccountSettleParams.dump_request(params) header_params = {header_payment_signature: "payment-signature"} @client.request( method: :post, path: "v2/x402/credit_account", headers: parsed.slice(*header_params.keys).transform_keys(header_params), body: parsed.except(*header_params.keys), model: Telnyx::Models::X402::CreditAccountSettleResponse, options: ) end |