| @@ 329-336 (lines=8) @@ | ||
| 326 | // Store other data such as fees |
|
| 327 | update_post_meta( $order->id, 'Stripe Payment ID', $result->id ); |
|
| 328 | ||
| 329 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
| 330 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 331 | // values are in the local currency of the Stripe account, not from WC. |
|
| 332 | $fee = ! empty( $result->balance_transaction->fee ) ? number_format( $result->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 333 | $net = ! empty( $result->balance_transaction->net ) ? number_format( $result->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 334 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 335 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 336 | } |
|
| 337 | } |
|
| 338 | } |
|
| 339 | } |
|
| @@ 822-829 (lines=8) @@ | ||
| 819 | update_post_meta( $order->id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ); |
|
| 820 | ||
| 821 | // Store other data such as fees |
|
| 822 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
| 823 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 824 | // values are in the local currency of the Stripe account, not from WC. |
|
| 825 | $fee = ! empty( $response->balance_transaction->fee ) ? number_format( $response->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 826 | $net = ! empty( $response->balance_transaction->net ) ? number_format( $response->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 827 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 828 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 829 | } |
|
| 830 | ||
| 831 | if ( $response->captured ) { |
|
| 832 | $order->payment_complete( $response->id ); |
|