Method Community

 

Sending method invoice (API)

Last post 03-16-2015 12:27 PM by Method_Alexander. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 03-11-2015 11:02 AM

    • EricW
    • Top 500 Contributor
    • Joined on 12-19-2014
    • Posts 8

    Sending method invoice (API)

    Hi,

    Can someone please explain the basics around sending an invoice via API which contains the portal link for payment? We would like to use Method portals as our payment processing interface but are trying to get a clearer understanding of how to tackle this in the most logical way.

    Our vision: When a customer clicks a check-out button, we want to send (post) the cart details to Method which Method will handle the payment processing from there. (via the typical invoice email with portal link)

    Which API calls do we use for this?

  • 03-13-2015 3:09 PM In reply to

    • EricW
    • Top 500 Contributor
    • Joined on 12-19-2014
    • Posts 8

    Re: Sending method invoice (API)

    Is this not possible? I do not see API calls or anything hinting at invoice creation in the API documentation. I'm thinking that either it's not possible or it's done using the basic write to field calls but confirmation would be great.

  • 03-16-2015 12:27 PM In reply to

    Re: Sending method invoice (API)

    Hello,

    Creating an invoice and generating a portal link is perfectly possible through the API.  You first have to create the invoice, and line items, then call send to desktop, and finally generate a portal link.

    I've attached a code sample which does this below for a simple invoice


    var MAPIsvc = new MethodAPIService.Service();
    string account = txtAccountName.Text;
    string email = txtLoginEmail.Text;
    string pwd = txtLoginPassword.Text;

    string recordId = "";
    string tablename = "Invoice";
    string[ fields = "Customer,BillAddressAddr1,DueDate,TxnDate".Split(',');
    string[ values = "Fake Company,123 Fake St,2015-03-16 12:00:00,2015-03-16 12:00:00".Split(',');
    txtResponse.Text = MAPIsvc.MethodAPIInsert(account, email, pwd, tablename, fields, values, ref recordId);

    tablename = "InvoiceLine";
    fields = "InvoiceRecordID,Item,Quantity,Rate,RateInclusive,SalesTaxCode".Split(',');
    values = (recordId+",Hours,10,25,25,Non").Split(',');
    txtResponse.Text = MAPIsvc.MethodAPIInsert(account, email, pwd, tablename, fields, values, ref recordId);

    txtResponse.Text = MAPIsvc.MethodAPIActionSendToDesktopV2(account, email, pwd, "", "Invoice", recordId);

    txtResponse.Text = MAPIsvc.MethodAPIGetScreenURLV4(account, email, pwd, null, "MIurl", "Customers", "Recent Transactions", null, null, null, true, "Contacts_Portal","289");

Page 1 of 1 (3 items)