ProcessCheckout

Description

This class is an instantion of the Command class, that executes a command pertaining to processing order information, in the default case from the database. This class should only be instantiated by dispatchMBAPI() found in include/mbapi/mbapi.php. Something similar to the following XML should be passed to dispatchMBAPI() when you want to call the ProcessOrder command:

Attributes

package
modernbill
subpackage
mbapi
author
Kris Bailey
version
0.9

Example Request

	<mbapi>
		<command><!-- None --></command>
		<subCommand><!-- string --></subCommand>
		<params>
			<orderFormID><!-- int --></orderFormID>
			<paymentType><!-- int --></paymentType>
			<secondary><!-- int --></secondary>
			<invoiceID><!-- int --></invoiceID>
			<fraudLevelAction><!-- int --></fraudLevelAction>
			<fraudLevelActionStatus><!-- int --></fraudLevelActionStatus>
			<enableInvoiceEmail><!-- int --></enableInvoiceEmail>
			<disableProvisioning><!-- int --></disableProvisioning>
			<disableInvoicing><!-- int --></disableInvoicing>
			<disableCharging><!-- int --></disableCharging>
			<disableBillingShares><!-- int --></disableBillingShares>
			<disableFraudguardian><!-- int --></disableFraudguardian>
			<disableClientUpdates><!-- int --></disableClientUpdates>
			<overrideDateDue><!-- int --></overrideDateDue>
			<overrideTransactionType><!-- string --></overrideTransactionType>
			<client>
				<clientID><!-- int --></clientID>
				<clientFirstName><!-- string --></clientFirstName>
				<clientLastName><!-- string --></clientLastName>
				<clientEmail><!-- string --></clientEmail>
				<clientCompany><!-- string --></clientCompany>
				<clientComments><!-- string --></clientComments>
				<contactUsername><!-- string --></contactUsername>
				<contactPassword><!-- string --></contactPassword>
				<languageID><!-- string --></languageID>
				<countriesID><!-- int --></countriesID>
				<themeID><!-- int --></themeID>
				<companyID><!-- int --></companyID>
				<clientSignupIP><!-- int --></clientSignupIP>
				<clientLastIP><!-- int --></clientLastIP>
			</client>
			<clientContact>
				<clientContactID><!-- int --></clientContactID>
				<contactAddress1><!-- string --></contactAddress1>
				<contactAddress2><!-- string --></contactAddress2>
				<contactCity><!-- string --></contactCity>
				<contactState><!-- string --></contactState>
				<contactZip><!-- string --></contactZip>
				<contactPhone1><!-- string --></contactPhone1>
				<contactPhone2><!-- string --></contactPhone2>
				<contactFax><!-- string --></contactFax>
			</clientContact>
			<clientBillingAccount>
				<billingAccountID><!-- int --></billingAccountID>
				<billingAccountType><!-- int --></billingAccountType>
				<billingCardNameOnCard><!-- string --></billingCardNameOnCard>
				<billingCardType><!-- int --></billingCardType>
				<billingCardNum><!-- string --></billingCardNum>
				<billingCardExpMonth><!-- string --></billingCardExpMonth>
				<billingCardExpYear><!-- string --></billingCardExpYear>
				<billingCardIssueNum><!-- string --></billingCardIssueNum>
				<billingCardStartDate><!-- string --></billingCardStartDate>
				<cardCVV2><!-- string --></cardCVV2>
				<billingBankName><!-- string --></billingBankName>
				<billingBankState><!-- string --></billingBankState>
				<billingBankAbaCode><!-- string --></billingBankAbaCode>
				<billingBankAccountNum><!-- string --></billingBankAccountNum>
				<billingBankLicenseNum><!-- string --></billingBankLicenseNum>
				<billingBankLicenseState><!-- string --></billingBankLicenseState>
				<billingBankDob><!-- string --></billingBankDob>
			</clientBillingAccount>
			<domainRegistrant>
				<registrantFirstName><!-- string --></registrantFirstName>
				<registrantLastName><!-- string --></registrantLastName>
				<registrantAddress1><!-- string --></registrantAddress1>
				<registrantAddress2><!-- string --></registrantAddress2>
				<registrantCity><!-- string --></registrantCity>
				<registrantStateProvince><!-- string --></registrantStateProvince>
				<registrantPostalCode><!-- string --></registrantPostalCode>
				<registrantOrganizationName><!-- string --></registrantOrganizationName>
				<registrantJobTitle><!-- string --></registrantJobTitle>
				<registrantEmail><!-- string --></registrantEmail>
				<registrantPhone><!-- string --></registrantPhone>
				<registrantFax><!-- string --></registrantFax>
				<registrantCountry><!-- string --></registrantCountry>
			</domainRegistrant>
			<attributes>
				<attribute>
					<attributeID><!-- int --></attributeID>
					<questionID><!-- int --></questionID>
					<answers>
						<answer><!-- string --></answer>
					</answers>
				</attribute>
			</attributes>
			<packageUsername><!-- string --></packageUsername>
			<packagePassword><!-- string --></packagePassword>
			<products>
				<ID><!-- int --></ID>
				<parentProductID><!-- int --></parentProductID>
				<productID><!-- int --></productID>
				<productVariantID><!-- int --></productVariantID>
				<packageDateNextRenewal><!-- int --></packageDateNextRenewal>
				<cycleID><!-- int --></cycleID>
				<couponID><!-- int --></couponID>
				<couponPrice><!-- double --></couponPrice>
				<couponNumCycles><!-- int --></couponNumCycles>
				<quantity><!-- int --></quantity>
				<taxZoneGroupID><!-- int --></taxZoneGroupID>
				<comments><!-- string --></comments>
				<price><!-- double --></price>
				<setup><!-- double --></setup>
				<addons>
					<addon>
						<productName><!-- string --></productName>
						<productID><!-- int --></productID>
						<productVariantID><!-- int --></productVariantID>
						<couponID><!-- int --></couponID>
						<couponPrice><!-- double --></couponPrice>
						<couponNumCycles><!-- int --></couponNumCycles>
						<quantity><!-- int --></quantity>
						<taxZoneGroupID><!-- int --></taxZoneGroupID>
						<price><!-- double --></price>
						<setup><!-- double --></setup>
					</addon>
				</addons>
				<domain>
					<domainType><!-- int --></domainType>
					<domainID><!-- int --></domainID>
					<domainSLD><!-- string --></domainSLD>
					<domainTLD><!-- string --></domainTLD>
					<domainIDNLanguage><!-- string --></domainIDNLanguage>
					<domainTransferKey><!-- string --></domainTransferKey>
					<extraInfo>
						<x><!-- string --></x>
					</extraInfo>
				</domain>
				<attributes>
					<attribute>
						<attributeID><!-- int --></attributeID>
						<questionID><!-- int --></questionID>
						<answers>
							<answer><!-- string --></answer>
						</answers>
					</attribute>
				</attributes>
			</products>
			<provisionRules>
				<disableProvisionIDs>
					<serverGroupID><!-- int --></serverGroupID>
				</disableProvisionIDs>
				<provisionDateRule>
					<domainID><!-- int --></domainID>
					<serverGroupID><!-- int --></serverGroupID>
					<provisionDate><!-- int --></provisionDate>
				</provisionDateRule>
			</provisionRules>
		</params>
	</mbapi>

		

