class Pay::Stripe::Merchant
Attributes
pay_merchant[R]
Public Class Methods
new(pay_merchant)
click to toggle source
# File lib/pay/stripe/merchant.rb, line 9 def initialize(pay_merchant) @pay_merchant = pay_merchant end
Public Instance Methods
account()
click to toggle source
# File lib/pay/stripe/merchant.rb, line 29 def account ::Stripe::Account.retrieve(processor_id) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end
account_link(refresh_url:, return_url:, type: "account_onboarding", **options)
click to toggle source
# File lib/pay/stripe/merchant.rb, line 35 def account_link(refresh_url:, return_url:, type: "account_onboarding", **options) ::Stripe::AccountLink.create({ account: processor_id, refresh_url: refresh_url, return_url: return_url, type: type }) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end
create_account(**options)
click to toggle source
# File lib/pay/stripe/merchant.rb, line 13 def create_account(**options) defaults = { type: "express", capabilities: { card_payments: {requested: true}, transfers: {requested: true} } } stripe_account = ::Stripe::Account.create(defaults.merge(options)) pay_merchant.update(processor_id: stripe_account.id) stripe_account rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end
login_link(**options)
click to toggle source
A single-use login link for Express accounts to access their Stripe
dashboard
# File lib/pay/stripe/merchant.rb, line 47 def login_link(**options) ::Stripe::Account.create_login_link(processor_id) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end
transfer(amount:, currency: "usd", **options)
click to toggle source
Transfer money from the platform to this connected account stripe.com/docs/connect/charges-transfers#transfer-availability
# File lib/pay/stripe/merchant.rb, line 55 def transfer(amount:, currency: "usd", **options) ::Stripe::Transfer.create({ amount: amount, currency: currency, destination: processor_id }.merge(options)) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end