Class: DevDraftAI::PaymentIntentsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/devdraft/api/payment_intents_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PaymentIntentsApi

Returns a new instance of PaymentIntentsApi.



16
17
18
# File 'lib/devdraft/api/payment_intents_api.rb', line 16

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/devdraft/api/payment_intents_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#payment_intent_controller_create_bank_payment_intent(body, idempotency_key, opts = {}) ⇒ nil

Create a bank payment intent Creates a new bank payment intent for fiat-to-stablecoin transfers. This endpoint allows you to create payment intents for bank transfers (ACH, Wire, SEPA) that convert to stablecoins. Perfect for onboarding users from traditional banking to crypto. ## Supported Payment Rails - ACH_PUSH: US bank transfers (same-day or standard) - WIRE: International wire transfers - SEPA: European bank transfers ## Use Cases - USD bank account to USDC conversion - EUR bank account to EURC conversion - MXN bank account to stablecoin conversion - Flexible amount payment intents for variable pricing ## Supported Source Currencies - USD: US Dollar - EUR: Euro - MXN: Mexican Peso ## Example: USD Bank to USDC “‘json { "sourcePaymentRail": "ach_push", "sourceCurrency": "usd", "destinationCurrency": "usdc", "destinationNetwork": "ethereum", "destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1", "amount": "1000.00", "customer_first_name": "John", "customer_last_name": "Doe", "customer_email": "[email protected]", "ach_reference": "INV12345" } “` ## Reference Fields Use appropriate reference fields based on the payment rail: - `ach_reference`: For ACH transfers (max 10 chars, alphanumeric + spaces) - `wire_message`: For wire transfers (max 256 chars) - `sepa_reference`: For SEPA transfers (6-140 chars, specific character set) ## Idempotency Include an `idempotency-key` header with a unique UUID v4 to prevent duplicate payments. Subsequent requests with the same key will return the original response.

Parameters:

  • body

    Bank payment intent creation data

  • idempotency_key

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


25
26
27
28
# File 'lib/devdraft/api/payment_intents_api.rb', line 25

def payment_intent_controller_create_bank_payment_intent(body, idempotency_key, opts = {})
  payment_intent_controller_create_bank_payment_intent_with_http_info(body, idempotency_key, opts)
  nil
end

#payment_intent_controller_create_bank_payment_intent_with_http_info(body, idempotency_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create a bank payment intent Creates a new bank payment intent for fiat-to-stablecoin transfers. This endpoint allows you to create payment intents for bank transfers (ACH, Wire, SEPA) that convert to stablecoins. Perfect for onboarding users from traditional banking to crypto. ## Supported Payment Rails - ACH_PUSH: US bank transfers (same-day or standard) - WIRE: International wire transfers - SEPA: European bank transfers ## Use Cases - USD bank account to USDC conversion - EUR bank account to EURC conversion - MXN bank account to stablecoin conversion - Flexible amount payment intents for variable pricing ## Supported Source Currencies - USD: US Dollar - EUR: Euro - MXN: Mexican Peso ## Example: USD Bank to USDC &#x60;&#x60;&#x60;json { &quot;sourcePaymentRail&quot;: &quot;ach_push&quot;, &quot;sourceCurrency&quot;: &quot;usd&quot;, &quot;destinationCurrency&quot;: &quot;usdc&quot;, &quot;destinationNetwork&quot;: &quot;ethereum&quot;, &quot;destinationAddress&quot;: &quot;0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1&quot;, &quot;amount&quot;: &quot;1000.00&quot;, &quot;customer_first_name&quot;: &quot;John&quot;, &quot;customer_last_name&quot;: &quot;Doe&quot;, &quot;customer_email&quot;: &quot;[email protected]&quot;, &quot;ach_reference&quot;: &quot;INV12345&quot; } &#x60;&#x60;&#x60; ## Reference Fields Use appropriate reference fields based on the payment rail: - &#x60;ach_reference&#x60;: For ACH transfers (max 10 chars, alphanumeric + spaces) - &#x60;wire_message&#x60;: For wire transfers (max 256 chars) - &#x60;sepa_reference&#x60;: For SEPA transfers (6-140 chars, specific character set) ## Idempotency Include an &#x60;idempotency-key&#x60; header with a unique UUID v4 to prevent duplicate payments. Subsequent requests with the same key will return the original response.

Parameters:

  • body

    Bank payment intent creation data

  • idempotency_key

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/devdraft/api/payment_intents_api.rb', line 36