Example Response

None
		

Request Elements

mbapi
Type
None
Description
None
Children
command
Type
None
Description
None
subCommand
Type
string
Description

REQUIRED This is either "process" or "preview" depending on what you want.
"preview" will do the following:

  • create a client if needed
  • create a client contact if needed
  • create a billing account if needed
  • create all packages needed
  • generate a preview invoice from those packages
  • destroy the packages that were created
  • do fraudguardian lookups if MB is configured to do so and the override is not passed
  • return preview invoice information and fraud guardian information

"process" will do the following:

  • create a client if needed
  • create a client contact if needed
  • create a billing account if needed
  • create all packages needed
  • generate an invoice for the created packages
  • activate/deactivate and mark as pending/active the client record as told by fraudguardian (or use default)
  • do charges needed, if cc then do auth_capture, or auth_only based on system settings AND fraudguardian results
  • do all accounting needed for successful charges
  • create all system queue entries for purchase provisioning
  • create todo items for non-autoprovisioning items in order
  • return invoice xml
  • return transaction information xml (which for third party gateways like paypal, will be links and forms html)

params
Type
None
Description
None
Children
orderFormID
Type
int
Description

REQUIRED The ID in ModernBill of the order form for which this order is being placed.

paymentType
Type
int
Description

REQUIRED This is the numeric ID if the type of payment we are going to take.
Acceptable values and their meanings are:

  • 1 = credit card
  • 2 = third party gateway like paypal or worldpay
  • 3 = want to pay via check
  • 4 = echeck
  • 5 = bank draft
  • 50 = want to be invoiced
  • 9999 = existing billing account

secondary
Type
int
Description

This is the "configGroupID" if the third party gateway to use in MB if needed.

invoiceID
Type
int
Description

This is the invoiceID if an existing invoice that you want to charge for. An example of why this is needed would be:
Customer comes through order process, uses a credit card, the card gets declined because they used the wrong one or whatever other reason, and they come through the payment part of the order again to pay with a different card or in a different manner.
When that happens you would run the ProcessCheckout command the first time, then save the invoiceID that it gives you, and just pass in that invoiceID when running it a second time so that your system does not get cluttered with unpaid invoices.

fraudLevelAction
Type
int
Description

REQUIRED This is an integer value that represents what actions ProcessCheckout should perform based on a persons fraud score and your ModernBill fraud threshold settings. Possible values and their meanings are:

  • 0 = set client status as active and do cc transactions as auth_capture
  • 1 = set client status as active and do cc transactions as auth_only
  • 2 = set client status as pending and do cc transactions as auth_capture
  • 3 = set client status as pending and do cc transactions as auth_only
  • 5 = soft reject (ideally you should handle this outside the process checkout command)
  • 6 = hard reject (ideally you should handle this outside the process checkout command)

fraudLevelActionStatus
Type
int
Description

This is a node that will be used to manage where we are in the process for things such as fraud call

enableInvoiceEmail
Type
int
Description

If set to 1 the system will allow the invoicing process to send out emails.

disableProvisioning
Type
int
Description

If set to 1 the system will not make provisioning system queue entries for any products.

disableInvoicing
Type
int
Description

If set to 1 the system will not create an invoice.

disableCharging
Type
int
Description

If set to 1 the system will not try to charge for the invoice if it gets generated.

disableBillingShares
Type
int
Description

If set to 1 the system will not create the shares between the billing account and the packages.

disableFraudguardian
Type
int
Description

If set to 1 the system will not run the fraudguardian module.

disableClientUpdates
Type
int
Description

If set to 1 the system will not update existing clients' information.

overrideDateDue
Type
int
Description

If a value is provided the due date for the invoice that is generated will be set to this timestamp.

overrideTransactionType
Type
string
Description

Set this to override the transaction type in the system for transactions. Can be either "auth" or "charge".

client
Type
group
Description

This is the group where we specify client level information, or the clientID we are working with.

Children
clientID
Type
int
Description

CONDITIALLY REQUIRED IF the client is an existing client OR a new client but you have done a "preview" call and saved the clientID it returned, then put it here, otherwise do not use this node.

clientFirstName
Type
string
Description

The client's firstname. Required for updates of existing clients and new clients.

clientLastName
Type
string
Description

The client's lastname. Required for updates of existing clients and new clients.

clientEmail
Type
string
Description

The client's email address. Required for updates of existing clients and new clients.

clientCompany
Type
string
Description

The client's company name. Required for updates of existing clients and new clients.

clientComments
Type
string
Description

Comments on this client. Required for updates of existing clients and new clients.

contactUsername
Type
string
Description

The client's MB username. Required for updates of existing clients and new clients.

contactPassword
Type
string
Description

The client's MB password. Required for updates of existing clients and new clients.

languageID
Type
string
Description

The client's languageID. Required for updates of existing clients and new clients. Can be aquired through the languages table

countriesID
Type
int
Description

The client's countriesID. Required for updates of existing clients and new clients. Can be aquired through the countries table

themeID
Type
int
Description

The client's themeID. Required for updates of existing clients and new clients. This is likely "1" unless you have created your own themes. If so, it can be aquired from the themes table.

companyID
Type
int
Description

Always "1".

clientSignupIP
Type
int
Description

The integer version of the clients IP address at time of signup.

clientLastIP
Type
int
Description

The integer version of the clients IP address at their last pageload.

clientContact
Type
group
Description

This is the group where we specify client contact level information.

