| @@ 476-483 (lines=8) @@ | ||
| 473 | // Store other data such as fees |
|
| 474 | update_post_meta( $order_id, 'Stripe Payment ID', $result->id ); |
|
| 475 | ||
| 476 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
| 477 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 478 | // values are in the local currency of the Stripe account, not from WC. |
|
| 479 | $fee = ! empty( $result->balance_transaction->fee ) ? self::format_number( $result->balance_transaction, 'fee' ) : 0; |
|
| 480 | $net = ! empty( $result->balance_transaction->net ) ? self::format_number( $result->balance_transaction, 'net' ) : 0; |
|
| 481 | update_post_meta( $order_id, 'Stripe Fee', $fee ); |
|
| 482 | update_post_meta( $order_id, 'Net Revenue From Stripe', $net ); |
|
| 483 | } |
|
| 484 | } |
|
| 485 | } |
|
| 486 | } |
|
| @@ 865-872 (lines=8) @@ | ||
| 862 | update_post_meta( $order_id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ); |
|
| 863 | ||
| 864 | // Store other data such as fees |
|
| 865 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
| 866 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 867 | // values are in the local currency of the Stripe account, not from WC. |
|
| 868 | $fee = ! empty( $response->balance_transaction->fee ) ? WC_Stripe::format_number( $response->balance_transaction, 'fee' ) : 0; |
|
| 869 | $net = ! empty( $response->balance_transaction->net ) ? WC_Stripe::format_number( $response->balance_transaction, 'net' ) : 0; |
|
| 870 | update_post_meta( $order_id, 'Stripe Fee', $fee ); |
|
| 871 | update_post_meta( $order_id, 'Net Revenue From Stripe', $net ); |
|
| 872 | } |
|
| 873 | ||
| 874 | if ( $response->captured ) { |
|
| 875 | $order->payment_complete( $response->id ); |
|