| @@ 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 ); |
|
| @@ 431-438 (lines=8) @@ | ||
| 428 | // Store other data such as fees |
|
| 429 | update_post_meta( $order->id, 'Stripe Payment ID', $result->id ); |
|
| 430 | ||
| 431 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
| 432 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 433 | // values are in the local currency of the Stripe account, not from WC. |
|
| 434 | $fee = ! empty( $result->balance_transaction->fee ) ? number_format( $result->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 435 | $net = ! empty( $result->balance_transaction->net ) ? number_format( $result->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 436 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 437 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 438 | } |
|
| 439 | } |
|
| 440 | } |
|
| 441 | } |
|