Skip to content
Sina Soltani edited this page Oct 7, 2019 · 23 revisions

Invoice Builder helps you to create and customize an invoice.

Requesting a payment

A simple payment request is something like:

var result = _onlinePayment.Request("Mellat", 123, 25000, "http://www.mywebsite.com/foo/bar/");

You can make the same request by using the Invoice Builder like so:

var result = _onlinePayment.Request(invoice =>
{
    invoice
          .SetTrackingNumber(123)
          .SetAmount(25000)
          .SetCallbackUrl("http://www.mywebsite.com/foo/bar/")
          .UseGateway("Mellat");

        // OR

          .UseMellat();
});

Note: Gateway name is not case sensitive. "Mellat" == "mellat" == "MELLAT"

Using Auto Increment Tracking Number

var result = _onlinePayment.Request(invoice =>
{
    invoice
          .UseAutoIncrementTrackingNumber()
});

It generates automatically a new tracking number which is one unit greater than the latest number.

Using Auto Random Tracking Number

var result = _onlinePayment.Request(invoice =>
{
    invoice
          .UseAutoRandomTrackingNumber()
});

It generates automatically a new tracking number which is an Int64 number.

Requesting a payment with a specific account

var result = _onlinePayment.Request(invoice =>
{
    invoice
          .UseAccount("Account 1");
});

See also Adding multiple accounts