Create shopper details.

Create New Shopper

Creates an address including name for the shopper.

POST /ps/api/public/v1/merchants/{merchant_key}/shoppers

Identifiers

NameTypeDescription
merchant_keyMerchantKeyThe key of the merchant.

Parameters

Not applicable.

Request

FieldTypeMDescription
shopper_referenceString(1, 50)MThe shopper reference from the merchant.
nameBlockMThe shopper name for the address.
+ initialsString(1, 35)OThe initials. This field is commonly omitted.
+ firstString(1, 35)MThe first given name.
+ middleString(1, 35)OAny subsequent given name or names. May also be used as middle initial.
+ lastString(1, 35)MThe family or inherited name(s).
addressBlockMThe address details.
+ streetString(1, 100)MThe street.
+ housenumberString(1, 35)MThe house number.
+ housenumber_additionString(1, 35)OThe addition to the house number.
+ postal_codeString(1, 35)OThe postal or zip code.
+ cityString(1, 35)MThe city.
+ stateString(1, 40)CFor PayPal payment method, state should only be provided under certain conditions as mentioned here.
+ countryCountryMThe country as ISO 3166-1 Alpha 2.
emailString(1, 200)MThe email address of the shopper.
genderEnum(1)OThe gender of the shopper: "M" (Male), "F" (Female), or "U" (Unknown).
date_of_birthDateOThe date of birth of the shopper (yyyy-mm-dd).
phone_numberString(1, 50)OThe phone number of the shopper.

Note :

  • gender, date_of_birth and phone_number are only used for the payment methods Afterpay, Klarna, Giropay, ELV, E-Financing, and Capayable.
  • The address fields street, city and state can accept apostrophes at the beginning.

Response

FieldTypeMDescription
shopper_keyShopperKeyMThe key of the created or existing shopper.
address_keyAddressKeyMThe key of the created address.

HTTP Status

StatusMeaning
201 (Created)The order is successfully created.
400 (Bad Request)The request was not valid.
404 (Not Found)The merchant key was not found.

Create New shopper address example

> curl \
    -X POST \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://secure.sandbox.pay.cm.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/shoppers \
    -d '{
        "shopper_reference" : "vk20170224p",
        "name" : {
             "first"  : "Johan",
             "middle" : "de",
             "last"   : "Vries"
        },
        "address"   : {
             "street"      : "Hoofdstraat",
             "housenumber" : "82",
             "housenumber_addition": "A",
             "postalcode"  : "3972LB",
             "city"        : "Driebergen-Rijsenburg",
             "state"       : "Utrecht",
             "country"     : "DE"
        },
        "email"         : "[email protected]",
        "gender"        : "M",
        "date_of_birth" : "1996-12-01",
        "phone_number"  : "+31611223344"
    }'
 
< Http 201 Created
<    '{
        "shopper_key" : "ec11cd24-e667-4f9e-a677-5ffe0d4aee5e",
        "address_key" : "ec11cd24-e667-4f9e-a677-5ffe0d4aee5e"
    }'

Note :

  • Currently, the same key is generated for shopper_key and address_key. In the future it will be different.

Return addresses of a shopper

Return the shopper addresses for given shopper key along with shopper information.

GET /ps/api/public/v1/merchants/{merchant_key}/shoppers/{shopper_key}/addresses

Identifiers

NameTypeDescription
shopper_keyShopperKeyThe key of the shopper.
merchant_keyMerchantKeyThe key of the merchant.

Parameters

Not applicable.

Request

Not applicable.

Response

Array of:

FieldTypeMDescription
shopper_referenceString(1, 50)MThe shopper reference from the merchant.
nameBlockMThe shopper name for the address.
+ initialsString(1, 35)OThe initials. This field is commonly omitted.
+ firstString(1, 35)MThe first given name.
+ middleString(1, 35)OAny subsequent given name or names. May also be used as middle initial.
+ lastString(1, 35)MThe family or inherited name(s).
addressBlockMThe address details.
+ streetString(1, 100)MThe street.
+ housenumberString(1, 35)MThe house number.
+ housenumber_additionString(1, 35)OThe addition to the house number.
+ postal_codeString(1, 35)OThe postal or zip code.
+ cityString(1, 35)MThe city.
+ stateString(1, 40)CFor PayPal payment method, state should only be provided under certain conditions as mentioned here.
+ countryCountryMThe country as ISO 3166-1 Alpha 2.
emailString(1, 200)MThe email address of the shopper.
genderEnum(1)OThe gender of the shopper: "M" (Male), "F" (Female), or "U" (Unknown).
date_of_birthDateOThe date of birth of the shopper (yyyy-mm-dd).
phone_numberString(1, 50)OThe phone number of the shopper.

HTTP Status

StatusMeaning
200 (OK)Success.
401 (Unauthorized)Authorization header missing or invalid.
403 (Forbidden)The merchant key is not allowed.
404 (Not Found)The shopper key / merchant key were not found.

Get shopper addresses example

> curl \
    -X GET \
    --header 'Authorization: Basic RG9jZGF0YVBGOkJXazJhZkpV' \
    https://secure.sandbox.pay.cm.com/ps/api/public/v1/merchants/4ef08825-993a-424d-a769-3ee97116a1b6/shoppers/ec11cd24-e667-4f9e-a677-5ffe0d4aee5e/addresses
 
< Http 200 Ok
<    '[
        {
            "shopper_reference": "ceedb1d0-020d-49a5-b1be-6c0a8d6f8ccd",
            "name": {
                "initials": "A",
                "first": "Johan",
                "middle": "de",
                "last": "Vries"
            },
            "address": {
                "street": "Hoofdstraat",
                "housenumber": "82",
                "housenumber_addition": "A",
                "postal_code": "3972LB",
                "city": "Driebergen-Rijsenburg",
                "state": "Utrecht",
                "country": "NL"
            },
            "email": "M",
            "date_of_birth": "1996-12-01",
            "phone_number": "+31611223344"
        }
      ]'