1

I am using Laravel Omnipay and Omnipay/Stripe. I am trying to set an application fee (Stripe resource) to be collected but after I fill in card data and post to my controller I get this error:

InvalidRequestException in AbstractRequest.php line 213: The source parameter is required

According to Omnipay/Stripe I am allowed to pass the application_fee (AbstractRequest reference) as a transactionFee but it is not working

My controller:

$payment = $request->amount;
$gateway = Omnipay::create('Stripe');
$gateway->setApiKey($company->settings()->get('gateway_keys')['Stripe']['test_secret']);

// Send purchase request
$response = $gateway->purchase(
    [
        'amount' => $payment,
        'currency' => 'USD',
        'token' => $request->stripeToken,
        'transactionFee' => 100,
        'stripe_account' => $company->settings()->get('gateway_keys')['Stripe']['account_id']
        //'card' => $formData
    ]
)->send();

How do I get it where I can charge an application fee?

Derek
  • 4,747
  • 7
  • 44
  • 79
  • Go into your Stripe account and look at the logs. They will give you a better idea why your request failed. – Chase Jun 24 '17 at 04:11
  • I don't think it makes it to stripe to be logged, error happens before the request is made – Derek Jun 24 '17 at 04:15
  • 1
    I'm not familiar with the lib you're using, but I am familiar with Stripe and Connect. I re-read the error and it says 'source is required'. The source is the charge token, which is shown in your array as 'token'. I couldn't say if the key 'token' is correct syntax in the lib you're using, but that error tells me that $request->stripeToken may be null. – Chase Jun 24 '17 at 04:20
  • That was indeed my problem with the above error, no more working late at night :) – Derek Jun 24 '17 at 16:06
  • I have the same issue with an opensource project I use and which use omnipay, when trying to make it work with connect. I don't have any `token` passed though – Clawfire Oct 28 '21 at 20:56

0 Answers0