ClubReady Api

<back to all web services

SellContractRequest

The following routes are available for this service:
POST/sales/contract/soldSell a package to an existing user Sell a package to an existing user. The PaymentMethods property is an array of objects describing how you want ClubReady to take payment while selling the PackageId/InstallmentPlanId. If omitted (or null), the preferred on-file profile will be used.
SellContractRequest Parameters:
NameParameterData TypeRequiredDescription
ApiKeyquerystringYesApi Authentication Key
MemberIdqueryintYesMember Id of the user buying the Package
ChainIdbodyint?NoId for the chain of the Api Key
StoreIdbodyint?YesId of the store for the user
PackageIdbodyintYesPackage Id number of the package being purchased
InstallmentIdbodyint?NoInstallment Plan Id being purchased. If empty, the default package will be selected.
PaymentAmountbodydecimal?YesAmount being paid down, including tax
PromoCodebodystringNoPromo code to apply a discount.
StaffIdbodyint?NoStaff Id of salesperson who sold the agreement.
PaymentMethodsbodyList<PaymentMethodDto>No An array of Payment Methods to be used for this purchase. Any entry with PreferredOnFile is assumed if omitted or null. Each object of the array may contain properties: | Property | Description | | --- | --- | | PaymentMethodType | Usually "AcctToken" (Default or omitted/null) or "PreferredOnFile" | | PaymentAmount | The amount to be attempted for this Payment Method. When omitted (or null), the Request's PaymentAmount will be attempted | | AcctToken | The AcctToken to attempt payment (when using PaymentMethodType:AcctToken) | | ProfileToken | When provided (with AcctToken), a Payment Profile will be created (this will prevent the requirement to call `/sales/paymentprofile/import` (when using PaymentMethodType:AcctToken) | | DoNotUpdatePaymentTypePreference | When using ProfileToken, do not set the PaymentTypePreference (for more information, see `/sales/paymentprofile/import` (when using PaymentMethodType:AcctToken) | | | | * Scenario #1: Use the on file profile only. PaymentMethods can be omitted/null, or : JSON: ```json { PaymentMethods: [ { "PaymentMethodType":"PreferredOnFile", "PaymentAmount":"1.00" } ] } ``` JSV: ```jsv [{PaymentMethodType:PreferredOnFile,PaymentAmount:1.00}] ``` * Scenario #2: Use a Gift Card with PreferredOnFile to cover the amount not approved by the Gift Card. JSON: ```json { PaymentMethods: [ { "PaymentMethodType":"AcctToken", "PaymentAmount":"1.00", "AcctToken":"eyJ...GiftCard AcctToken...", "ProfileToken":"eyJ...Gift Card ProfileToken..." }, { "PaymentMethodType":"PreferredOnFile", "PaymentAmount":"1.00" } ] } ``` JSV: ```jsv [{PaymentMethodType:AcctToken,PaymentAmount:1.00,AcctToken:eyj...,ProfileToken:eyJ...},{PaymentMethodType:PreferredOnFile,PaymentAmount:1.00}] ``` Notes: * The example shows PaymentAmount of 1.00 for both "AcctToken" and "PreferredOnFile". This is for the example with a total of $1.00. The firstPaymentMethod (the Gift Card) will be attempted for $1.00. If it partially approves for less than 1.00 (example: $0.80), the second payment method (PreferredOnFile) will be attempted for the lesser of it's PaymentAmount and the remaining amount (example: $0.20). * If ProfileToken has already been used (e.g. used with `/sales/paymentprofile/import`), it does not need to be included, but AcctToken is required. ProfileToken is only needed once to 'activate' the AcctToken. * When using Query String (or this web site), this value must be encoded with JSV [(JSON-like Separated Values)](https://docs.servicestack.net/jsv-format). Basic steps to convert JSON to JSV: 1) Remove properties that are null, 2) Remove white space including line feeds, 3) Remove quotes.
RestrictedIdbodyint?No
RestrictedResourceTypebodyRestrictedResourceTypeNo
SellContractRequestDto Parameters:
NameParameterData TypeRequiredDescription
MemberIdformintNo
PackageIdformintNo
InstallmentIdformint?No
StartDateformDateTime?No
PaymentAmountformdecimal?No
PromoCodeformstringNo
PaymentMethodsformList<PaymentMethodDto>No
StaffIdformint?No
ApiDtoBase Parameters:
NameParameterData TypeRequiredDescription
ApiKeyformstringNo
StoreIdformint?No
ChainIdformint?No
PaymentMethodDto Parameters:
NameParameterData TypeRequiredDescription
AcctTokenformstringNo
ProfileTokenformstringNo
PaymentProfileIdformstringNo
PaymentAmountformdecimal?No
PaymentMethodTypeformPaymentMethodType?No
DoNotUpdatePaymentTypePreferenceformbool?No
PaymentMethodType Enum:
NameValue
Uninitialized0Uninitialized
PaymentProfileId1PaymentProfileId
PreferredOnFile2PreferredOnFile
AcctToken3AcctToken
Error-1Error
RestrictedResourceType Enum:
Store
Chain
User
Undefined
SellContractResultDto Parameters:
NameParameterData TypeRequiredDescription
ContractSaleIDformstringNo
descriptionformstringNo
SuccessformboolNo
PaymentResponsesformIReadOnlyList<PendingPaymentResponse>No
PendingPaymentResponse Parameters:
NameParameterData TypeRequiredDescription
ResponseTransactionIdformstringNo
ResponseTxnIdformstringNo
ResponseStatusformResponseStatusNo
ResponseAmountformdecimalNo
ResponseTextformstringNo
Last4formstringNo
AcctClassformstringNo
AcctTypeformstringNo
AcctTokenformstringNo
ResponseStatus Enum:
NameValue
stsUnknown0
stsSuccess1
stsDecline2
stsError3
HardDeclineAccount4
HardDeclineExpiry5
PartialApproval11
PendingSuccess12

To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv

HTTP + JSV

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /sales/contract/sold HTTP/1.1 
Host: clubready.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ApiKey: String,
	MemberId: 0,
	ChainId: 0,
	StoreId: 0,
	PackageId: 0,
	InstallmentId: 0,
	PaymentAmount: 0,
	PromoCode: String,
	StaffId: 0,
	PaymentMethods: 
	[
		{
			AcctToken: String,
			ProfileToken: String,
			PaymentProfileId: String,
			PaymentAmount: 0,
			PaymentMethodType: Uninitialized,
			DoNotUpdatePaymentTypePreference: False
		}
	],
	RestrictedId: 0,
	RestrictedResourceType: Chain,
	StartDate: 0001-01-01
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	ContractSaleID: String,
	description: String,
	Success: False
}