Skip to content

Commit

Permalink
Update stripe_connect.md to reflect Stripe API changes and offer some…
Browse files Browse the repository at this point in the history
… color on Merchant#onboarding_complete (#1129)

* Update stripe_connect.md

Updated docs to provide some detail on the default `onboarding_complete` flag that's set based on account verification, and also felt it worth a callout about the gotcha related to Stripe Connect's API updates

* Remove default type value for Stripe merchants

* Apply suggestions from code review

---------

Co-authored-by: Chris Oliver <[email protected]>
  • Loading branch information
TrevorHinesley and excid3 authored Dec 30, 2024
1 parent dbfb595 commit 663fa76
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

### Unreleased

* [Breaking] Remove default `type` for Stripe Merchant Account creation

### 8.3.0

* Ignore Stripe `payment_failed` and `payment_action_required` webhooks on `incomplete` subscriptions as these are already handled by the JavaScript in-browser. #1121
Expand Down
10 changes: 1 addition & 9 deletions app/models/pay/stripe/merchant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@ module Pay
module Stripe
class Merchant < Pay::Merchant
def create_account(**options)
defaults = {
type: "express",
capabilities: {
card_payments: {requested: true},
transfers: {requested: true}
}
}

stripe_account = ::Stripe::Account.create(defaults.merge(options))
stripe_account = ::Stripe::Account.create(options)
update(processor_id: stripe_account.id)
stripe_account
rescue ::Stripe::StripeError => e
Expand Down
11 changes: 8 additions & 3 deletions docs/marketplaces/stripe_connect.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ end
@user.merchant_processor.account_link
@user.merchant_processor.login_link
@user.merchant_processor.transfer(amount: 25_00)
@user.merchant_processor.onboarding_complete? # Updates via webhook based on the Stripe::Account's #charges_enabled attribute
```

## When Using Checkout Session
Expand Down Expand Up @@ -128,13 +129,13 @@ var stripe = Stripe("<%= @sample_credentials.test_publishable_key %>", {
pay_charge = @user.charge(100_00, transfer_group: '{ORDER10}')

# Create a Transfer to a connected account (later):
@other_user.merchant.transfer(
@other_user.merchant_processor.transfer(
amount: 70_00,
transfer_group: '{ORDER10}',
)

# Create a second Transfer to another connected account (later):
@another_user.merchant.transfer(
@another_user.merchant_processor.transfer(
amount: 20_00,
transfer_group: '{ORDER10}',
)
Expand All @@ -145,8 +146,12 @@ Alternatively, the `source_transaction` parameter allows you to transfer only on
See: https://stripe.com/docs/connect/charges-transfers#transfer-availability

```ruby
@other_user.merchant.transfer(
@other_user.merchant_processor.transfer(
amount: 70_00,
source_transaction: pay_charge.processor_id
)
```

### Verification

By default, Pay sets up a webhook listener for the `account.updated` event that updates an `onboarding_complete` flag based on whether `charges_enabled` is true, which Stripe updates based on the account's current verification (or lack thereof) status as long as you request a charge or transfer capability when connecting the user's Stripe Connect account to your platform's Stripe account.

0 comments on commit 663fa76

Please sign in to comment.