| @@ 649-656 (lines=8) @@ | ||
| 646 | update_post_meta( $order->id, '_stripe_charge_captured', $response->captured ? 'yes' : 'no' ); |
|
| 647 | ||
| 648 | // Store other data such as fees |
|
| 649 | if ( isset( $response->balance_transaction ) && isset( $response->balance_transaction->fee ) ) { |
|
| 650 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 651 | // values are in the local currency of the Stripe account, not from WC. |
|
| 652 | $fee = ! empty( $response->balance_transaction->fee ) ? number_format( $response->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 653 | $net = ! empty( $response->balance_transaction->net ) ? number_format( $response->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 654 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 655 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 656 | } |
|
| 657 | ||
| 658 | if ( $response->captured ) { |
|
| 659 | $order->payment_complete( $response->id ); |
|
| @@ 327-334 (lines=8) @@ | ||
| 324 | // Store other data such as fees |
|
| 325 | update_post_meta( $order->id, 'Stripe Payment ID', $result->id ); |
|
| 326 | ||
| 327 | if ( isset( $result->balance_transaction ) && isset( $result->balance_transaction->fee ) ) { |
|
| 328 | // Fees and Net needs to both come from Stripe to be accurate as the returned |
|
| 329 | // values are in the local currency of the Stripe account, not from WC. |
|
| 330 | $fee = ! empty( $result->balance_transaction->fee ) ? number_format( $result->balance_transaction->fee / 100, 2, '.', '' ) : 0; |
|
| 331 | $net = ! empty( $result->balance_transaction->net ) ? number_format( $result->balance_transaction->net / 100, 2, '.', '' ) : 0; |
|
| 332 | update_post_meta( $order->id, 'Stripe Fee', $fee ); |
|
| 333 | update_post_meta( $order->id, 'Net Revenue From Stripe', $net ); |
|
| 334 | } |
|
| 335 | } |
|
| 336 | } |
|
| 337 | } |
|