POST | /sales/contract/sold/new/user | Create a user and sell them a package | Create a user and sell them a package. **New Operation** The PaymentMethods property is an array of objects describing how you want ClubReady to take payment while selling the PackageId/InstallmentPlanId. The deprecated fields (AcctToken, Last4, ExpMonth, ExpYear, AcctType, BnkRoute, and IsTemp) must be omitted or null. **Deprecated Operation** Provide the AcctToken, Last4, ExpMonth, ExpYear, AcctType, BnkRoute, and IsTemp used in the ClubReadyGateway API in order to create a Payment Profile to the user specified. PaymentMethods must be omitted or null. |
---|
System.IO.InvalidDataException: MetaData is potentially malicious. Expected scalar value, Received: 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 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: ``` [{PaymentMethodType:AcctToken,PaymentAmount:1.00,AcctToken:eyj...,ProfileToken:eyJ...},{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). * Because this endpoint creates a new user, the "PreferredOnFile" option is not applicable. Also, ProfileToken with the OwnerType "TempstUser" is required because the Payment Profile owner will be converted to the newly created user. * 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. at ServiceStack.NativeTypes.VbNet.VbNetGeneratorExtensions.SafeValue(String value) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 791 at ServiceStack.NativeTypes.VbNet.VbNetGeneratorExtensions.QuotedSafeValue(String value) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 796 at ServiceStack.NativeTypes.VbNet.VbNetGenerator.TypeValue(String type, String value) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 589 at ServiceStack.NativeTypes.VbNet.VbNetGenerator.AppendAttributes(StringBuilderWrapper sb, List`1 attributes) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 560 at ServiceStack.NativeTypes.VbNet.VbNetGenerator.AddProperties(StringBuilderWrapper sb, MetadataType type, Boolean includeResponseStatus) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 483 at ServiceStack.NativeTypes.VbNet.VbNetGenerator.AppendType(StringBuilderWrapper& sb, MetadataType type, String lastNS, List`1 allTypes, CreateTypeOptions options) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 402 at ServiceStack.NativeTypes.VbNet.VbNetGenerator.GetCode(MetadataTypes metadata, IRequest request, INativeTypesMetadata nativeTypes) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/VbNet/VbNetGenerator.cs:line 269 at ServiceStack.NativeTypes.LangGeneratorExtensions.g__Generate|1_0(ILangGenerator gen, <>c__DisplayClass1_0& ) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/ILangGenerator.cs:line 40 at ServiceStack.NativeTypes.LangGeneratorExtensions.GenerateSourceCode(MetadataTypes metadataTypes, MetadataTypesConfig typesConfig, String lang, IRequest req, Action`1 configure) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/ILangGenerator.cs:line 51 at ServiceStack.NativeTypes.LangGeneratorExtensions.GenerateSourceCode(List`1 metadataTypes, String lang, IRequest req, Action`1 configure) in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/NativeTypes/ILangGenerator.cs:line 26 at ServiceStack.Metadata.BaseMetadataHandler. d__12.MoveNext() in /home/runner/work/ServiceStack/ServiceStack/ServiceStack/src/ServiceStack/Metadata/BaseMetadataHandler.cs:line 203
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/new/user HTTP/1.1
Host: clubready.com
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<SellContractAndSetupClientRequest 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>
<AcctToken xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</AcctToken>
<AcctType xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">Uninitialized</AcctType>
<Address xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Address>
<BnkRoute xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</BnkRoute>
<CellPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</CellPhone>
<City xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</City>
<DateOfBirth xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</DateOfBirth>
<Email xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Email>
<EmergencyContactName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</EmergencyContactName>
<EmergencyContactPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</EmergencyContactPhone>
<EmergencyContactType xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</EmergencyContactType>
<ExpMonth xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ExpMonth>
<ExpYear xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ExpYear>
<ExternalId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</ExternalId>
<FirstName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</FirstName>
<Gender xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Gender>
<InstallmentPlanId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</InstallmentPlanId>
<IsTemp xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">false</IsTemp>
<Last4 xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Last4>
<LastName xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</LastName>
<Note xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Note>
<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>
<Phone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Phone>
<PromoCode xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</PromoCode>
<ReferralTypeId xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0</ReferralTypeId>
<StartDate xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">0001-01-01T00:00:00</StartDate>
<State xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</State>
<Username xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Username>
<WorkPhone xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</WorkPhone>
<Zip xmlns="http://schemas.datacontract.org/2004/07/ClubReady.Core.Api.Models">String</Zip>
<AuthToken>String</AuthToken>
<CardType>0</CardType>
</SellContractAndSetupClientRequest>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <z:anyType xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" />