Skip to content

Instantly share code, notes, and snippets.

@nukturnal
Last active October 12, 2015 13:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nukturnal/4030813 to your computer and use it in GitHub Desktop.
Save nukturnal/4030813 to your computer and use it in GitHub Desktop.
MPower PHP Library Checkout Invoice Confirmation
<?php
// MPower will automatically set the confirm token to QUERY_STRING
// param $_GET['token'] if not explicitly specified
$token = $_GET["token"];
$invoice = new MPower_Checkout_Invoice();
if ($invoice->confirm($token)) {
// Retrieving Invoice Status
// Status can be either completed, pending, canceled, fail
print $invoice->getStatus();
// You can retrieve the Name, Email & Phone Number
// of the customer using the callbacks below
print $invoice->getCustomerInfo('name');
print $invoice->getCustomerInfo('email');
print $invoice->getCustomerInfo('phone');
// Return the URL to the Invoice Receipt PDF file for download
print $invoice->getReceiptUrl();
// Retrieving any custom data you have added to the invoice
// Please remember to use the right keys you used to set them earlier
print $invoice->getCustomData("Firstname");
print $invoice->getCustomData("CartId");
print $invoice->getCustomData("Plan");
// You can also callback the total amount set earlier
print $invoice->getTotalAmount();
}else{
print $invoice->getStatus();
print $invoice->response_text;
print $invoice->response_code;
}
@magbotta
Copy link

How do you get the transaction id. ? I know for direct payment it will be print $direct_pay->transaction_id;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment