This file contains hidden or 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
#add this after adding your api key, before you make any calls to the API | |
log = logging.getLogger('recurly.http.response') | |
log.setLevel(logging.DEBUG) | |
#create console handler and set level to debug | |
ch = logging.StreamHandler() | |
ch.setLevel(logging.DEBUG) | |
#create formatter | |
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") | |
#add formatter to ch | |
ch.setFormatter(formatter) |
This file contains hidden or 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
try { | |
$pdf = Recurly_Invoice::getInvoicePdf('2149', 'en-US'); | |
} catch (Recurly_NotFoundError $e) { | |
print "Invoice not found.\n"; | |
} | |
header('Content-type: application/pdf'); | |
header('Accept-Language: en-US'); | |
header('Content-Disposition: attachment; filename="downloaded.pdf"'); |
This file contains hidden or 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
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'test_gbp_1234'),'subscription' => array('plan_code' => 'instant'))); | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'test_1234'))); | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'test_382re6'),'subscription' => array('plan_code' => 'test-plan-333806','starts_at'=>'Wednesday, August 22, 2012 12:00:00 PM GMT-6'))); | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'tsakdfjl225'),'subscription' => array('plan_code' => 'test-plan-340480','quantity'=>'2','trial_ends_at'=>'Sunday, June 3, 2012 4:35:00 PM GMT-6','unit_amount_in_cents'=>20000))); | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'tsakdfjl330'),'subscription' => array('plan_code' => 'setup_fee','currency'=>'USD', 'unit_amount_in_cents' => '22_00'))); | |
$signature = Recurly_js::sign(array('account'=>array('account_code'=>'aaa1234588'),'subscription' => array('plan_code' => 'plan_trial','currency'=>'USD', |
This file contains hidden or 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
Recurly.buildSubscriptionForm({ | |
/* other options */ | |
subscription: { | |
couponCode: 'testplan' | |
}, | |
distinguishContactFromBillingInfo: true, | |
afterInject: function(){ | |
$('.interval').hide(); | |
}, | |
}); |
This file contains hidden or 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
//Samples in PHP | |
//starts_at | |
$signature = Recurly_js::sign(array( | |
'account'=>array('account_code'=>'my_account_code'), | |
'subscription' => array( | |
'plan_code' => 'test-plan-340480', | |
'starts_at'=>'2013-09-30T12:06:36-06:00') | |
) | |
); |
This file contains hidden or 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
<script> | |
var signature = "<?php echo Recurly_js::sign(array( | |
'account'=>array('account_code'=>'test_gbp_1234'), | |
'subscription' => array('plan_code' => 'instant') | |
)); ?>"; | |
</script> |
This file contains hidden or 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
$('#submit-btn').click(function({ | |
$.ajax({ | |
dataType: 'jsonp', | |
url: 'https://(your-subdomain).recurly.com/jsonp/(your-subdomain)/subscribe', | |
data: { | |
signature: signature, | |
billing_info: { | |
first_name: 'Ned', | |
last_name: 'Stark', | |
address1: '1234 Winterfell Rd', |
This file contains hidden or 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
success: function (data) { | |
//if the error object exits | |
//then ther submission was | |
//not sucessful | |
if(errors in data){ | |
//handle the errors | |
} else { | |
// it was successful | |
} | |
}, |
This file contains hidden or 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
$signature = Recurly_js::sign(array( | |
'account'=>array('account_code'=>'_my_account_code'), | |
'subscription' => array('plan_code' => 'instant') | |
) | |
); |
This file contains hidden or 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
Recurly.buildSubscriptionForm({ | |
/* other options */ | |
subscription: { | |
couponCode: 'testplan' | |
}, | |
distinguishContactFromBillingInfo: true, | |
afterInject: function(){ | |
if($('.coupon_code').val()){ | |
$('div.check').click(); | |
} |