Children
clientContactID
Type
int
Description

CONDITIALLY REQUIRED IF the client is an existing client OR a new client but you have done a "preview" call and saved the clientContactID it returned, then put it here, otherwise do not use this node.

contactAddress1
Type
string
Description

The contact's first address line. Required for updates of existing contacts and new contacts.

contactAddress2
Type
string
Description

The contact's second address line. Required for updates of existing contacts and new contacts.

contactCity
Type
string
Description

The contact's city. Required for updates of existing contacts and new contacts.

contactState
Type
string
Description

The contact's state. Required for updates of existing contacts and new contacts.

contactZip
Type
string
Description

The contact's zip. Required for updates of existing contacts and new contacts.

contactPhone1
Type
string
Description

The contact's first phone. Required for updates of existing contacts and new contacts.

contactPhone2
Type
string
Description

The contact's second phone. Required for updates of existing contacts and new contacts.

contactFax
Type
string
Description

The contact's fax. Required for updates of existing contacts and new contacts.

clientBillingAccount
Type
group
Description

This is the group where we specify billing account information.

Children
billingAccountID
Type
int
Description

CONDITIALLY REQUIRED IF the billing account is an existing account OR a new account but you have done a "preview" call and saved the billingAccountID it returned, then put it here, otherwise do not use this node.

billingAccountType
Type
int
Description

This is an int value that represents what type of billing account this is. Valid values and their meanings are below.

  • 0 = credit card
  • 1 = echeck
  • 2 = bank draft
  • 3 = manual payment
  • 4 = third party gateway account
  • 5 = wire

billingCardNameOnCard
Type
string
Description

Name on the credit card IF this is a cc account.

billingCardType
Type
int
Description

Integer representing the type of credit card. Valid values and their meanings are below.

  • 0 = visa
  • 1 = mastercard
  • 2 = american express
  • 3 = discover
  • 4 = JCB
  • 5 = enroute
  • 6 = diners club
  • 7 = solo/switch
  • 8 = maestro
  • 9 = delta
  • 10 = bankcard
  • 11 = visa electron

billingCardNum
Type
string
Description

The credit card number for this account.

billingCardExpMonth
Type
string
Description

The 2 digit expiration month of the afore mentioned credit card.

billingCardExpYear
Type
string
Description

The 4 digit expiration year of the afore mentioned credit card.

billingCardIssueNum
Type
string
Description

Issue number sometimes required by some cards in Europe.

billingCardStartDate
Type
string
Description

Start date sometimes required by some cards in Europe.

cardCVV2
Type
string
Description

The CVV2 code on the back of the card, sometimes referred to as other things such as CVD code, CV2, CVV, or just plain "verification number".
NOTE: This value is NOT stored anywhere in ModernBill.

billingBankName
Type
string
Description

Bank name used for echeck and bank draft accounts.

billingBankState
Type
string
Description

Bank state used for echeck and bank draft accounts.

billingBankAbaCode
Type
string
Description

Bank aba code used for echeck and bank draft accounts.

billingBankAccountNum
Type
string
Description

Bank account number used for echeck and bank draft accounts.

billingBankLicenseNum
Type
string
Description

Drivers license number used for echeck and bank draft accounts.

billingBankLicenseState
Type
string
Description

Drivers license state used for echeck and bank draft accounts.

billingBankDob
Type
string
Description

Date of Birth used for echeck and bank draft accounts.

domainRegistrant
Type
group
Description

This is the group where we specify registrant information for any domains that we may be registering.

Children
registrantFirstName
Type
string
Description

First name for registrant record.

registrantLastName
Type
string
Description

Last name for registrant record.

registrantAddress1
Type
string
Description

First address line for registrant record.

registrantAddress2
Type
string
Description

Second name for registrant record.

registrantCity
Type
string
Description

City for registrant record.

registrantStateProvince
Type
string
Description

State or province for registrant record.

registrantPostalCode
Type
string
Description

Zip or postal code for registrant record.

registrantOrganizationName
Type
string
Description

Organization for registrant record.

registrantJobTitle
Type
string
Description

Job title for registrant record.

registrantEmail
Type
string
Description

Email address for registrant record.

registrantPhone
Type
string
Description

Phone number for registrant record.

registrantFax
Type
string
Description

