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 .jsv suffix or ?format=jsv
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: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ApiKey: String,
ChainId: 0,
StoreId: 0,
PackageId: 0,
InstallmentPlanId: 0,
PaymentAmount: 0,
StartDate: 0001-01-01,
FirstName: String,
LastName: String,
Email: String,
Gender: String,
Address: String,
City: String,
State: String,
Zip: String,
Phone: String,
WorkPhone: String,
DateOfBirth: 0001-01-01,
CellPhone: String,
Note: String,
ExternalId: String,
PromoCode: String,
Username: String,
ReferralTypeId: 0,
EmergencyContactName: String,
EmergencyContactPhone: String,
EmergencyContactType: String,
PaymentMethods:
[
{
AcctToken: String,
ProfileToken: String,
PaymentProfileId: String,
PaymentAmount: 0,
PaymentMethodType: Uninitialized,
DoNotUpdatePaymentTypePreference: False
}
],
RestrictedId: 0,
RestrictedResourceType: Chain,
AuthToken: String,
AcctToken: String,
Last4: String,
ExpMonth: 0,
ExpYear: 0,
AcctType: Uninitialized,
CardType: 0,
BnkRoute: 0,
IsTemp: False
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { }