#GIL3S-subscription-PHP-err

1 messages · Page 1 of 1 (latest)

tulip sun
#

Hello 👋
what error are you getting when you include application_fee_percent property?

icy harbor
#

wasn't able to track down any specific error. The subscription object would just fail to create so my assumption was I was building the subscription data incorrect or maybe application_fee_percent was being handled incorrectly

tulip sun
#

if you have a req ID for the failed requests that'd help as well

icy harbor
#
              'customer' => $customer->id,
              'items' => [[
                'price' => $plan->id,
              ]],
                     'application_fee_percent' => 3,
              'payment_behavior' => 'default_incomplete',
              'expand' => ['latest_invoice.payment_intent'],
            ];
            $subscription = $this->stripe_call('subscriptions', 'create', NULL, $subscription_data);```
#

i'll see if i grab more relevant info. give me maybe 5-10 minutes and I'll report back

#

ok so I think I have what I need here.
Uncaught (Status 400) (Request req_SPOLldNc9Zq9oX) You can only apply an 'application_fee' when the request is attempting a direct payment on behalf of another account (using an OAuth key or the Stripe-Account header) or destination payment (using transfer_data[destination]`). thrown

#

looks like I'm trying to process an application_fee_precent against a non connect account. we are in the process of doing a rewrite from an older api and must have missed some conditional here

#

so from what I can see on the legacy code. If you have a connect account the process was in this order
create plan
create customer
create subscription (with application_fee_precet)

if this was NOT a connect account (no subscription needed).
create plan
create customer

so basically for recurring payments were are using our main account stripe key if we aren't processing on behalf of a connect account