Last active
August 29, 2019 16:09
-
-
Save dancameron/47c1a983ef6487831b9b8bb9b3d855c8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Updated the method to make sure the vars are being passed. | |
*/ | |
public static function setAppInfo( $appName, $appVersion = null, $appUrl = null, $appPartnerId = null ) { | |
error_log( 'vars: ' . print_r( get_defined_vars(), true ) ); | |
self::$appInfo = self::$appInfo ?: []; | |
self::$appInfo['name'] = $appName; | |
self::$appInfo['partner_id'] = $appPartnerId; | |
self::$appInfo['url'] = $appUrl; | |
self::$appInfo['version'] = $appVersion; | |
error_log( 'appinfo: ' . print_r( self::$appInfo, true ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[29-Aug-2019 16:07:38 UTC] vars: Array | |
( | |
[appName] => WordPress Sprout Invoices | |
[appVersion] => 19.9 | |
[appUrl] => https://sproutinvoices.com/ | |
[appPartnerId] => pp_partner_DL3bDXVUCYCNPQ | |
) | |
[29-Aug-2019 16:07:38 UTC] appinfo: Array | |
( | |
[name] => WordPress Sprout Invoices | |
[partner_id] => pp_partner_DL3bDXVUCYCNPQ | |
[url] => https://sproutinvoices.com/ | |
[version] => 19.9 | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Exact code to load SDK | |
*/ | |
private static function load_sdk() { | |
if ( ! class_exists( 'Stripe' ) ) { | |
require_once 'inc/sdk/init.php'; | |
} else { | |
do_action( 'si_error', __CLASS__ . '::' . __FUNCTION__ . ' - the Stripe class is already included.', null ); | |
} | |
try { | |
// Setup the API | |
$key = ( self::is_test() ) ? self::$api_secret_key_test : self::$api_secret_key; | |
\Stripe\Stripe::setAppInfo( | |
'Sprout Invoices', | |
self::SI_VERSION, | |
'https://sproutinvoices.com/sprout-invoices/', | |
'pp_partner_DL3bDXVUCYCNPQ' | |
); | |
\Stripe\Stripe::setApiKey( $key ); | |
} catch ( Exception $e ) { | |
self::set_error_messages( $e->getMessage() ); | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment