@@ 328-335 (lines=8) @@ | ||
325 | // Store other data such as fees |
|
326 | update_post_meta( $order->id, 'Stripe Payment ID', $result->id ); |
|
327 | ||
328 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
329 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
330 | // values are in the local currency of the Stripe account, not from WC. |
|
331 | $fee = ! empty( $result->balance_transaction->fee ) ? number_format( $result->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
332 | $net = ! empty( $result->balance_transaction->net ) ? number_format( $result->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
333 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
334 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
335 | } |
|
336 | } |
|
337 | } |
|
338 | } |
@@ 714-721 (lines=8) @@ | ||
711 | update_post_meta( $order->id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ); |
|
712 | ||
713 | // Store other data such as fees |
|
714 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
715 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
716 | // values are in the local currency of the Stripe account, not from WC. |
|
717 | $fee = ! empty( $response->balance_transaction->fee ) ? number_format( $response->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
718 | $net = ! empty( $response->balance_transaction->net ) ? number_format( $response->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
719 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
720 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
721 | } |
|
722 | ||
723 | if ( $response->captured ) { |
|
724 | $order->payment_complete( $response->id ); |