By Mario on Tuesday, 19 December 2017
Posted in General Issues
Replies 4
Likes 0
Views 0.9K
Votes 0
Hello,

How can I print payment_key in pdf invoice?

I need to print instead of invoice_key.

This is code that retrieve incoice key:

$invoice_key = $invoice->getKey();
...
<?php echo '#',$invoice_key; ?><br />

How Can I get payment key?

Thanks,
Mario
Hello Mario,

Find below mentioned code to get the payment key.

$payment_key = $payment->getKey();


Use this code and let me know if you have any issue.
·
Wednesday, 20 December 2017 10:25
·
0 Likes
·
0 Votes
·
0 Comments
·
OK it's works, thanks.

Just an issue:

I've add you line code after all as you can see:


if(defined('_JEXEC')===false) die();

if(isset($transaction)){
$payment = $transaction->getPayment(PAYPLANS_INSTANCE_REQUIRE);
}
$currency = $invoice->getCurrency();
$invoice_key = $invoice->getKey();
$created_date = PayplansHelperFormat::date($invoice->getCreatedDate());
$payment = $invoice->getPayment();
$payment_key = $payment->getKey();


If I request an invoice with a payment transaction I download a pdf invoice.
If I request an invoice without a transaction I receive a 500 error.

Is there a way to avoid how can I avoid $payment_key command if there is no a transaction?

Thanks,
Mario
·
Wednesday, 20 December 2017 17:16
·
0 Likes
·
0 Votes
·
0 Comments
·
Another question: where I can fount payment_key in mysql database?
In which table I can found it with a query?

Thanks,
Mario
·
Wednesday, 20 December 2017 17:44
·
0 Likes
·
0 Votes
·
0 Comments
·
Hello Mario,

Update the following line of code

$payment = $invoice->getPayment();


Change this to

$payment = $invoice->getPayment(PAYPLANS_INSTANCE_REQUIRE);


Apply this code and let me know if still issue persist.
Your site's ftp details is not working , please cross them also if still issue is there.
·
Wednesday, 20 December 2017 23:49
·
0 Likes
·
0 Votes
·
0 Comments
·
View Full Post