Module: Mpp::Methods::Stripe

Defined in:
lib/mpp/methods/stripe.rb,
lib/mpp/methods/stripe/defaults.rb,
lib/mpp/methods/stripe/charge_intent.rb,
lib/mpp/methods/stripe/client_method.rb,
lib/mpp/methods/stripe/stripe_method.rb

Defined Under Namespace

Modules: Defaults Classes: ChargeIntent, ClientMethod, StripeMethod

Class Method Summary collapse

Class Method Details

.stripe(secret_key:, network_id:, payment_methods: nil, metadata: nil, currency: Defaults::DEFAULT_CURRENCY, decimals: Defaults::DEFAULT_DECIMALS, api_base: Defaults::STRIPE_API_BASE) ⇒ Object

Factory function to create a configured StripeMethod with ChargeIntent.



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/mpp/methods/stripe/stripe_method.rb', line 43

def self.stripe(secret_key:, network_id:, payment_methods: nil,
  metadata: nil, currency: Defaults::DEFAULT_CURRENCY,
  decimals: Defaults::DEFAULT_DECIMALS,
  api_base: Defaults::STRIPE_API_BASE)
  charge_intent = ChargeIntent.new(secret_key: secret_key, api_base: api_base)

  method = StripeMethod.new(
    secret_key: secret_key,
    network_id: network_id,
    payment_methods: payment_methods,
    metadata: ,
    currency: currency,
    decimals: decimals
  )

  method.intents = {"charge" => charge_intent}
  method
end