| @@ 833-840 (lines=8) @@ | ||
| 830 | update_post_meta( $order_id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ); |
|
| 831 | ||
| 832 | // Store other data such as fees |
|
| 833 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
| 834 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 835 | // values are in the local currency of the Stripe account, not from WC. |
|
| 836 | $fee = ! empty( $response->balance_transaction->fee ) ? WC_Stripe::format_number( $response->balance_transaction, 'fee' ) : 0; |
|
| 837 | $net = ! empty( $response->balance_transaction->net ) ? WC_Stripe::format_number( $response->balance_transaction, 'net' ) : 0; |
|
| 838 | update_post_meta( $order_id, 'Stripe Fee', $fee ); |
|
| 839 | update_post_meta( $order_id, 'Net Revenue From Stripe', $net ); |
|
| 840 | } |
|
| 841 | ||
| 842 | if ( $response->captured ) { |
|
| 843 | $order->payment_complete( $response->id ); |
|
| @@ 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 | } |
|