POST | /sales/contract/sold | Sell 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. |
---|
Name | Parameter | Data Type | Required | Description |
---|---|---|---|---|
ApiKey | query | string | Yes | Api Authentication Key |
MemberId | query | int | Yes | Member Id of the user buying the Package |
ChainId | body | int? | No | Id for the chain of the Api Key |
StoreId | body | int? | Yes | Id of the store for the user |
PackageId | body | int | Yes | Package Id number of the package being purchased |
InstallmentId | body | int? | No | Installment Plan Id being purchased. If empty, the default package will be selected. |
PaymentAmount | body | decimal? | Yes | Amount being paid down, including tax |
PromoCode | body | string | No | Promo code to apply a discount. |
StaffId | body | int? | No | Staff Id of salesperson who sold the agreement. |
PaymentMethods | body | List<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. |
RestrictedId | body | int? | No | |
RestrictedResourceType | body | RestrictedResourceType | No |
Name | Parameter | Data Type | Required | Description |
---|---|---|---|---|
MemberId | form | int | No | |
PackageId | form | int | No | |
InstallmentId | form | int? | No | |
StartDate | form | DateTime? | No | |
PaymentAmount | form | decimal? | No | |
PromoCode | form | string | No | |
PaymentMethods | form | List<PaymentMethodDto> | No | |
StaffId | form | int? | No |
Name | Parameter | Data Type | Required | Description |
---|---|---|---|---|
ApiKey | form | string | No | |
StoreId | form | int? | No | |
ChainId | form | int? | No |
Name | Parameter | Data Type | Required | Description |
---|---|---|---|---|
AcctToken | form | string | No | |
ProfileToken | form | string | No | |
PaymentProfileId | form | string | No | |
PaymentAmount | form | decimal? | No | |
PaymentMethodType | form | PaymentMethodType? | No | |
DoNotUpdatePaymentTypePreference | form | bool? | No |
Name | Value | |
---|---|---|
Uninitialized | 0 | Uninitialized |
PaymentProfileId | 1 | PaymentProfileId |
PreferredOnFile | 2 | PreferredOnFile |
AcctToken | 3 | AcctToken |
Error | -1 | Error |
Store | |
Chain | |
User | |
Undefined |
Name | Parameter | Data Type | Required | Description |
---|---|---|---|---|
ContractSaleID | form | string | No | |
description | form | string | No | |
Success | form | bool | No | |
PaymentResponses | form | IReadOnlyList<PendingPaymentResponse> | No |
Name | Parameter | Data Type | Required | Description |
---|---|---|---|---|
ResponseTransactionId | form | string | No | |
ResponseTxnId | form | string | No | |
ResponseStatus | form | ResponseStatus | No | |
ResponseAmount | form | decimal | No | |
ResponseText | form | string | No | |
Last4 | form | string | No | |
AcctClass | form | string | No | |
AcctType | form | string | No | |
AcctToken | form | string | No |
Name | Value | |
---|---|---|
stsUnknown | 0 | |
stsSuccess | 1 | |
stsDecline | 2 | |
stsError | 3 | |
HardDeclineAccount | 4 | |
HardDeclineExpiry | 5 | |
PartialApproval | 11 |
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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: application/xml
Content-Type: application/xml
Content-Length: length
<SellContractRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Web.Api.Sales.Model">
<ApiKey xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ApiKey>
<ChainId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ChainId>
<StoreId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StoreId>
<InstallmentId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</InstallmentId>
<MemberId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</MemberId>
<PackageId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</PackageId>
<PaymentAmount xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</PaymentAmount>
<PaymentMethods xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">
<PaymentMethodDto>
<AcctToken>String</AcctToken>
<DoNotUpdatePaymentTypePreference>false</DoNotUpdatePaymentTypePreference>
<PaymentAmount>0</PaymentAmount>
<PaymentMethodType>Uninitialized</PaymentMethodType>
<PaymentProfileId>String</PaymentProfileId>
<ProfileToken>String</ProfileToken>
</PaymentMethodDto>
</PaymentMethods>
<PromoCode xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</PromoCode>
<StaffId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</StaffId>
<StartDate xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</StartDate>
</SellContractRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <SellContractResultDto xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models"> <ContractSaleID>String</ContractSaleID> <PaymentResponses i:nil="true" /> <Success>false</Success> <description>String</description> </SellContractResultDto>