Fax number for registrant record.

registrantCountry
Type
string
Description

Two digit country ISO code for registrant record.

attributes
Type
group
Description

This is the group that we put attribute records in that are for the client record.

Children
attribute
Type
group
Description

This a group record that holds all information about an attribute that is going to tie to the current client. There can be multiple instances of this group.

Children
attributeID
Type
int
Description

The ID of the attribute to use when creating the client_attributes record from the following answers.

questionID
Type
int
Description

The ID of the question in MB for which the following answers are provided. This can be aquired through the questions table.

answers
Type
group
Description

Group that holds X number of answer nodes.

Children
answer
Type
string
Description

A string value that is one-of/the answer for the preceding question. There may be multiple instances of this node in this place.

packageUsername
Type
string
Description

Username to use for accounts that get provisioned for the packages that are created during this order.

packagePassword
Type
string
Description

Password to use for accounts that get provisioned for the packages that are created during this order.

products
Type
group
Description

This group holds all information needed for each specific product in this order. This may be repeated like:

 <products>
 	( . . . )
 </products>
 <products>
 	( . . . )
 </products>
 

Children
ID
Type
int
Description

This is a "unique to this order" ID that is used to express parent/child/domain relationships between products. Following is an example of how this may be used:

 <products> 
 	<ID>1111</ID> 
 	(domain product information) 
 </products> 
 <products> 
 	<ID>2222</ID> 
 	(hosting product information) 
 	<domain> 
 		<domainType>2</domainType> (2 = existing domain, see domainType for more information) 
 		<domainID>1111</domainID> 
 	</domain> 
 	<addons> 
 		<addon> 
 			(dependant addon information, dependant = inherits cycle and number of times to bill from parent product) 
 		</addon> 
 	</addons> 
 </products> 
 <products> 
 	<ID>3333</ID> 
 	<parentProductID>2222</parentProductID> 
 	(independantly billed addon product information, independant = has own cycle and number of times to bill) 
 </products> 
In the above example, we buy a domain (ID 1111) and a hosting product (ID 2222) with an addon, and an independant addon (ID 3333) for the hosting package. Having domainType 2 and domainID 1111 tells the system to associate the domain with 1111 as it's ID to the current product. Having parentProductID as 2222 tells the system to set the packageID of the item with ID 2222 as the parentPackageID of the current package which makes that package get treated as an addon to its parent.

parentProductID
Type
int
Description

See docs above.

productID
Type
int
Description

Product ID in MB. This can be aquired through the GetProducts command.

productVariantID
Type
int
Description

Product Variant ID in MB. This can be aquired through the GetProductVariants command.

packageDateNextRenewal
Type
int
Description

Timestamp of the next renewal date for the product being purchased, now if you want this package to be on the invoice that gets generated now.

cycleID
Type
int
Description

The cycle ID in MB of the cycle this product needs to renew on. This can be aquired through the GetCycles command.

couponID
Type
int
Description

The coupon ID in MB of the coupon that will apply to this product. This can be aquired through the GetCoupons command.

couponPrice
Type
double
Description

The price to charge for this product while the above coupon is in effect.

couponNumCycles
Type
int
Description

The number of cycles (first time inclusive) to use the coupon price instead of the regular price for billing.

quantity
Type
int
Description

The quantity of this product, currently not used in provisioning. Only use this when selling non-provisioning things that are exactly alike. ie - hosting packages are not the same because they have different domains associated with them.

taxZoneGroupID
Type
int
Description

The ID of the tax zone group to apply to this product. This can be aquired through the GetTaxZoneGroups command.

comments
Type
string
Description

If you specify something here it will be the product comments (most times longer description than just the name) that will be used for display purposes on the package details and invoices for this product INSTEAD of the main product's comments. If left blank the main product comments will be used instead.

price
Type
double
Description

The regular price to charge for this product.

setup
Type
double
Description

The setup price to charge for this product.

addons
Type
group
Description

The group that holds dependant addons for this product.

Children
addon
Type
group
Description

The group that holds this specific dependant addon's information.

Children
productName
Type
string
Description

The display name for this addon. Best thing to do for this is something of the form "Question: Value" where Question is something like "Disk Space" and Value is something like "5GB"

productID
Type
int
Description

The product ID in MB that this addon is for. This can be aquired through the GetProducts command.

