Class: Square::CheckoutApi
- Defined in:
- lib/square/api/checkout_api.rb
Overview
CheckoutApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#create_checkout(location_id:, body:) ⇒ ApiResponse
Links a ‘checkoutId` to a `checkout_page_url` that customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com.
-
#create_payment_link(body:) ⇒ ApiResponse
Creates a Square-hosted checkout page.
-
#delete_payment_link(id:) ⇒ ApiResponse
Deletes a payment link.
-
#list_payment_links(cursor: nil, limit: nil) ⇒ ApiResponse
Lists all payment links.
-
#retrieve_location_settings(location_id:) ⇒ ApiResponse
Retrieves the location-level settings for a Square-hosted checkout page.
-
#retrieve_merchant_settings ⇒ ApiResponse
Retrieves the merchant-level settings for a Square-hosted checkout page.
-
#retrieve_payment_link(id:) ⇒ ApiResponse
Retrieves a payment link.
-
#update_location_settings(location_id:, body:) ⇒ ApiResponse
Updates the location-level settings for a Square-hosted checkout page.
-
#update_merchant_settings(body:) ⇒ ApiResponse
Updates the merchant-level settings for a Square-hosted checkout page.
-
#update_payment_link(id:, body:) ⇒ ApiResponse
Updates a payment link.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from Square::BaseApi
Instance Method Details
#create_checkout(location_id:, body:) ⇒ ApiResponse
Links a ‘checkoutId` to a `checkout_page_url` that customers are directed to in order to provide their payment information using a payment processing workflow hosted on connect.squareup.com. NOTE: The Checkout API has been updated with new features. For more information, see [Checkout API highlights](developer.squareup.com/docs/checkout-api#checkout-api- highlights). location to associate the checkout with. containing the fields to POST for the request. See the corresponding object definition for field details.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/square/api/checkout_api.rb', line 17 def create_checkout(location_id:, body:) warn 'Endpoint create_checkout in CheckoutApi is deprecated' new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/locations/{location_id}/checkouts', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_payment_link(body:) ⇒ ApiResponse
Creates a Square-hosted checkout page. Applications can share the resulting payment link with their buyer to pay for goods and services. containing the fields to POST for the request. See the corresponding object definition for field details.
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/square/api/checkout_api.rb', line 159 def create_payment_link(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/online-checkout/payment-links', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#delete_payment_link(id:) ⇒ ApiResponse
Deletes a payment link. delete.
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/square/api/checkout_api.rb', line 180 def delete_payment_link(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/v2/online-checkout/payment-links/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#list_payment_links(cursor: nil, limit: nil) ⇒ ApiResponse
Lists all payment links. a previous call to this endpoint. Provide this cursor to retrieve the next set of results for the original query. If a cursor is not provided, the endpoint returns the first page of the results. For more information, see [Pagination](developer.squareup.com/docs/build-basics/common-api-p atterns/pagination). results to return per page. The limit is advisory and the implementation might return more or less results. If the supplied limit is negative, zero, or greater than the maximum limit of 1000, it is ignored. Default value: ‘100`
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
# File 'lib/square/api/checkout_api.rb', line 136 def list_payment_links(cursor: nil, limit: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/online-checkout/payment-links', 'default') .query_param(new_parameter(cursor, key: 'cursor')) .query_param(new_parameter(limit, key: 'limit')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_location_settings(location_id:) ⇒ ApiResponse
Retrieves the location-level settings for a Square-hosted checkout page. which to retrieve settings.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/square/api/checkout_api.rb', line 42 def retrieve_location_settings(location_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/online-checkout/location-settings/{location_id}', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_merchant_settings ⇒ ApiResponse
Retrieves the merchant-level settings for a Square-hosted checkout page.
87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/square/api/checkout_api.rb', line 87 def retrieve_merchant_settings new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/online-checkout/merchant-settings', 'default') .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_payment_link(id:) ⇒ ApiResponse
Retrieves a payment link.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
# File 'lib/square/api/checkout_api.rb', line 199 def retrieve_payment_link(id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/online-checkout/payment-links/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_location_settings(location_id:, body:) ⇒ ApiResponse
Updates the location-level settings for a Square-hosted checkout page. which to retrieve settings. containing the fields to POST for the request. See the corresponding object definition for field details.
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/square/api/checkout_api.rb', line 65 def update_location_settings(location_id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/online-checkout/location-settings/{location_id}', 'default') .template_param(new_parameter(location_id, key: 'location_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_merchant_settings(body:) ⇒ ApiResponse
Updates the merchant-level settings for a Square-hosted checkout page. containing the fields to POST for the request. See the corresponding object definition for field details.
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/square/api/checkout_api.rb', line 106 def update_merchant_settings(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/online-checkout/merchant-settings', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_payment_link(id:, body:) ⇒ ApiResponse
Updates a payment link. You can update the ‘payment_link` fields such as `description`, `checkout_options`, and `pre_populated_data`. You cannot update other fields such as the `order_id`, `version`, `URL`, or `timestamp` field. update. containing the fields to POST for the request. See the corresponding object definition for field details.
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/square/api/checkout_api.rb', line 225 def update_payment_link(id:, body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/online-checkout/payment-links/{id}', 'default') .template_param(new_parameter(id, key: 'id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |