thephpleague / omnipay-paypal

PayPal driver for the Omnipay PHP payment processing library
MIT License
299 stars 174 forks source link

Paypal Rest completePurchase get fees #237

Open BrunoManChoi opened 4 years ago

BrunoManChoi commented 4 years ago

How can i get the fees from paypal? When I complete the purchase i can do $data = $response->getData(); and i get this information: Array ( [id] => PAYID-LYUDPFA8E292123AP955374L [intent] => sale [state] => approved [cart] => 3CN05415NR550735F [payer] => Array ( [payment_method] => paypal [status] => VERIFIED [payer_info] => Array ( [email] => accounting-buyer@mobipium.com [first_name] => test [last_name] => buyer [payer_id] => GTHZDZWYCELWU [shipping_address] => Array ( [recipient_name] => test buyer [line1] => 1 Main St [city] => San Jose [state] => CA [postal_code] => 95131 [country_code] => US ) [country_code] => US ) ) [transactions] => Array ( [0] => Array ( [amount] => Array ( [total] => 1500.00 [currency] => EUR [details] => Array ( [subtotal] => 1500.00 [shipping] => 0.00 [insurance] => 0.00 [handling_fee] => 0.00 [shipping_discount] => 0.00 ) ) [payee] => Array ( [merchant_id] => PCQDHVBJUD4WN [email] => accounting-facilitator@mobipium.com ) [description] => 5e2837933fdc3 [invoice_number] => 5e2837933fdc3 [item_list] => Array ( [shipping_address] => Array ( [recipient_name] => test buyer [line1] => 1 Main St [city] => San Jose [state] => CA [postal_code] => 95131 [country_code] => US ) ) [related_resources] => Array ( [0] => Array ( [sale] => Array ( [id] => 9XL29023PP3022045 [state] => pending [amount] => Array ( [total] => 1500.00 [currency] => EUR [details] => Array ( [subtotal] => 1500.00 [shipping] => 0.00 [insurance] => 0.00 [handling_fee] => 0.00 [shipping_discount] => 0.00 ) ) [payment_mode] => INSTANT_TRANSFER [reason_code] => RECEIVING_PREFERENCE_MANDATES_MANUAL_ACTION [protection_eligibility] => ELIGIBLE [protection_eligibility_type] => ITEM_NOT_RECEIVED_ELIGIBLE,UNAUTHORIZED_PAYMENT_ELIGIBLE [receivable_amount] => Array ( [value] => 1500.00 [currency] => EUR ) [exchange_rate] => 0.8627555079 [parent_payment] => PAYID-LYUDPFA8E292123AP955374L [create_time] => 2020-01-22T11:53:12Z [update_time] => 2020-01-22T11:53:12Z [links] => Array ( [0] => Array ( [href] => https://api.sandbox.paypal.com/v1/payments/sale/9XL29023PP3022045 [rel] => self [method] => GET ) [1] => Array ( [href] => https://api.sandbox.paypal.com/v1/payments/sale/9XL29023PP3022045/refund [rel] => refund [method] => POST ) [2] => Array ( [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LYUDPFA8E292123AP955374L [rel] => parent_payment [method] => GET ) ) ) ) ) ) ) [create_time] => 2020-01-22T11:52:52Z [update_time] => 2020-01-22T11:53:12Z [links] => Array ( [0] => Array ( [href] => https://api.sandbox.paypal.com/v1/payments/payment/PAYID-LYUDPFA8E292123AP955374L [rel] => self [method] => GET ) ) )

I only can see the handling_fee field but when i access my facilitator account https://gyazo.com/fc55e97066ee755efee7867a3c42e913 I can see the estimated field, how can i get this field? I already do a integration with paypal and I can get that field from $response['data']['transactions'][0]['related_resources'][0]['sale']['transaction_fee']['value']; But this field sale doesn't has the transaction_fee field I really want to try omnipay but I need this field. any suggestion?