Paymentsense integration

Thanks for the data. If you have another moment, let me know how you’d like the template formatted.

e.g.

<L00>Transaction Id: 23882939
<L00>Type: VISA DEBIT
<L00>Verification: NONE
<L00>Approval Code: 3858
<L00>Account No.: ************7091

Don’t worry too much about the <> tags as I’ll allow you to specify that as well as the pipe character if you want to <Jxx> the line

Looks like the card number is still incorectly labeled as name :upside_down_face:

Here’s what I have so far:

2021-06-23_13;17_1624475821_%pn

the only issue I ran into was the script doesn’t run in [PAYMENTS:Credit Card] when {TICKET ID} is passed for whatever reason so you’ll have to throw it somewhere in the [LAYOUT] section.

That’s basically the right format as-is

It seems the card number comes thru in both Name and Account No.

Passing the name across wouldn’t be complaint with PCIDSS I don’t think?

Sounds good to me! I’m going to use this as a separate template anyway so that would work well

Pretty sure it does come back, was a while ago now but from memory when I was testing the beta pretty sure they were reversed so seems was part fixed, not end of world.
Pretty sure name is available, sure I have seen name on card receipt before now.

What is funny about that is we just dump the entire return from them into that json. We dont name any of it. So I think Paymentsense has it wrong :stuck_out_tongue:

1 Like

But has changed since beta, guess change there end

None the less I could be wrong and I will pass that to vehbi. But Im pretty sure he just dumps the return in there. Its different for each of our usa integrations.

There are printer tags for it {PAYMENT DATA:X} But its only usable under [PAYMENTS] So sql is best for building templates especially if you do multiple payments. Or you want it under somewhere else besides where {PAYMENTS} is.

For my case I wanted the info at the top of the receipt and separate from {PAYMENTS} so SQL was the only method.

Sorry to keep you hanging. I had to water the dog.

Handler: paymentData

function get(ticketId, lineFormatting, fullLineChar)
{
    var merchantId = 'merchant id here';
    var pipeChar = '';
    
    if (lineFormatting.substr(1,1) == 'J')
    {
        pipeChar = '|';
    }
    
    var q = "SELECT PaymentData FROM dbo.Payments WHERE TicketId = " + ticketId;
    var json = sql.Query(q).First;
    
    if (json == '')
    {
        return '';
    }
    
    json = json.replace(/(?:\\[rn])+/g, "", '');
    
    var jsonObj = JSON.parse(json);
    
    var returnData = 
    lineFormatting + 'Merchant Id: ' + pipeChar + merchantId + '\n' +
    lineFormatting + 'Transaction Id: ' + pipeChar + jsonObj.TransactionID + '\n' +
    lineFormatting + 'Type: ' + pipeChar + jsonObj.CardBrand + '\n' +
    lineFormatting + 'Verification: ' + pipeChar + jsonObj.cardholderVerificationMethod + '\n' +
    lineFormatting + 'Approval Code: ' + pipeChar + jsonObj.ApprovalCode + '\n' +
    lineFormatting + 'Account No.: ' + pipeChar + jsonObj.Account;
    
    if (fullLineChar != '')
    {
        returnData =  '\n' + returnData + '\n' + '<F>' + fullLineChar;
    }
    
    return returnData;
}

Replace “merchant id here” with your merchant id. If you pass an empty string as fullLineChar nothing for that will be returned.

usage:

{CALL:paymentData.get('{TICKET ID}','<J00>', '=')}

This will only work for one payment. Let me know if you regularly have multiple cc payments per ticket and I’ll see what I can do.

2 Likes

Ok - amazing. What do I need to do, just add this as a script? And then the printer tags you mentioned above into the template?

Sorry for being a bit slow on this haha

I think so, yes. It seems current U.K. regs prohibit the name being present on the receipt

Yep yep

Throw it into Scripts

2021-06-24_08;37_1624545432_Samba.Presentation

place this

{CALL:paymentData.get('{TICKET ID}','<J00>', '=')}

wherever you’d like the data populated

The second argument is the tag you’d like each line to start with. The third argument is a full-width line/footer () of whatever character specified. If an empty string is specified, no full line/footer is returned.

{CALL:paymentData.get('{TICKET ID}','<J00>', '=')}

yields

2021-06-24_08;42_1624545750_Samba.Presentation

{CALL:paymentData.get('{TICKET ID}','<J00>', '')}

yields

2021-06-24_08;43_1624545792_Samba.Presentation

Also, wherever in your template you place the script call and there is no payment data, no additional lines will be added to the print.

2 Likes

Remember payment data will only populate After ticket is closed. You can force it by using save ticket action before your print action in the payment processed rule.

This is awesome. Thanks so much for this

End result looks fantastic!! Thanks both.

2 Likes