productVariantID
Type
int
Description

The product variant ID in MB that this addon is for. This can be aquired through the GetProducts command.

couponID
Type
int
Description

The coupon ID in MB of the coupon that will apply to this product. This can be aquired through the GetCoupons command.

couponPrice
Type
double
Description

The price to charge for this product while the above coupon is in effect.

couponNumCycles
Type
int
Description

The number of cycles (first time inclusive) to use the coupon price instead of the regular price for billing.

quantity
Type
int
Description

The quantity of this product, currently not used in provisioning. Only use this when selling non-provisioning things that are exactly alike. ie - hosting packages are not the same because they have different domains associated with them.

taxZoneGroupID
Type
int
Description

The ID of the tax zone group to apply to this product. This can be aquired through the GetTaxZoneGroups command.

price
Type
double
Description

The regular price to charge for this addon.

setup
Type
double
Description

The setup price to charge for this addon.

domain
Type
group
Description

This group holds the information for a domain that is to be associated with this product. The 4 possible scenario's that may cause a domain to be associated are:
1. This product is a domain registration product.
2. This product is a domain transfer product.
3. This product is not a domain product and needs a domain that we have in this order associated with it.
4. This product is not a domain product and needs a domain that we have outside this order associate with it.

Children
domainType
Type
int
Description

This is the type of this domain association. Below are the possible values and their meanings.

  • 0 = new registration
  • 1 = transfer
  • 2 = existing domain (in this order)
  • 3 = existing domain (NOT in this order)

domainID
Type
int
Description

This is the ID used to associate domains to the current product. It's meaning and content is different for each scenario. Possible values for each scenario are below.
1. OR 2. Parent product is a domain registration or transfer product:
NOT REQUIRED 3. Parent product is NOT a domain registration product and we are associating a domain in this order
The <ID> of the domain registration product in this order to associate with.
4. Parent product is NOT a domain registration product and we are associating a domain NOT in this order
NOT required.

domainSLD
Type
string
Description

This is the SLD of the domain name. This is required for domain scenarios 1. 2. and 4.
example: the "domain-name" in "domain-name.co.uk"

domainTLD
Type
string
Description

This is the TLD of the domain name. This is required for domain scenarios 1. 2. and 4.
example: the "co.uk" in "domain-name.co.uk"

domainIDNLanguage
Type
string
Description

The 2 character ISO2 code for the language of this domain. This is only needed when registering IDN's.

domainTransferKey
Type
string
Description

This is the transfer key (or epp code) that gives you permission to transfer a domain from one registrar or account to another.

extraInfo
Type
group
Description

This group holds extra information that may or may not be required to register domains of certain TLD's such as .co.uk domains.

Children
x
Type
string
Description

You just use a key = value form to create your extra information in here where key = x and value = y. You may specify as much information here as you like. It will be passed untouched to the registrar module when the domain registration or transfer call id performed.

attributes
Type
group
Description

This is the group that we put attribute records in that are for the package record.

Children
attribute
Type
group
Description

This a group record that holds all information about an attribute that is going to tie to the current product's package. There can be multiple instances of this group.

Children
attributeID
Type
int
Description

The ID of the attribute to use when creating the package_attributes record from the following answers.

questionID
Type
int
Description

The ID of the question in MB for which the following answers are provided. This can be aquired through the questions table.

answers
Type
group
Description

Group that holds X number of answer nodes.

Children
answer
Type
string
Description

A string value that is one-of/the answer for the preceding question. There may be multiple instances of this node in this place.

provisionRules
Type
group
Description

This group holds specific provisioning rules.

Children
disableProvisionIDs
Type
group
Description

This group holds the server group ID's of the server groups for which you do not want to create the provisioning system queue entries.

Children
serverGroupID
Type
int
Description

Server group ID, this can be aquired through a GetServerGroups Command.

provisionDateRule
Type
group
Description

This group holds information that controls WHEN something gets set to provision.

Children
domainID
Type
int
Description

The ID of the domain registration product (in the above example it would be "1111") for which this date rule applies.

serverGroupID
Type
int
Description

The ID of the server group for which this date rule applies.

provisionDate
Type
int
Description

The date in the form of a timestamp to use as the run date for the system queue entries meant to provision the items referred to above.

Response Elements

None