Skip to content

Instantly share code, notes, and snippets.

@mrjonesbot
Last active December 22, 2022 20:16
Show Gist options
  • Save mrjonesbot/f4356071ca8f7aaf4fb9466b517d5158 to your computer and use it in GitHub Desktop.
Save mrjonesbot/f4356071ca8f7aaf4fb9466b517d5158 to your computer and use it in GitHub Desktop.
# Follow the steps to setup a merchant account here: https://github.com/pay-rails/pay/blob/master/docs/marketplaces/stripe_connect.md
# Once a merchant_processor is setup against the account, you can use the account token set on the merchant processor, to create new payment procesors under that marketplace
account = Account.find(1)
merchant_processor = account.merchant_processor
account_user = account.account_users.find(1)
account_user.set_payment_processor :stripe, stripe_account: merchant_processor.processor_id
payment_processor = account_user.payment_processor
payment_processor.subscribe( #subscribes your merchant customer to your available subscriptions
name: 'default',
items: [{}],
collection_method: 'send_invoice',
proration_behavior: 'none',
billing_cycle_anchor: DateTime.now.next_month,
days_until_due: 10
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment