2
votes

How do I set the application fee on Stripe Omnipay? It works fine when I use stripe's php library but could not get around with Omnipay.

Error Message: Can only apply an application_fee when the request is made on behalf of another account (using an OAuth key, the Stripe-Account header, or the destination parameter).

$formData = [
    'number' => '4242424242424242',
    'expiryMonth' => '8',
    'expiryYear' => '2018',
    'cvv' => '123',
    'firstName' => 'John',
    'lastName'  => 'Wags',
    'email'  => '[email protected]' ,

];

 $response = $gateway->purchase(
    [
        'amount' => '16.00',
        'applicationFee' => '2.00',
        'destination' => 'acct_24xxxxxxxxxxxxxx',
        'currency' => 'AUD',
        'card' => $formData,
        'receipt_email'  => '[email protected]', 
        'description' => 'Ref:10201' 
    ]
)->send();

Am I doing something wrong here?

1
Did you ever manage to get this working?Callombert

1 Answers

-1
votes

I think that you also have to provide a destination parameter.

$response = $gateway->purchase(
    [
        'amount' => '16.00',
        'applicationFee' => '2.00',
        'destination' => 'acct_24xxxxxxxxxxxxxx',
        'currency' => 'AUD',
        'card' => $formData,
        'receipt_email'  => '[email protected]', 
        'description' => 'Ref:10201',
        'destination' => 'DESTINATION-ACCOUNT-ID',
    ]
)->send();

https://stripe.com/docs/connect/payments-fees#charging-through-the-platform