PluginProbe
GiveWP – Donation Plugin and Fundraising Platform / 4.18.0
GiveWP – Donation Plugin and Fundraising Platform v4.18.0
4.18.0 4.17.0 4.16.9 4.16.8.1 4.16.8 4.16.7.2 4.16.7.1 4.16.7 4.16.6.1 4.16.6 4.16.5.1 4.16.5 4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 All 257 releases
give / includes / gateways / stripe / includes / class-give-stripe-invoice.php

class-give-stripe-invoice.php in GiveWP – Donation Plugin and Fundraising Platform 4.18.0, at includes/gateways/stripe/includes/class-give-stripe-invoice.php

63 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Give - Stripe Core Gateway
4 *
5 * @since 2.5.0
6 *
7 * @package Give
8 * @subpackage Stripe Core
9 * @copyright Copyright (c) 2019, GiveWP
10 * @license https://opensource.org/licenses/gpl-license GNU Public License
11 */
12
13 // Exit, if accessed directly.
14 if ( ! defined( 'ABSPATH' ) ) {
15 exit;
16 }
17
18 /**
19 * Check for class Give_Stripe_Invoices exists.
20 *
21 * @since 2.5.0
22 */
23 if ( ! class_exists( 'Give_Stripe_Invoice' ) ) {
24
25 class Give_Stripe_Invoice {
26
27 /**
28 * Retrieve Invoice/
29 *
30 * @param string $id Invoice ID.
31 *
32 * @return \Stripe\Invoice
33 */
34 public function retrieve( $id ) {
35 try {
36
37 // Set Application Information.
38 give_stripe_set_app_info();
39
40 // Retrieve Invoice by ID.
41 $invoice = \Stripe\Invoice::retrieve( $id );
42 } catch ( Exception $e ) {
43
44 // Something went wrong outside of Stripe.
45 give_record_gateway_error(
46 __( 'Stripe - Invoices Error', 'give' ),
47 sprintf(
48 /* translators: %s Exception Message. */
49 __( 'An error while retrieving invoice. Details: %s', 'give' ),
50 $e->getMessage()
51 )
52 );
53 give_set_error( 'Stripe Error', __( 'An error occurred while retrieving invoice. Please try again.', 'give' ) );
54 give_send_back_to_checkout( '?payment-mode=' . give_clean( $_GET['payment-mode'] ) );
55
56 return false;
57 }
58
59 return $invoice;
60 }
61 }
62 }
63