Orders-orderId-account-paymentInfo:PUT
(Difference between revisions)
Mike.robski (Talk | contribs) m (1 revision: Release 99) |
(→Offline payment for supported franchises with agent access) |
||
Line 8: | Line 8: | ||
==== Request Parameters ==== | ==== Request Parameters ==== | ||
{{UriParameter-OrderId}} | {{UriParameter-OrderId}} | ||
− | |||
− | |||
− | |||
=== URI Parameters === | === URI Parameters === | ||
Line 45: | Line 42: | ||
: The type of payment method that will be used. Allowed value(s) are: | : The type of payment method that will be used. Allowed value(s) are: | ||
:: '''credit_card''' | :: '''credit_card''' | ||
+ | :: '''offline''' (Available only for agents on supported franchises) | ||
; accountNumber - ''string'' | ; accountNumber - ''string'' | ||
Line 150: | Line 148: | ||
"countryCode": "US" | "countryCode": "US" | ||
} | } | ||
+ | }</nowiki> | ||
+ | |||
+ | '''Response''' | ||
+ | <nowiki> | ||
+ | 204 No Content</nowiki> | ||
+ | |||
+ | === Offline payment for supported franchises with agent access === | ||
+ | '''Request''' | ||
+ | <nowiki> | ||
+ | PUT /orders/{orderId}/account/paymentInfo | ||
+ | Cookie: OwnerId={owner_id}; Path=/ | ||
+ | Authorization: Basic Auth_String | ||
+ | |||
+ | { | ||
+ | "paymentInfoType": "offline" | ||
}</nowiki> | }</nowiki> | ||
Revision as of 15:09, 17 June 2015
PUT /orders/{orderId}/account/paymentInfo
Set the account's payment information for a given order.
Request
PUT /orders/{orderId}/account/paymentInfo
Request Parameters
- orderId - string
- The unique order Id. The URI of the order is returned by the POST /orders call.
URI Parameters
None.
Request Headers
- Content-Type
- Required. Set this header to
application/json; charset=UTF-8
- Cookie
- A cookie named OwnerId to identify the client (for most browser clients, the browser will do this automatically, depending on the browser configuration). The value of the cookie would come from the response to the create order request in the Set-Cookie response header.
Request Body
The request format depends on the type of payment method that is added. The following format is required for credit cards.
{ "paymentInfoType": "credit_card", "accountNumber": "4111111111111111", "cardHolderName": "John Smith", "creditCardType": "visa", "expirationDate": "2012-08", "verificationNumber": "123", "billingAddress": { "city": "Chicago", "countryCode": "US", "postalCode": "60606", "stateOrProvince": "IL", "street1": "100 N Riverside", "street2": "" } }
Parameters
- paymentInfoType - string
- The type of payment method that will be used. Allowed value(s) are:
- credit_card
- offline (Available only for agents on supported franchises)
- accountNumber - string
- Credit card number. Must consist of numbers only. Required if paymentInfoType is set to credit_card.
- cardHolderName - string
- The owner name as it appears on the card. Required if paymentInfoType is set to credit_card.
- creditCardType - string
- The type of credit card - visa, mastercard, discover, amex. Required if paymentInfoType is set to credit_card.
- expirationDate - string
- The credit card expiration date in YYYY-MM format. Should exceed the current date. Required if paymentInfoType is set to credit_card.
- verificationNumber - string
- The credit card security code. This is only used to validate the credit card and will not be stored. Required if paymentInfoType is set to credit_card.
- billingAddress - dictionary
- Contains the credit card's billing address. Required if paymentInfoType is set to credit_card.
Response
Status Code
Status Code | Error Message | Description |
---|---|---|
204 No Content | - | The operation was successfully completed. |
400 Bad Request | POST data error | A required attribute for the payment info type is missing. |
paymentInfoType can only be credit_card. | ||
declined | Invalid verificationNumber | |
Invalid date format | Wrong expirationDate format | |
invalid number or type | creditCardType can be only one of visa, mastercard, amex, discover. | |
Credit card number with wrong length | ||
Credit card number does not comply with visa rules | ||
expirationDate set in past | ||
Incorrect padding | Hyphens or spaces in credit card number are not allowed | |
Input strings must be a multiple of 16 in length | Credit card number length should be 16. | |
401 Unauthorized | - | No owner Id specified or the specified owner is not authorized to add payment info. |
403 Forbidden | Unauthorized: PaymentInfo failed permission check | An unauthorized user cannot set or get payment info. |
404 Not Found | Resource not found | The specified order does not exist. |
502 Bad Gateway | - | An account has not been added to the given order. |
Unexpected backend error. |
Response Body
None.
Example
Success
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "creditCardType": "visa", "accountNumber": "4111111111111111", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "505", "billingAddress": { "street1": "100 n riverside", "street2": "ste 800", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
204 No Content
Offline payment for supported franchises with agent access
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ Authorization: Basic Auth_String { "paymentInfoType": "offline" }
Response
204 No Content
Invalid payment info type
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "direct_debit", "creditCardType": "visa", "accountNumber": "4111111111111111", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "505", "billingAddress": { "street1": "100 n riverside", "street2": "ste 800", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "badRequest": { "guid": "7ca8b2cc-88d5-4e5b-aab8-e4015a5b3ad8", "message": "POST data error", "code": 400, "details": { "paymentInfoType": "\"direct_debit\" is not one of credit_card, vz_payment" } } }
Missing attribute for paymentInfoType credit_card
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "accountNumber": "4111111111111111", "cardHolderName": "John Smith", "creditCardType": "visa", "expirationDate": "2012-08", "billingAddress": { "city": "Chicago", "countryCode": "US", "postalCode": "60606", "stateOrProvince": "IL", "street1": "100 N Riverside", "street2": "" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "badRequest": { "guid": "2829e9e2-04e1-4fe2-8e05-be738b4c467c", "message": "POST data error", "code": 400, "details": { "verificationNumber": "Required" } } }
Credit card number length exceeds 16 characters
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "accountNumber": "4111-1111-1111-1111", "cardHolderName": "John Smith", "creditCardType": "visa", "expirationDate": "2012-08", "verificationNumber": "505", "billingAddress": { "city": "Chicago", "countryCode": "US", "postalCode": "60606", "stateOrProvince": "IL", "street1": "100 N Riverside", "street2": "" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "badRequest": { "guid": "f5ed5738-086d-4751-8ad5-0dfead39ea3a", "message": "Input strings must be a multiple of 16 in length", "code": 400, "details": "" } }
Credit card number cannot contain hyphens
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "accountNumber": "4111-111-111-111", "cardHolderName": "John Smith", "creditCardType": "visa", "expirationDate": "2012-08", "verificationNumber": "505", "billingAddress": { "city": "Chicago", "countryCode": "US", "postalCode": "60606", "stateOrProvince": "IL", "street1": "100 N Riverside", "street2": "" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "computeFault": { "guid": "5a757a5a-870e-4d4f-acdf-aed95e066b3d", "message": "Incorrect padding", "code": 400, "details": "" } }
Credit card number with wrong length
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "accountNumber": "411111111111111122", "cardHolderName": "John Smith", "creditCardType": "visa", "expirationDate": "2012-08", "verificationNumber": "505", "billingAddress": { "city": "Chicago", "countryCode": "US", "postalCode": "60606", "stateOrProvince": "IL", "street1": "100 N Riverside", "street2": "" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "badRequest": { "guid": "ced1a8a8-21dc-4a10-9d36-5a201214a5ce", "message": "invalid number or type", "code": 400, "details": "" } }
Invalid verification number
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "creditCardType": "visa", "accountNumber": "4111111111111111", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "0000", "billingAddress": {"street1": "100 n riverside", "street2": "ste 800", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "computeFault" : { "guid" : "031b8bc2-8da3-41c7-860c-ca3743cef135", "message" : "declined", "code" : 400, "details" : "" } }
Invalid date format
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "accountNumber": "4111111111111111", "cardHolderName": "John Smith", "creditCardType": "visa", "expirationDate": "15-06", "verificationNumber": "505", "billingAddress": { "city": "Chicago", "countryCode": "US", "postalCode": "60606", "stateOrProvince": "IL", "street1": "100 N Riverside", "street2": "" } }
Response
400 Bad Request Content-Type : application/json; charset=UTF-8 { "badRequest": { "guid": "30e66cfe-649c-4b1c-bfaf-c65caf47b99d", "message": "Invalid date format", "code": 400, "details": "" } }
No authorization
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={wrong_owner_id}; Path=/ { "paymentInfoType": "credit_card", "creditCardType": "visa", "accountNumber": "4111111111111111", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "505", "billingAddress": { "street1": "100 n riverside", "street2": "ste 800", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
401 Unauthorized Content-Type : text/plain; charset=UTF-8 401 Unauthorized This server could not verify that you are authorized to access the document you requested. Either you supplied the wrong credentials (e.g., bad password), or your browser does not understand how to supply the credentials required.
Unauthorized user
Request
PUT /orders/{orderId}/account/paymentInfo Authorization: Basic {wrong_user_authorization} { "paymentInfoType": "credit_card", "creditCardType": "visa", "accountNumber": "4111111111111111", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "505", "billingAddress": { "street1": "100 n riverside", "street2": "ste 800", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
403 Forbidden Content-Type : application/json; charset=UTF-8 { "forbidden": { "guid": "5a199170-843a-44fc-bbb0-87155eb15fc6", "message": "Unauthorized: PaymentInfo failed permission check", "code": 403, "details": "" } }
Unset account for the order
Request
PUT /orders/{orderId}/account/paymentInfo Cookie: OwnerId={owner_id}; Path=/ { "paymentInfoType": "credit_card", "creditCardType": "visa", "accountNumber": "4111111111111111", "cardHolderName": "John Jello", "expirationDate": "2015-06", "verificationNumber": "505", "billingAddress": { "street1": "100 n riverside", "street2": "ste 800", "city": "Chicago", "stateOrProvince": "IL", "postalCode": "60606", "countryCode": "US" } }
Response
502 Bad Gateway Content-Type : application/json; charset=UTF-8 { "computeFault": { "guid": "a4f6b310-11d9-4263-8482-81bccf261df7", "timestamp": "2014-09-08 08:34:20", "code": 502, "errorRefId": "a4f6b310-11d9-4263-8482-81bccf261df7" } }
See also