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