Skip to content

Latest commit

 

History

History
241 lines (177 loc) · 7.65 KB

ChargesApi.md

File metadata and controls

241 lines (177 loc) · 7.65 KB

Conekta::ChargesApi

All URIs are relative to https://api.conekta.io

Method HTTP request Description
get_charges GET /charges Get A List of Charges
orders_create_charge POST /orders/{id}/charges Create charge
update_charge PUT /charges/{id} Update a charge

get_charges

get_charges(opts)

Get A List of Charges

Examples

require 'time'
require 'conekta'
# setup authorization
Conekta.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Conekta::ChargesApi.new
opts = {
  accept_language: 'es', # String | Use for knowing which language to use
  x_child_company_id: '6441b6376b60c3a638da80af', # String | In the case of a holding company, the company id of the child company to which will process the request.
  limit: 56, # Integer | The numbers of items to return, the maximum value is 250
  search: 'search_example', # String | General order search, e.g. by mail, reference etc.
  _next: '_next_example', # String | next page
  previous: 'previous_example' # String | previous page
}

begin
  # Get A List of Charges
  result = api_instance.get_charges(opts)
  p result
rescue Conekta::ApiError => e
  puts "Error when calling ChargesApi->get_charges: #{e}"
end

Using the get_charges_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> get_charges_with_http_info(opts)

begin
  # Get A List of Charges
  data, status_code, headers = api_instance.get_charges_with_http_info(opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <GetChargesResponse>
rescue Conekta::ApiError => e
  puts "Error when calling ChargesApi->get_charges_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
accept_language String Use for knowing which language to use [optional][default to 'es']
x_child_company_id String In the case of a holding company, the company id of the child company to which will process the request. [optional]
limit Integer The numbers of items to return, the maximum value is 250 [optional][default to 20]
search String General order search, e.g. by mail, reference etc. [optional]
_next String next page [optional]
previous String previous page [optional]

Return type

GetChargesResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/vnd.conekta-v2.1.0+json

orders_create_charge

orders_create_charge(id, charge_request, opts)

Create charge

Create charge for an existing orden

Examples

require 'time'
require 'conekta'
# setup authorization
Conekta.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Conekta::ChargesApi.new
id = '6307a60c41de27127515a575' # String | Identifier of the resource
charge_request = Conekta::ChargeRequest.new({payment_method: Conekta::PaymentMethodCardRequest.new({type: 'card | cash | spei', cvc: '198', exp_month: '12', exp_year: '2025', name: 'John Doe', number: '4242424242424242'})}) # ChargeRequest | requested field for a charge
opts = {
  accept_language: 'es', # String | Use for knowing which language to use
  x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request.
}

begin
  # Create charge
  result = api_instance.orders_create_charge(id, charge_request, opts)
  p result
rescue Conekta::ApiError => e
  puts "Error when calling ChargesApi->orders_create_charge: #{e}"
end

Using the orders_create_charge_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> orders_create_charge_with_http_info(id, charge_request, opts)

begin
  # Create charge
  data, status_code, headers = api_instance.orders_create_charge_with_http_info(id, charge_request, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <ChargeOrderResponse>
rescue Conekta::ApiError => e
  puts "Error when calling ChargesApi->orders_create_charge_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
id String Identifier of the resource
charge_request ChargeRequest requested field for a charge
accept_language String Use for knowing which language to use [optional][default to 'es']
x_child_company_id String In the case of a holding company, the company id of the child company to which will process the request. [optional]

Return type

ChargeOrderResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/vnd.conekta-v2.1.0+json

update_charge

update_charge(id, charge_update_request, opts)

Update a charge

Examples

require 'time'
require 'conekta'
# setup authorization
Conekta.configure do |config|
  # Configure Bearer authorization: bearerAuth
  config.access_token = 'YOUR_BEARER_TOKEN'
end

api_instance = Conekta::ChargesApi.new
id = '6307a60c41de27127515a575' # String | Identifier of the resource
charge_update_request = Conekta::ChargeUpdateRequest.new # ChargeUpdateRequest | requested field for update a charge
opts = {
  accept_language: 'es', # String | Use for knowing which language to use
  x_child_company_id: '6441b6376b60c3a638da80af' # String | In the case of a holding company, the company id of the child company to which will process the request.
}

begin
  # Update a charge
  result = api_instance.update_charge(id, charge_update_request, opts)
  p result
rescue Conekta::ApiError => e
  puts "Error when calling ChargesApi->update_charge: #{e}"
end

Using the update_charge_with_http_info variant

This returns an Array which contains the response data, status code and headers.

<Array(, Integer, Hash)> update_charge_with_http_info(id, charge_update_request, opts)

begin
  # Update a charge
  data, status_code, headers = api_instance.update_charge_with_http_info(id, charge_update_request, opts)
  p status_code # => 2xx
  p headers # => { ... }
  p data # => <ChargeResponse>
rescue Conekta::ApiError => e
  puts "Error when calling ChargesApi->update_charge_with_http_info: #{e}"
end

Parameters

Name Type Description Notes
id String Identifier of the resource
charge_update_request ChargeUpdateRequest requested field for update a charge
accept_language String Use for knowing which language to use [optional][default to 'es']
x_child_company_id String In the case of a holding company, the company id of the child company to which will process the request. [optional]

Return type

ChargeResponse

Authorization

bearerAuth

HTTP request headers

  • Content-Type: application/json
  • Accept: application/vnd.conekta-v2.1.0+json