PHP:
<?php
require 'ChargeBee.php';
ChargeBee_Environment::configure("tls12", "JrnXj5Fi7xQbx2BWFdw6Vlbv3WINv9i0");
try {
$all = ChargeBee_Subscription::all(array(
"limit" => 1
));
}
catch (ChargeBee_APIError $e) {
$jsonObj = $e->getJsonObject();
if ($jsonObj['api_error_code'] == "api_authentication_failed") {
echo "Connection to TLS1.2 works.\n";
} else {
echo "Please contact support@chargebee.com with the below msg:\n";
print_r($jsonObj);
}
}
catch (Exception $e) {
echo "Contact your technical team / hosting provider for TLS1.2 support.\n";
print_r($e->getMessage());
}
?>
RUBY:
require 'chargebee';
ChargeBee.configure(:site => "tls12", :api_key => "JrnXj5Fi7xQbx2BWFdw6Vlbv3WINv9i0")
begin
list = ChargeBee::Subscription.list(:limit => 1)
rescue ChargeBee::APIError=> ex
if ex.api_error_code == "api_authentication_failed"
puts "Connection to TLS1.2 works\n"
else
puts "Please contact support@chargebee.com with the below msg:\n"
puts ex.json_obj
end
rescue Exception => ex
puts "Contact your technical team / hosting provider for TLS1.2 support.\n"
puts ex.message
end
PYTHON:
import chargebee
from chargebee.main import Environment
chargebee.configure('JrnXj5Fi7xQbx2BWFdw6Vlbv3WINv9i0', 'tls12')
try:
list = chargebee.Subscription.list({'limit': 1})
except chargebee.APIError, ex:
if ex.api_error_code == 'api_authentication_failed':
print 'Connection to TLS1.2 works'
else:
print 'Please contact support@chargebee.com with the below msg : '
print ex.json_obj
except Exception, ex:
print 'Contact your technical team / hosting provider for TLS1.2 support.'
print str(ex)
.NET:
ApiConfig.Configure("tls12", "JrnXj5Fi7xQbx2BWFdw6Vlbv3WINv9i0");
try{
ListResult result = Subscription.List()
.Limit(1).Request();
}catch(ApiException e){
if (e.ApiErrorCode == "api_authentication_failed") {
Console.WriteLine ("Connection to TLS1.2 works");
} else {
Console.WriteLine ("Please contact support@chargebee.com with the below msg");
Console.WriteLine (e.ApiErrorCode);
Console.WriteLine (e.Message);
}
} catch(Exception e) {
Console.WriteLine ("Contact your technical team / hosting provider for TLS1.2 support.");
Console.WriteLine (e.Message);
}
JAVA:
public static void main(String[] args) {
Environment.configure("tls12", "JrnXj5Fi7xQbx2BWFdw6Vlbv3WINv9i0");
try{
ListResult result = Subscription.list()
.limit(1).request();
} catch(APIException e){
if( "api_authentication_failed".equals(e.apiErrorCode)){
System.out.println("Connection to TLS1.2 works");
} else {
System.out.println("Please contact support@chargebee.com with the below msg :");
System.out.println(e.jsonObj);
}
} catch(Exception e){
System.out.println("Contact your technical team / hosting provider for TLS1.2 support.");
System.out.println(e.getMessage());
}
}
NODE:
var chargebee = require("chargebee");
chargebee.configure({'site': 'tls12','api_key': 'JrnXj5Fi7xQbx2BWFdw6Vlbv3WINv9i0'});
chargebee.subscription.list({limit : 1}).request(
function(error,result){
if( error) {
if( error.api_error_code == "api_authentication_failed") {
console.log("Connection to TLS1.2 works");
} else {
console.log("Contact your technical team / hosting provider for TLS1.2 support.");
console.log(error)
}
}
})