Class: Pay::Stripe::Merchant
- Inherits:
-
Merchant
- Object
- ApplicationRecord
- Merchant
- Pay::Stripe::Merchant
- Defined in:
- app/models/pay/stripe/merchant.rb
Instance Method Summary collapse
- #account ⇒ Object
- #account_link(refresh_url:, return_url:, type: "account_onboarding", **options) ⇒ Object
- #create_account(**options) ⇒ Object
-
#login_link(**options) ⇒ Object
A single-use login link for Express accounts to access their Stripe dashboard.
-
#transfer(amount:, currency: "usd", **options) ⇒ Object
Transfer money from the platform to this connected account stripe.com/docs/connect/charges-transfers#transfer-availability.
Methods inherited from Merchant
Instance Method Details
#account ⇒ Object
12 13 14 15 16 |
# File 'app/models/pay/stripe/merchant.rb', line 12 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) ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'app/models/pay/stripe/merchant.rb', line 18 def account_link(refresh_url:, return_url:, type: "account_onboarding", **) ::Stripe::AccountLink.create({ account: processor_id, refresh_url: refresh_url, return_url: return_url, type: type }.merge()) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end |
#create_account(**options) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/models/pay/stripe/merchant.rb', line 4 def create_account(**) stripe_account = ::Stripe::Account.create() update(processor_id: stripe_account.id) stripe_account rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end |
#login_link(**options) ⇒ Object
A single-use login link for Express accounts to access their Stripe dashboard
30 31 32 33 34 |
# File 'app/models/pay/stripe/merchant.rb', line 30 def login_link(**) ::Stripe::Account.create_login_link(processor_id) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end |
#transfer(amount:, currency: "usd", **options) ⇒ Object
Transfer money from the platform to this connected account stripe.com/docs/connect/charges-transfers#transfer-availability
38 39 40 41 42 43 44 45 46 |
# File 'app/models/pay/stripe/merchant.rb', line 38 def transfer(amount:, currency: "usd", **) ::Stripe::Transfer.create({ amount: amount, currency: currency, destination: processor_id }.merge()) rescue ::Stripe::StripeError => e raise Pay::Stripe::Error, e end |