Skip to content

Instantly share code, notes, and snippets.

View nukturnal's full-sized avatar

Alfred Rowe nukturnal

View GitHub Profile
@nukturnal
nukturnal / custom_data.cs
Created November 7, 2012 16:20
MPower .NET Checkout Invoice Custom Data
// 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");
@nukturnal
nukturnal / cancelurl.cs
Created November 7, 2012 18:24
MPower .NET Checkout Invoice Cancel URL
// Globally setting cancel URL, the piece of code below
// should be included with the checkout shop setup code
MPowerStore store = new MPowerStore {
CancelUrl = "http://www.myawesomeshop.com/"
};
// Setting the cancel URL on an invoice instance.
// This will overwrite any global settings for cancel URL
invoice.SetCancelUrl("http://www.myawesomeshop.com/");
@nukturnal
nukturnal / returnurl.cs
Created November 7, 2012 18:30
MPower .NET Checkout Invoice Return URL
// Globally setting return URL, the piece of code below
// should be included with the checkout shop setup code
MPowerStore store = new MPowerStore {
ReturnUrl = "http://www.myawesomeshop.com/confirm.aspx"
};
// Setting the return URL on an invoice instance.
// This will overwrite any global settings for return URL
invoice.SetReturnUrl("http://www.myawesomeshop.com/confirm.aspx");
@nukturnal
nukturnal / confirm_invoice.cs
Created November 7, 2012 19:11
MPower .NET Library Checkout Invoice Confirmation
// Invoice token is returned as a URL query string "token"
// You are free to also explicitly check the status of an invoice
string InvoiceToken = "sjklsdll21-ms0w";
MPowerCheckoutInvoice invoice = new MPowerCheckoutInvoice (setup, store);
if (invoice.Confirm(InvoiceToken)) {
// Retrieving Invoice Status
// Status can be either completed, pending, canceled, fail
Console.WriteLine (invoice.Status);
@nukturnal
nukturnal / mpower_gem
Created November 7, 2012 20:10
MPower Ruby Gem Installation
gem install mpower
@nukturnal
nukturnal / Gemfile
Created November 7, 2012 20:14
MPower Gemfile
gem "mpower"
@nukturnal
nukturnal / mpower_init.rb
Created November 7, 2012 20:28
MPower Ruby API keys set up
MPower::Setup.master_key = "sdd6f2c90-f075-01d2f-5b69-00155d866600"
MPower::Setup.public_key = "test_public_zzF34wvX9DE-OSDNhUqKoaTI4wc"
MPower::Setup.private_key = "test_private_oDLVfm1e3yh0IsetdhdJvcl0ygA"
MPower::Setup.mode = "test"
MPower::Setup.token = "ca03737cf942cfg44f36"
@nukturnal
nukturnal / mpower_init.rb
Created November 7, 2012 20:37
MPower PHP Checkout Store Configuration
MPower::Checkout::Store.name = "My Awesome Online Store"
MPower::Checkout::Store.tagline = "My awesome store's awesome tagline"
MPower::Checkout::Store.postal_address = "Post office Box AN 10604"
MPower::Checkout::Store.phone_number = "0302507099"
@nukturnal
nukturnal / building_checkout_invoice.rb
Created November 7, 2012 22:16
MPower Ruby Building a Checkout Invoice
# 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.add_item("13' Apple Retina 500 HDD",1,10.99,10.99);
invoice.add_item("Case Logic laptop Bag",2,100.50,201,"Optional description");
invoice.add_item("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
invoice.description = "Optional Invoice description here";
@nukturnal
nukturnal / total_amount.rb
Created November 8, 2012 05:17
MPower Ruby Checkout Total Amount Set
invoice.total_amount = 100.50