Login

Recover Your Password

Welcome

Bring Your Vision To Life

We provide software and services that enable our customers and partners to turn advanced technology into real solutions.

What We Do

Contensive works as a team member with client partners, providing the highest level of technical competence and support in the design, production, management & lifecycle support of online applications.

api illustration
API Integration

You name it, we can integrate it

mobile development illustration
Mobile App Development

Custom mobile apps that can do everything

cloud app dev illustration
Cloud Application Development

Customized applications with the features you need

cloud host illustration
Best-In-Class Cloud Hosting

AWS platform, the leader in cloud computing

life cycle illustration
Life Cycle Management

Continuous monitoring, user support, and training

business process illustration
Business Process Automation

Streamline your operations and increase efficiencies

Let’s work on a solution to your problem today!

Process

Agile Software Development Process

Benefits

Why You Should Choose Contensive

The greatest product we offer is our experienced team and our dedication to real-world, time-tested principles: a realistic budget, a disciplined process, and enough flexibility and creativity to accommodate any requirement.

contensive favicon
Proven Development Process

Our agile scrum process allows total transparency

contensive favicon
Time Tested Principles

We follow best practices to get the best results

contensive favicon
Realistic Budget

Payment options that will help you succeed

contensive favicon
Expertise

30+ year history of customer success and profitability

contensive favicon
Talented Team Members

Each developer has disparate skill sets & decades of experience

Experience

Contensive’s Experience

Contensive provides software and services that enable our customers and partners to turn advanced technology into real solutions.

100k+

e-commerce transactions a month

1st

Website allowed in the chamber of US Supreme Court

8 years

Average relationship with client

600+

Websites and applications created

30+

years of experience

300k+

People visiting our applications

Contact Us

Questions?
Call Us (703)-251-0624

Tech Support
support@contensive.com

Return to Product Support > Learning Center > Developer References > Developer Tutorials > eCommerce API workflow

eCommerce API workflow

This tutorial shows you how to integrate eCommerce API into your add-on.

Configure your Visual Studio project

  1. Start a Contensive addon Collection project and an addon collection that will call the API (Creating a new addon collection)
  2. Checkout the GitHub Release project (GitHub.com/Contensive/Release)
  3. Add a project reference to accountBillingApi (accountBillingApi.dll from the release project)
  4. The api object is class apiClass, in namespace Contensive.Addons.aoAccountBilling

Install supporting add-on collection to your application

  1. From the addon manager, add eCommerce - https://github.com/contensive/aoEcommerce

To get the user's account, or create a new one

  1. Get the accountId from the user's record

    dim cs as cpcsbaseClass = cp.csNew()
    dim accountId as integer=0
    if cs.Open( "people", "id=" & cp.user.id ) then
       accountId = cs.getInteger( "accountId" )
    end if
    call cs.close()
  2. Check if the user's account is valid, if not create a new account for them

    Dim accountStatus As New apiClass.accountStatusStruct
    accountStatus = api.getAccountStatus(cp, returnUserError, accountId)
    ' accountStatus.closed is a valid account that has been closed
    ' accountStatus.currentBalance is the balance due
    ' accountStatus.exists is true if the account exists
    ' accountStatus.pastDueAmount is the past due balance
    ' returnUserError if not blank, this is a user appropriate message
    if (not accountStatus.exists) or (accountStatus.closed) then
        if cs.Open( "people", "id=" & cp.user.id ) then
            call cs.setField( "accountId", 0 )
        end if
        call cs.close()
       accountId = api.createAccount( cp.user.id, "New Account Name" )
    end if

To create an order and add an item

  1. Create the order and assign the account

    dim orderId as integer
    orderId = api.createOrder()
    call setOrderAccount( orderId, accountId )
    call addOrderItem( orderId, itemId )

Create a page with the generic online payment form and process the results

  1. Create an addon that returns the onlinePaymentFields in a form. Place it on a page with secure certificate (https:// is required)

    returnHtml = cp.html.form( api.getOnlinePaymentFields())

  2. When this form is submitted, process it

    if not api.payOrdersByOnlinePaymentFields( cp, returnUserError, orderIdList, paymentComment1, paymentComment2 ) then
        ' there was a problem with the order, a user compatible message is in returnUserError
    else
        ' the order processed correctly.
    end if

Process the order with the user's account


if not api.chargeOrder( cp, returnUserError, orderId, paymentComment1, paymentComment2 ) then
    ' there was a problem with the order, a user compatible message is in returnUserError
else
    ' the order processed correctly.
end if

Process the order with a credit card or online check (ACH)

dim method as onDemandMethodStruct
method.creditCardNumber = ""        ' card number
method.creditCardExpiration = ""     ' mm/dd/yyyy string of last day of the month the card expires
method.creditSecurityCode = ""       ' CVV code on the back of the card
if not api.payOrder( cp, returnUserError, orderId, paymentComment1, paymentComment2 ) then
    ' there was a problem with the order, a user compatible message is in returnUserError
else
    ' the order processed correctly.
end if