Receipt Page

Display a receipt for an SDK transaction.

This code section sets up the Receipt page when using SDK giving forms.


This function accepts a CreateTransactionResult object as its argument. From that data, it will render the receipt page.

This function is self-contained except for a local object theData, which stores form data in a redundant object.

theData.truncatedCardData is created at the end of the Recaptcha Callback function: theData.truncatedCardData = "****" + $('#cardData-cardNumber').val().slice(12,16);

function renderReceiptElements(dataIn) {

     //Accepts CreateTransactionResult object as argument.

     //Get date
     var date = new Date();
     var ddmmyyyy = [
         String(date.getMonth() + 1),

     var dateText = ddmmyyyy[0] + '/' + ddmmyyyy[1] + '/' + ddmmyyyy[2];

     //Donor name
     $('#receipt-name-text').text("" + + " " +;

     //Receipt date
     $('#receipt-date-text').text("" + dateText);

     $('#receipt-gift-text').text("$" + dataIn._raw_response.transaction.total_value);

     $('#receipt-frequency-text').text("" + dataIn._raw_response.form_data.frequency);

     //Truncated card
     $('#receipt-card-text').text("" + theData.truncatedCardData);

     //Set initial form to invisible
     $('#transaction-data').css('display', 'none');

     //Set receipt to visible

     //For some reason there must be explicit css here
    $('.receipt-container').css('display', 'block');
    $('.receipt-container').css('opacity', '1');