Invoicing details needed for WorldPay

Discussion in 'Payments processing' started by bennyuk1, Jul 10, 2017.

  1. bennyuk1

    bennyuk1 aMember Pro Customer

    Joined:
    Jan 12, 2012
    Messages:
    200
    Old amamber v4 used to do this I'm sure.

    I need each invoice to have the WorldPay transaction ID number on it, plus mention of that number in "payments history" page.

    In admin area it is "$payment->receipt_id"

    It used to be recorded on PDF invoices after the invoice number, but since going to amember v5 it no longer seems to be there.

    Having the transaction ID is CRUCIAL when working with WorldPay as it is the only way of linking up users payments. Admin users can see the transaction ID ($payment->receipt_id), but users need to see this as well.

    Additionally it would be nice if it could be displayed after "$p->_paysysName" in "payment-history.phtml".

    Please can this be done!?

    Ben
  2. caesar

    caesar aMember Pro Developer Staff Member

    Joined:
    Oct 16, 2009
    Messages:
    2,295
    Hello Ben,

    You can achieve both stuff with custom code in site.php file:
    http://www.amember.com/docs/Site.php_file

    Add Transaction ID to PDF invoice:
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::PDF_INVOICE_COL_LEFT, function (Am_Event $e) {
        
    /* @var $payment InvoicePayment */
        
    $payment $e->getPayment();

        
    $col $e->getCol();
        
    $col->addAfter("Transaction ID: {$payment->receipt_id}"'invoiceNumber');
    });
    Add Transaction ID to Payment History page (for latest version - 5.2.6):
    PHP:
    Am_Di::getInstance()->hook->add(Am_Event::BEFORE_RENDER, function(Am_Event $e) {
        if (
    preg_match('/.*member-history-paymenttable\.phtml$/'$e->getTemplateName())) {
            
    $v $e->getView();
            foreach (
    $v->payments as & $p) {
                
    $p->_paysysName .= "/{$p->receipt_id}";
            }
        }
    });
    Reference:
    http://www.amember.com/docs/How_to_customize_PDF_invoice_output
    http://www.amember.com/docs/API/HookManager

Share This Page