Class: Devdraft::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.



19
20
21
# File 'lib/devdraft/api/payment_intents_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



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

def api_client
  @api_client
end

Instance Method Details

#payment_intent_controller_create_bank_payment_intent(idempotency_key, create_bank_payment_intent_dto, 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:

  • idempotency_key (String)

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • create_bank_payment_intent_dto (CreateBankPaymentIntentDto)

    Bank payment intent creation data

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

    the optional parameters

Returns:

  • (nil)


28
29
30
31
# File 'lib/devdraft/api/payment_intents_api.rb', line 28

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

#payment_intent_controller_create_bank_payment_intent_with_http_info(idempotency_key, create_bank_payment_intent_dto, 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:

  • idempotency_key (String)

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • create_bank_payment_intent_dto (CreateBankPaymentIntentDto)

    Bank payment intent creation data

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/devdraft/api/payment_intents_api.rb', line 39

def payment_intent_controller_create_bank_payment_intent_with_http_info(idempotency_key, create_bank_payment_intent_dto, 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 '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
  # verify the required parameter 'create_bank_payment_intent_dto' is set
  if @api_client.config.client_side_validation && create_bank_payment_intent_dto.nil?
    fail ArgumentError, "Missing the required parameter 'create_bank_payment_intent_dto' 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'idempotency-key'] = idempotency_key

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']

  new_options = opts.merge(
    :operation => :"PaymentIntentsApi.payment_intent_controller_create_bank_payment_intent",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  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(idempotency_key, create_stable_payment_intent_dto, 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:

  • idempotency_key (String)

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • create_stable_payment_intent_dto (CreateStablePaymentIntentDto)

    Stable payment intent creation data

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

    the optional parameters

Returns:

  • (nil)


103
104
105
106
# File 'lib/devdraft/api/payment_intents_api.rb', line 103

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

#payment_intent_controller_create_stable_payment_intent_with_http_info(idempotency_key, create_stable_payment_intent_dto, 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:

  • idempotency_key (String)

    Unique UUID v4 for idempotent requests. Prevents duplicate payments.

  • create_stable_payment_intent_dto (CreateStablePaymentIntentDto)

    Stable payment intent creation data

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

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# File 'lib/devdraft/api/payment_intents_api.rb', line 114

def payment_intent_controller_create_stable_payment_intent_with_http_info(idempotency_key, create_stable_payment_intent_dto, 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 '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
  # verify the required parameter 'create_stable_payment_intent_dto' is set
  if @api_client.config.client_side_validation && create_stable_payment_intent_dto.nil?
    fail ArgumentError, "Missing the required parameter 'create_stable_payment_intent_dto' 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']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'idempotency-key'] = idempotency_key

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['x-client-secret', 'x-client-key']

  new_options = opts.merge(
    :operation => :"PaymentIntentsApi.payment_intent_controller_create_stable_payment_intent",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  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