Skip to content

Instantly share code, notes, and snippets.

View SidneyAllen's full-sized avatar

Sidney Maestre SidneyAllen

View GitHub Profile
$('#paid').live('pageshow',function(e) {
});
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-02
Created December 14, 2011 16:51
jqm-cf-subscribe-02
var profile = $.parseJSON(localStorage.getItem('123'));
// 3rd State
if(profile !== null) {
...
} else {
// 1st state
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-03
Created December 14, 2011 17:03
jqm-cf-subscribe-03
$('#subscribe').live('click',function(e)
{
$.mobile.showPageLoadingMsg();
$.ajax({
url: 'subscriptions.cfc',
data: 'method=setExpressCheckout',
success: function(data){
var obj = $.parseJSON(data);
window.location = obj['redirecturl']
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-04
Created December 14, 2011 17:08
jqm-cf-subscribe-04
// Our method, credentials, and api version
data.METHOD = "SetExpressCheckout";
data.USER = request.UID;
data.PWD = request.PASSWORD;
data.SIGNATURE = request.SIG;
data.METHOD = "SetExpressCheckout";
data.VERSION = request.VER;
// Our api endpoint
data.URLBASE = request.URLBASE;
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-05
Created December 14, 2011 17:11
jqm-cf-subscribe-05
<cfscript>
returnObj = StructNew();
returnObj['url'] = url;
</cfscript>
<script>
ec = <cfoutput>#serializeJSON(returnObj)#</cfoutput>;
</script>
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-06
Created December 14, 2011 17:14
jqm-cf-subscribe-06
$.ajax({
url: 'subscriptions.cfc',
data: 'method=GetExpressCheckoutDetails&token=' +
ec['url']['token'],
success: function(data){
var obj = $.parseJSON(data);
detail = obj;
$('#amt').html('Our premium 1 year subscription costs $' +
obj['response']['AMT']);
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-07
Created December 14, 2011 17:23
jqm-cf-subscribe-07
$('#confirm').live('click',function(e) {
$.mobile.showPageLoadingMsg();
$.ajax({
url: 'subscriptions.cfc',
data: 'method=CreateRecurringPaymentsProfile&token=' + detail['response']['TOKEN'],
success: function(data){
var obj = $.parseJSON(data);
profile = obj['response'];;
@SidneyAllen
SidneyAllen / jqm-cf-subscribe-08
Created December 14, 2011 17:38
jqm-cf-subscribe-08
var profile = $.parseJSON(localStorage.getItem('123'));
$.mobile.showPageLoadingMsg();
// PROFILE ALREADY EXISTS, VERIFY IT.
if(profile !== null)
{
if (profile['PROFILESTATUS'] === 'ActiveProfile')
{
$.ajax({
url: 'subscriptions.cfc',
@SidneyAllen
SidneyAllen / gist:1667180
Created January 24, 2012 01:35
PayPal Pay Request ColdFusion
<cfinvoke component="adaptivepayments" method="payRequest" returnvariable="response">
<!--- REQUIRED --->
<cfinvokeargument name="contextPath" value="#GetDirectoryFromPath(SCRIPT_NAME)#">
<cfinvokeargument name="returnPage" value="WebflowReturnPage.cfm">
<cfinvokeargument name="cancelPage" value="Pay.cfm">
<cfinvokeargument name="receiverAmount" value="#form['receiverAmount[]']#">
<cfinvokeargument name="receiverEmail" value="#form['receiverEmail[]']#">
<cfinvokeargument name="actionType" value="#form.actionType#">
<cfinvokeargument name="currencyCode" value="USD">
@SidneyAllen
SidneyAllen / AP.SimplePay.Form
Created January 25, 2012 18:14
AP - SimplePay - Form
<form name="Form1" id="Form1" action="SimplePay.cfm" method="post">
<label>Sender's Email</label>
<input type="text" id="senderEmail" name="senderEmail" value="[email protected]" class="input-text">
<label>Receiver's Email</label>
<input type="text" id="receiverEmail" name="receiverEmail" value="[email protected]" class="input-text">
<label>Amount you ar sending</label>
<input type="text" id="receiverAmount" name="receiverAmount" value="1.00" class="input-text">