def payment_intent_controller_create_bank_payment_intent_with_http_info(body, idempotency_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentIntentsApi.payment_intent_controller_create_bank_payment_intent ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling PaymentIntentsApi.payment_intent_controller_create_bank_payment_intent"
  end
  # verify the required parameter 'idempotency_key' is set
  if @api_client.config.client_side_validation && idempotency_key.nil?
    fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling PaymentIntentsApi.payment_intent_controller_create_bank_payment_intent"
  end
  # resource path
  local_var_path = '/api/v0/payment-intents/bank'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'idempotency-key'] = idempotency_key

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentIntentsApi#payment_intent_controller_create_bank_payment_intent\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#payment_intent_controller_create_stable_payment_intent(body, idempotency_key, opts = {}) ⇒ nil

Create a stable payment intent Creates a new stable payment intent for stablecoin-to-stablecoin transfers. This endpoint allows you to create payment intents for transfers between different stablecoins and networks. Perfect for cross-chain stablecoin swaps and conversions. ## Use Cases - USDC to EURC conversions - Cross-chain stablecoin transfers (e.g., Ethereum USDC to Polygon USDC) - Flexible amount payment intents for dynamic pricing ## Example: USDC to EURC Conversion “‘json { "sourceCurrency": "usdc", "sourceNetwork": "ethereum", "destinationCurrency": "eurc", "destinationNetwork": "polygon", "destinationAddress": "0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1", "amount": "100.00", "customer_first_name": "John", "customer_last_name": "Doe", "customer_email": "[email protected]" } “` ## Flexible Amount Payments Omit the `amount` field to create a flexible payment intent where users can specify the amount during payment. ## Idempotency Include an `idempotency-key` header with a unique UUID v4 to prevent duplicate payments. Subsequent requests with the same key will return the original response.

Parameters:

  • body

    Stable payment intent creation data

  • idempotency_key

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


90
91
92
93
# File 'lib/devdraft/api/payment_intents_api.rb', line 90

def payment_intent_controller_create_stable_payment_intent(body, idempotency_key, opts = {})
  payment_intent_controller_create_stable_payment_intent_with_http_info(body, idempotency_key, opts)
  nil
end

#payment_intent_controller_create_stable_payment_intent_with_http_info(body, idempotency_key, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Create a stable payment intent Creates a new stable payment intent for stablecoin-to-stablecoin transfers. This endpoint allows you to create payment intents for transfers between different stablecoins and networks. Perfect for cross-chain stablecoin swaps and conversions. ## Use Cases - USDC to EURC conversions - Cross-chain stablecoin transfers (e.g., Ethereum USDC to Polygon USDC) - Flexible amount payment intents for dynamic pricing ## Example: USDC to EURC Conversion &#x60;&#x60;&#x60;json { &quot;sourceCurrency&quot;: &quot;usdc&quot;, &quot;sourceNetwork&quot;: &quot;ethereum&quot;, &quot;destinationCurrency&quot;: &quot;eurc&quot;, &quot;destinationNetwork&quot;: &quot;polygon&quot;, &quot;destinationAddress&quot;: &quot;0x742d35Cc6634C0532925a3b8D4C9db96c4b4d8e1&quot;, &quot;amount&quot;: &quot;100.00&quot;, &quot;customer_first_name&quot;: &quot;John&quot;, &quot;customer_last_name&quot;: &quot;Doe&quot;, &quot;customer_email&quot;: &quot;[email protected]&quot; } &#x60;&#x60;&#x60; ## Flexible Amount Payments Omit the &#x60;amount&#x60; field to create a flexible payment intent where users can specify the amount during payment. ## Idempotency Include an &#x60;idempotency-key&#x60; header with a unique UUID v4 to prevent duplicate payments. Subsequent requests with the same key will return the original response.

Parameters:

  • body

    Stable payment intent creation data

  • idempotency_key

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
# File 'lib/devdraft/api/payment_intents_api.rb', line 101

def payment_intent_controller_create_stable_payment_intent_with_http_info(body, idempotency_key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PaymentIntentsApi.payment_intent_controller_create_stable_payment_intent ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling PaymentIntentsApi.payment_intent_controller_create_stable_payment_intent"
  end
  # verify the required parameter 'idempotency_key' is set
  if @api_client.config.client_side_validation && idempotency_key.nil?
    fail ArgumentError, "Missing the required parameter 'idempotency_key' when calling PaymentIntentsApi.payment_intent_controller_create_stable_payment_intent"
  end
  # resource path
  local_var_path = '/api/v0/payment-intents/stablecoin'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
  header_params[:'idempotency-key'] = idempotency_key

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] || @api_client.object_to_http_body(body) 

  return_type = opts[:return_type] 

  auth_names = opts[:auth_names] || ['x-client-key', 'x-client-secret']
  data, status_code, headers = @api_client.call_api(:POST, local_var_path,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type)

  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: PaymentIntentsApi#payment_intent_controller_create_stable_payment_intent\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end