Repository navigation
Create account API
pgeorge-mylife edited this page Apr 16, 2018
·
31 revisions
POST /psk/account?access_token=[partner's access token]
All data transfers conform to HTTP/1.1, and all endpoints require HTTPS.
Parameters are passed in request body in application/x-www-form-urlencoded format (key/value pairs separated by & symbol)
| Name | Description |
|---|---|
firstName |
First name |
lastName |
Last name |
email |
email for the new account |
password |
password for the new account |
gender |
m - male, f - female, u - unknown |
birthdayMonth |
birthday month: in 01-12 range |
birthdayDay |
birthday day: in 01-31 range |
birthdayYear |
birthday year: in YYYY format |
postcode |
5 digit US zip code |
billingPlanId |
Billing plan identifier selected by user from Product pricing API |
creditCardNumber |
Credit card number. Numbers only, no dashes or spaces. Only Visa, Mastercard, Discover and American Express are supported. |
creditCardExpirationMonth |
Credit card expiration year in MM format |
creditCardExpirationYear |
Credit card expiration year in YYYY format |
creditCardSecurityCode |
The CVV Number ("Card Verification Value") on credit card or debit card is a 3 digit number on VISA, MasterCard and Discover branded credit and debit cards. On American Express branded credit or debit card it is a 4 digit numeric code. |
dryRun |
Optional boolean flag. If dryRun=true is passed in the request, a new account won't be created. However all input parameters will be validated. |
uid |
Optional account id. If user account was created but subscription failed (created=true and subscribed=false) due invalid credit card data, the next request with updated billing info should pass uid back to API endpoint. |
autoRenew |
Optional boolean flag for control subscription auto-renewal at the end of subscription period. Default is autoRenew=true. |
Response contains account creation status in JSON format.
Create account result attributes:
| Name | Description |
|---|---|
requestId |
Request id (for tracking) |
success |
Boolean success flag |
errors |
Array of error codes if account creation request was failed |
created |
Success flag for account creation. If true, account has been created and uid field is set. |
uid |
New account user id |
subscribed |
Success flag for account subscription. If true, credit card transaction was charged and subscription created. sid, paymentRef and paidAmount fields are set. |
sid |
New account subscription id |
paymentRef |
Payment reference for credit card charge |
paidAmount |
Amount for credit card charge |
If response status contains created=true and subscribed=false flags, it indicates that account has been created, but credit card payment has failed. The status response will have newly created user account id as uid. Please re-submit request with updated credit card information and add uid from the last status to the new request.
Create account response example:
{
"requestId":"99bbefdb-c05b-4aea-ae6e-50bc922a0a25",
"success":true,
"created":true,
"uid":"ABC",
"subscribed":true,
"sid":607529019,
"paymentRef":"demo.4050435770",
"paidAmount":17.95
}
| Name | Description |
|---|---|
account.first.name.empty |
First name is empty. |
account.last.name.empty |
Last name is empty. |
account.gender.empty |
Gender is empty. |
account.email.empty |
Email address is empty |
account.email.invalid |
Email address format is invalid. |
account.password.empty |
Password is empty. |
account.password.too.short |
Password is too short. Minimum size is 5 symbols. |
account.dob.month.empty |
DOB month is empty. |
account.dob.month.invalid |
DOB month should be in 1-12 range. |
account.dob.day.empty |
DOB day is empty. |
account.dob.day.invalid |
DOB day should be in 1-31 range. |
account.dob.year.empty |
DOB year is empty. |
account.dob.year.invalid |
DOB year is less than 1900 or greater than current year. |
account.dob.date.invalid |
DOB date is invalid; i.e. 1991-06-31
|
account.age.unacceptable |
Calculated user's age is less than 18. |
account.postcode.empty |
Postal code is empty. |
account.postcode.invalid |
Postal code is invalid: neither ZIP5 US ZIP code nor Canadian postal code (A1A 1A1 format). |
account.billing.plan.id.empty |
Billing plan id is empty. |
account.billing.plan.id.invalid |
Billing plan id is invalid. |
account.credit.card.number.empty |
Credit card number is empty. |
account.credit.card.number.invalid |
Credit card number is invalid. |
account.credit.card.number.not.supported |
Credit cart type is not supported. Only Visa, Mastercard, Discover and American Express are accepted. |
account.credit.card.security.code.empty |
Credit card security code is empty. |
account.credit.card.security.code.invalid |
Credit card security code is invalid. |
account.credit.card.expiration.month.empty |
Credit card expiration month is empty. |
account.credit.card.expiration.month.invalid |
Credit card expiration month is invalid. |
account.credit.card.expiration.year.empty |
Credit card expiration year is empty. |
account.credit.card.expiration.year.invalid |
Credit card expiration year is invalid. |
account.credit.card.expired |
Credit card is expired. |
account.credit.card.expiration.invalid |
Credit card expiration date is invalid. |
account.uid.invalid |
Incorrect value was passed for uid parameter. |
| Name | Description |
|---|---|
201 |
Account created and credit card charged successfully. |
400 |
Invalid request parameter(s). |
402 |
Credit card charge failure. |
200 |
Credit card charged successfully. |