| @@ 333-340 (lines=8) @@ | ||
| 330 | // Store other data such as fees |
|
| 331 | update_post_meta( $order->id, 'Stripe Payment ID', $result->id ); |
|
| 332 | ||
| 333 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
| 334 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 335 | // values are in the local currency of the Stripe account, not from WC. |
|
| 336 | $fee = ! empty( $result->balance_transaction->fee ) ? number_format( $result->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 337 | $net = ! empty( $result->balance_transaction->net ) ? number_format( $result->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 338 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 339 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 340 | } |
|
| 341 | } |
|
| 342 | } |
|
| 343 | } |
|
| @@ 750-757 (lines=8) @@ | ||
| 747 | update_post_meta( $order->id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ); |
|
| 748 | ||
| 749 | // Store other data such as fees |
|
| 750 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
| 751 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 752 | // values are in the local currency of the Stripe account, not from WC. |
|
| 753 | $fee = ! empty( $response->balance_transaction->fee ) ? number_format( $response->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 754 | $net = ! empty( $response->balance_transaction->net ) ? number_format( $response->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 755 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 756 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 757 | } |
|
| 758 | ||
| 759 | if ( $response->captured ) { |
|
| 760 | $order->payment_complete( $response->id ); |
|