Module: SpeedLightning::CheckoutLinkMethods

Includes:
Retryable
Included in:
Client
Defined in:
lib/speed_lightning/checkout_link_methods.rb

Instance Method Summary collapse

Methods included from Retryable

#with_retry

Instance Method Details



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/speed_lightning/checkout_link_methods.rb', line 8

def create_checkout_link(
    amount:,
    success_url:,
    currency: "SATS",
    metadata: { client: "ruby" },
    is_phone_enabled: false,
    is_email_enabled: false,
    is_billing_address_enabled: false,
    is_shipping_address_enabled: false,
    livemode: false
  )
  with_retry do
    body_hash = {
      amount: amount,
      success_url: success_url,
      currency: currency,
      metadata: ,
      customer_collections_status: {
          is_email_enabled: is_email_enabled,
          is_phone_enabled: is_phone_enabled,
          is_billing_address_enabled: is_billing_address_enabled,
          is_shipping_address_enabled: is_shipping_address_enabled
        },
      livemode: livemode
    }
    endpoint = "checkout-links"
    response = make_request(endpoint, :post, body_hash)
    CheckoutLink.new(response)
  end
end


39
40
41
42
43
44
45
# File 'lib/speed_lightning/checkout_link_methods.rb', line 39

def retrieve_checkout_link(id)
  with_retry do
    endpoint = "checkout-links/" + id
    response = make_request(endpoint, :get)
    CheckoutLink.new(response)
  end
end