Accounts-accountId-paymentInfo:POST
From Hostway API Documentation
(Difference between revisions)
(→Add a direct debit payment info) |
Mike.robski (Talk | contribs) m (1 revision: Release 92) |
Latest revision as of 11:20, 8 April 2014
[edit] POST /accounts/{accountId}/paymentInfo
Create a new payment information for a particular account
Contents |
[edit] Request
POST /accounts/{accountId}/paymentInfo
[edit] Request Parameters
- accountId
- The ID of the account
[edit] URI Parameters
None
[edit] Request Headers
- Authorization - HTTP Authorization header [1]
- The Authentication credentials of the client application.
[edit] Request Body
For adding a credit card
{ "paymentInfoType": {paymentInfoType}, "accountNumber": {accountNumber}, "cardHolderName": {cardHolderName}, "expirationDate": {expirationDate}, "verificationNumber": {verificationNumber}, "billingAddress": { "street1": {street1}, "street2": {street2}, "city": {city}, "stateOrProvince": {stateOrProvince}, "postalCode": {postalCode}, "countryCode": {countryCode} }, "routingNumber": {routingNumber}, "accountOwner": {accountOwner}, "accountName": {accountName}, "bankName": {bankName}, "bankCity": {bankCity}, "bankCountry": {bankCountry} }
[edit] Parameters
- paymentInfoType - string
- Required. Type of the payment method. Allowed values are credit_card and direct_debit.
- accountNumber - string
- Required. Payment account number. This the credit card number or the bank account number.
- cardHolderName - string
- Required.(For credit cards only) Name of the card holder. Generally, it is the name that appears on the CC.
- expirationDate - string
- Required.(For credit cards only) Expiration date of the credit card. Should be in the yyyy-m format.
- verificationNumber - string
- Required.(For credit cards only) The CVV number (Card Verification Value) of the credit card.
- billingAddress - dictionary
- Required.(For credit cards only) The billing address of the credit card. It's important that the address provided matches the one with which the credit card was registered as the card will be validated through an AVS (Address Verification Service)
- street1 - string
- Required. The address line 1 of the billing address.
- street2 - string
- Optional. The address line 2 of the billing address.
- city - string
- Required. The city of the billing address.
- stateOrProvince - string
- Optional. The state Or province of the billing address.
- postalCode - string
- Optional. The postal code of the billing address.
- countryCode - string
- Optional. The country code of the billing address.
- routingNumber - string
- Required.(For direct debit only). The bank routing number.
- accountOwner - string
- Optional.(For direct debit only). Name as it Appears on the Check.
- accountName - string
- Optional.(For direct debit only). Name for the account.
- bankName - string
- Optional.(For direct debit only). The bank name.
- bankCity - string
- Optional.(For direct debit only). The bank city.
- bankCountry - string
- Optional.(For direct debit only). The bank country.
[edit] Response
[edit] Status Code
- 201 Created
- The payment information was successfully created
- 400 Bad Request
- The request body was missing a required field or one of the fields did not comply with the requirements (in this case, the response body will contain hints for what went wrong)
- 401 Unauthorized
- Authentication failed
- 403 Forbidden
- Authentication succeeded, but the logged-in user is not allowed to create users in this account. The only users allowed to create users in this account are sales agents and account owners of this account. An account owner is any account user with the "sitecontrol_account_owner" role.
- 404 Not Found
- The account does not exist
- 409 Conflict
- The payment information cannot be created because another payment account with the same information already exists for this user. OR
- The credit card information has been rejected. Some reasons for CC validation failures are:
- - Invalid or expired credit card;
- - Invalid CVV number;
- - Invalid credit card billing address;
- - Black-listed credit card
[edit] Response Headers
- Location
- The URI for the newly created payment information
[edit] Response Body
None
[edit] Examples
[edit] Add an credit card payment info
POST http://<serverName>/accounts/<accountId>/paymentInfo { "paymentInfoType": "credit_card", "accountNumber": "111111111111111111", "cardHolderName": "John Smith", "verificationNumber": "555", "creditCardType": "amex", "expirationDate": "2015-06", "billingAddress": { "street1": "Address Line 1", "street2": "Address Line 2", "countryCode": "US", "city": "Chicago", "postalCode": "60606", "stateOrProvince": "IL" } }
Response headers
... Location http://<serverName>/accounts/<accountId>/paymentInfo/cc-<newly_created_id> ...
[edit] Add a direct debit payment info
POST http://<serverName>/accounts/<accountId>/paymentInfo { "paymentInfoType": "direct_debit", "routingNumber": "123456789", "accountNumber": "1234", "accountName": "My Account Name", "accountOwner": "John Smith", "bankName": "My Bank", "bankCity": "Chicago", "bankCountry": "US" }
Response headers
... Location http://<serverName>/accounts/<accountId>/paymentInfo/dd-<newly_created_id> ...
[edit] See also