Class: Stripe::Crypto::OnrampSession

Inherits:
APIResource show all
Extended by:
APIOperations::Create, APIOperations::List
Defined in:
lib/stripe/resources/crypto/onramp_session.rb

Overview

A Crypto Onramp Session represents your customer's session as they purchase cryptocurrency through Stripe. Once payment is successful, Stripe will fulfill the delivery of cryptocurrency to your user's wallet and contain a reference to the crypto transaction ID.

You can create an onramp session on your server and embed the widget on your frontend. Alternatively, you can redirect your users to the standalone hosted onramp.

Related guide: Integrate the onramp

Defined Under Namespace

Classes: TransactionDetails

Constant Summary collapse

OBJECT_NAME =
"crypto.onramp_session"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::Create

create

Methods included from APIOperations::List

list

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, field_encodings, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#client_secretObject (readonly)

A client secret that can be used to drive a single session using our embedded widget.

Related guide: Set up an onramp integration



125
126
127
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 125

def client_secret
  @client_secret
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



127
128
129
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 127

def created
  @created
end

#idObject (readonly)

Unique identifier for the object.



129
130
131
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 129

def id
  @id
end

#kyc_details_providedObject (readonly)

Has the value true if any user kyc details were provided during the creation of the onramp session. Otherwise, has the value false.



131
132
133
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 131

def kyc_details_provided
  @kyc_details_provided
end

#livemodeObject (readonly)

If the object exists in live mode, the value is true. If the object exists in test mode, the value is false.



133
134
135
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 133

def livemode
  @livemode
end

#metadataObject (readonly)

Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



135
136
137
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 135

def 
  @metadata
end

#objectObject (readonly)

String representing the object's type. Objects of the same type share the same value.



137
138
139
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 137

def object
  @object
end

#redirect_urlObject (readonly)

Redirect your users to the URL for a prebuilt frontend integration of the crypto onramp on the standalone hosted onramp.

Related guide: Mint a session with a redirect url



141
142
143
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 141

def redirect_url
  @redirect_url
end

#statusObject (readonly)

The status of the Onramp Session. One of = {initialized, rejected, requires_payment, fulfillment_processing, fulfillment_complete}



143
144
145
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 143

def status
  @status
end

#transaction_detailsObject (readonly)

Attribute for field transaction_details



145
146
147
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 145

def transaction_details
  @transaction_details
end

Class Method Details

.checkout(id, params = {}, opts = {}) ⇒ Object

Completes a headless CryptoOnrampSession.

This method will attempt to confirm the payment and execute the quote to deliver the crypto to the customer.



162
163
164
165
166
167
168
169
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 162

def self.checkout(id, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/crypto/onramp_sessions/%<id>s/checkout", { id: CGI.escape(id) }),
    params: params,
    opts: opts
  )
end

.create(params = {}, opts = {}) ⇒ Object

Creates a CryptoOnrampSession object.

After the CryptoOnrampSession is created, display the onramp session modal using the client_secret.

Related guide: Set up an onramp integration



176
177
178
179
180
181
182
183
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 176

def self.create(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: "/v1/crypto/onramp_sessions",
    params: params,
    opts: opts
  )
end

.field_remappingsObject



219
220
221
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 219

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



215
216
217
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 215

def self.inner_class_types
  @inner_class_types = { transaction_details: TransactionDetails }
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of onramp sessions that match the filter criteria. The onramp sessions are returned in sorted order, with the most recent onramp sessions appearing first.



186
187
188
189
190
191
192
193
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 186

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/crypto/onramp_sessions",
    params: params,
    opts: opts
  )
end

.object_nameObject



16
17
18
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 16

def self.object_name
  "crypto.onramp_session"
end

.quote(id, params = {}, opts = {}) ⇒ Object

Refreshes an executable quote for a CryptoOnrampSession.



206
207
208
209
210
211
212
213
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 206

def self.quote(id, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/crypto/onramp_sessions/%<id>s/quote", { id: CGI.escape(id) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#checkout(params = {}, opts = {}) ⇒ Object

Completes a headless CryptoOnrampSession.

This method will attempt to confirm the payment and execute the quote to deliver the crypto to the customer.



150
151
152
153
154
155
156
157
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 150

def checkout(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/crypto/onramp_sessions/%<id>s/checkout", { id: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#quote(params = {}, opts = {}) ⇒ Object

Refreshes an executable quote for a CryptoOnrampSession.



196
197
198
199
200
201
202
203
# File 'lib/stripe/resources/crypto/onramp_session.rb', line 196

def quote(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/crypto/onramp_sessions/%<id>s/quote", { id: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end