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
# | |
# This will fetch shipments and ouput them into csv | |
# | |
# Dependencies | |
# python requests lib - pip install requests | |
# python iso8601 lib - pip install iso8601 | |
# | |
# Setup | |
# add your API key to the code | |
# |
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
require 'easypost' | |
require 'sinatra' | |
require 'json' | |
post '/webhook' do | |
e = EasyPost::Event.new | |
e.receive(JSON.parse(request.body.string)) | |
e.result.to_s | |
end |
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
from flask import Flask, request | |
import easypost | |
import json | |
app = Flask(__name__) | |
@app.route("/webhooks", methods=['POST']) | |
def webhook(): | |
e = easypost.Event() | |
e.receive(json.loads(request.form.keys()[0])) |
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
$inputJSON = file_get_contents('php://input'); | |
$event = \EasyPost\Event::receive($inputJSON); | |
if($event.description == 'tracker.updated'){ | |
//process event here | |
} | |
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(); | |
} |
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
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
$('#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
<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
//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') | |
) | |
); |