addCreditCard
post
/ccappagent/v1/profiles/{id}/creditCards
Add credit card for the shopper. The credit card data is tokenised and is stored against the profile.
Request
Supported Media Types
- application/json
Path Parameters
-
id: string
The customer profile id.
Header Parameters
-
X-CCAsset-Language(optional): string
The asset language of the request.
Root Schema : addCreditCard_request
Type:
Show Source
object
-
billingAddress(optional):
object billingAddress
The billing address details.
-
cardCVV(optional):
string
Card secret pin.
-
cardNumber:
string
Card number to be be added.
-
cardType:
string
Card type. e.g. visa.
-
customProperties(optional):
object customProperties
Custom object with dynamic properties. This will be passed to the webhook request
-
expiryMonth:
integer
Card expiry month.
-
expiryYear:
integer
Card expiry year.
-
nameOnCard:
string
Name on the card.
-
nickname(optional):
string
The nick name for the credit card.
-
setAsDefault(optional):
boolean
The flag to determine whether the card needs to be set as default card for the profile.
Example:
{
"cardCVV":"123",
"customProperties":{
"prop2":"value2",
"prop1":"value1"
},
"nameOnCard":"card2",
"expiryMonth":"03",
"cardType":"visa",
"nickname":"visa - 1111",
"expiryYear":"2021",
"billingAddress":{
"lastName":"Anderson",
"country":"US",
"address2":"",
"city":"Syracuse",
"address1":"21 Cedar Ave",
"postalCode":"13202",
"county":"",
"selectedCountry":"US",
"firstName":"Kim",
"phoneNumber":"212-555-1977",
"state":"New York",
"selectedState":"NY",
"email":"kim@example.com",
"state_ISOCode":"US-NY"
},
"cardNumber":"4123567812341111",
"setAsDefault":true
}
Nested Schema : billingAddress
Type:
object
The billing address details.
Show Source
-
address1:
string
Address snippet.
-
address2(optional):
string
Address snippet.
-
address3(optional):
string
Address snippet.
-
alias(optional):
string
Address alias.
-
city:
string
City.
-
companyName(optional):
string
Company name.
-
country:
string
Country.
-
county(optional):
string
County.
-
email(optional):
string
Email.
-
faxNumber(optional):
string
Fax number.
-
firstName:
string
First name.
-
jobTitle(optional):
string
Job title.
-
lastName:
string
Last name.
-
middleName(optional):
string
Middle name.
-
phoneNumber(optional):
string
Phone number.
-
postalCode:
string
Postal code.
-
prefix(optional):
string
Name prefix.
-
selectedCountry:
string
Country code.
-
selectedState:
string
State code.
-
state:
string
State.
-
state_ISOCode:
string
State ISO code.
-
suffix(optional):
string
Name suffix.
Nested Schema : customProperties
Type:
object
Custom object with dynamic properties. This will be passed to the webhook request
Response
Supported Media Types
- application/json
200 Response
Following model is returned when the operation succeeds.
Root Schema : addCreditCard_response
Type:
Show Source
object
-
additionalInfo(optional):
string
This field is a custom property which stores any pretext specific to the card.
-
cardNumber(optional):
string
The masked card number.
-
cardType(optional):
string
The type of the card.
-
customPaymentProperties(optional):
object customPaymentProperties
The set of properties returned by the generic payment webhook.
-
expiryMonth(optional):
string
The expiry month for the card. Value lies between 01-12.
-
expiryYear(optional):
string
The expiry year for the card.
-
hasExpired(optional):
boolean
The flag that indicates if the card can be used or has it expired.
-
iin(optional):
string
The issuer identification number for the card.
-
isDefault(optional):
boolean
The flag that indicates if the card is the default card for the current user.
-
nameOnCard(optional):
string
The name on the card.
-
nickname(optional):
string
The nick name for the card.
-
savedCardId(optional):
string
The card id for the saved credit card.
Nested Schema : customPaymentProperties
Type:
object
The set of properties returned by the generic payment webhook.
Example Response (application/json)
{
"savedCardId":"usercc10002",
"hasExpired":false,
"isDefault":true,
"customPaymentProperties":{
"addl-prop4":"addl-prop4",
"addl-prop3":"addl-prop3",
"addl-prop1":"addl-prop1",
"decision":null,
"reasonCode":null
},
"nameOnCard":"card2",
"expiryMonth":"03",
"cardType":"visa",
"nickname":"Home Card 2",
"links":[
{
"rel":"self",
"href":"http://localhost:9080/ccagentui/v1/profiles/se-570031/creditCards"
}
],
"expiryYear":"2021",
"cardNumber":"xxxxxxxxxxxx1111",
"iin":"411111"
}
Default Response
The error response.
The following are the internal error codes thrown by this API when the request processing fails in Oracle Commerce Cloud:
|Error Code|Description|
|------------------|------------------|
|28396|Provided card details are incorrect.|
|28397|An error occured while trying to add the credit card.|
|28398|Tokenisation declined by payment gateway. Error message sent by the gateway will be returned.|
|28399|Adding credit card is not supported on this site.
Root Schema : errorModel
Type:
Show Source
object
-
devMessage(optional):
string
An optional non-localized message containing technical information for developers
-
errorCode(optional):
string
The numerical code identifying the error
-
errors(optional):
array errors
An optional list of errors if multiple errors were encountered
-
message(optional):
string
The localized message describing the error
-
moreInfo(optional):
string
An optional non-localized message with more information
-
o:errorPath(optional):
string
An optional machine readable description of where the error occurred
-
status(optional):
string
The HTTP status code
-
type(optional):
string
The URI to the HTTP state code definition
Nested Schema : errors
Type:
array
An optional list of errors if multiple errors were encountered
Show Source
Nested Schema : items
Type:
Show Source
object
-
devMessage(optional):
string
An optional non-localized message containing technical information for developers
-
errorCode(optional):
string
The numerical code identifying the error
-
message(optional):
string
The localized message describing the error
-
moreInfo(optional):
string
An optional non-localized message with more information
-
o:errorPath(optional):
string
An optional machine readable description of where the error occurred
-
status(optional):
string
The HTTP status code