Last active
October 12, 2015 13:07
-
-
Save nukturnal/4030813 to your computer and use it in GitHub Desktop.
MPower PHP Library Checkout Invoice Confirmation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you get the transaction id. ? I know for direct payment it will be print $direct_pay->transaction_id;