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 | |
// Globally setting return URL, the piece of code below | |
// should be included with the checkout shop setup code | |
MPower_Checkout_Store::setReturnUrl("http://www.myawesomeshop.com/confirm.php"); | |
// Setting the return URL on an invoice instance. | |
// This will overwrite any global settings for return URL | |
$invoice->setReturnUrl("http://www.myawesomeshop.com/confirm.php"); |
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 | |
// Custom data allows you to add extra data to the invoice information | |
// which can be accessed via our confirm API callback | |
$invoice->addCustomData("Firstname","Alswell"); | |
$invoice->addCustomData("Lastname","Cobbinah"); | |
$invoice->addCustomData("CartId",450021); | |
$invoice->addCustomData("Plan","JUMBO"); |
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 |
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
using MPowerPayments; |
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
MPowerSetup setup = new MPowerSetup { | |
MasterKey = "dd6f2c90-f075-012f-5b69-00155d864600", | |
PrivateKey = "test_private_oDLVlm1eNyh0IsetdhdJvcl0ygA", | |
PublicKey = "test_public_zzF3ywvX9DE-OSDNhUqKoaTI4wc", | |
Token = "ca03737cf942cf644f36", | |
Mode = "test" | |
}; |
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
MPowerStore store = new MPowerStore { | |
Name = "Awesome Online Store", | |
Tagline = "This is my awesome tagline", | |
PhoneNumber = "030200001", | |
PostalAddress = "P. O. Box 10770 Accra North Ghana", | |
LogoUrl = "http://www.mylogourl.com/photo.png" | |
}; |
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
// Adding items to your invoice is very basic, the parameters | |
// expected are name_of_item, quantity, unit_price, total_price and | |
// optional item description. | |
invoice.AddItem("13' Apple Retina 500 HDD",1,10.99,10.99); | |
invoice.AddItem("Case Logic laptop Bag",2,100.50,201,"Optional description"); | |
invoice.AddItem("Philips electric shaver",2,50.50,101.00); | |
/* You can optionally set a generation invoice description text which can | |
be used in cases where your invoice does not need an items list or in cases | |
where you need to include some extra descriptive information to your invoice */ |
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
invoice.SetTotalAmount (100.50); |
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
// The code below depicts how to create the checkout invoice on our servers | |
// and redirect to the checkout page. | |
if (invoice.Create ()) { | |
Console.WriteLine (invoice.Status); | |
Console.WriteLine (invoice.ResponseText); | |
Console.WriteLine (invoice.GetInvoiceUrl()); | |
} else { | |
Console.WriteLine (invoice.ResponseText); | |
Console.WriteLine (invoice.Status); | |
} |
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
// The parameters for setting add tax are title_of_the_tax, tax_amount | |
invoice.AddTax("VAT (15%)",30); | |
invoice.AddTax("NHIL (5%)",10); |