Magento 2 REST API Add Single Customer AddressMAGENTO 2 REST API Checkout payment using credit cardget...
How would an AI self awareness kill switch work?
Why does magnet wire need to be insulated?
Why do neural networks need so many training examples to perform?
What is the industry term for house wiring diagrams?
Non-Cancer terminal illness that can affect young (age 10-13) girls?
Am I correct in stating that the study of topology is purely theoretical?
What is a DAG (Graph Theory)?
What will happen if I transfer large sums of money into my bank account from a pre-paid debit card or gift card?
How much mayhem could I cause as a fish?
Count repetitions of an array
Is there any risk in sharing info about technologies and products we use with a supplier?
Is there a verb that means to inject with poison?
Current across a wire with zero potential difference
The probability of reaching the absorbing states from a particular transient state?
Does Skippy chunky peanut butter contain trans fat?
microtype error with lualatex: "attempt to call field warning a nil value"
Hosting images in SFMC - is it a good idea?
Prioritising polygons in QGIS
Does it take energy to move something in a circle?
How to access internet and run apt-get through a middle server?
Website seeing my Facebook data?
"Starve to death" Vs. "Starve to the point of death"
How to deal with possible delayed baggage?
Can we "borrow" our answers to populate our own websites?
Magento 2 REST API Add Single Customer Address
MAGENTO 2 REST API Checkout payment using credit cardget customer info based on email address using rest API in Magento 2Magento 2 : Rest API get product price including taxMagento 2: Rest api add custom attributes to shipping informationMagento 2.1.9 How to update existing order information using rest api?Setting Shipping address via REST API Magento 2Magento 2 REST API Product VariantsHow to add only address through REST APICould not Add customer address using customer id using Magento-2 REST APIDo I need to add shipping address every time whenever I place a new order in Magento 2 REST API?
Can anyone mention the Jason payload to add new address in existing customer.
yes its a shipping address
How to add new Address using REST API, While placing an order.
magento2 rest-api
add a comment |
Can anyone mention the Jason payload to add new address in existing customer.
yes its a shipping address
How to add new Address using REST API, While placing an order.
magento2 rest-api
Arsalan, if any answer helps you then you mark accepted to those answer, so it will helpful for future readers, you can mark accept answer by clicking (✓) next to answer.
– Aditya Shah
Jan 17 at 6:24
add a comment |
Can anyone mention the Jason payload to add new address in existing customer.
yes its a shipping address
How to add new Address using REST API, While placing an order.
magento2 rest-api
Can anyone mention the Jason payload to add new address in existing customer.
yes its a shipping address
How to add new Address using REST API, While placing an order.
magento2 rest-api
magento2 rest-api
edited Jan 3 at 6:13
Aditya Shah
3,89421036
3,89421036
asked Jan 2 at 18:51
Arsalan KArsalan K
1
1
Arsalan, if any answer helps you then you mark accepted to those answer, so it will helpful for future readers, you can mark accept answer by clicking (✓) next to answer.
– Aditya Shah
Jan 17 at 6:24
add a comment |
Arsalan, if any answer helps you then you mark accepted to those answer, so it will helpful for future readers, you can mark accept answer by clicking (✓) next to answer.
– Aditya Shah
Jan 17 at 6:24
Arsalan, if any answer helps you then you mark accepted to those answer, so it will helpful for future readers, you can mark accept answer by clicking (✓) next to answer.
– Aditya Shah
Jan 17 at 6:24
Arsalan, if any answer helps you then you mark accepted to those answer, so it will helpful for future readers, you can mark accept answer by clicking (✓) next to answer.
– Aditya Shah
Jan 17 at 6:24
add a comment |
2 Answers
2
active
oldest
votes
As I understand form your question you need to add shipping address while placing an order from REST API
You can use shipping-information API
Get & put Shipping Information.
http://magento-host/index.php/rest/V1/carts/mine/shipping-information
method : POST
Authorization : Bearer <customer token>
body data : json
{
"addressInformation": {
"shippingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "400001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH",
"sameAsBilling": 1
},
"billingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "4000001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
add a comment |
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$addresss = $objectManager->get('MagentoCustomerModelAddressFactory');
$address = $addresss->create();
$address->setCustomerId($customerId)
->setFirstname($firstName)
->setLastname($lastName)
->setCountryId($countryCode)
->setPostcode($postCode)
->setCity($city)
->setTelephone($telephone)
->setFax($fax)
->setCompany($company)
->setStreet($street)
->setIsDefaultBilling('0')
->setIsDefaultShipping('0')
->setSaveInAddressBook('1');
if($address->save()){
return true;
}else{
return false;
}
{ "data": { "cust_id": x, "email": "XXX@gmail.com", "first_name":
"xxx", "last_name": "xxx", "region_code": "xxx", "country_id": "xx",
"street": [ "road4" ], "telephone": "xxxxxxx", "postcode": "xxxx",
"city": "xxxxx", "company":"", "fax":"", "default_shipping": "1",
"default_billing": "1" } }
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256503%2fmagento-2-rest-api-add-single-customer-address%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
As I understand form your question you need to add shipping address while placing an order from REST API
You can use shipping-information API
Get & put Shipping Information.
http://magento-host/index.php/rest/V1/carts/mine/shipping-information
method : POST
Authorization : Bearer <customer token>
body data : json
{
"addressInformation": {
"shippingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "400001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH",
"sameAsBilling": 1
},
"billingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "4000001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
add a comment |
As I understand form your question you need to add shipping address while placing an order from REST API
You can use shipping-information API
Get & put Shipping Information.
http://magento-host/index.php/rest/V1/carts/mine/shipping-information
method : POST
Authorization : Bearer <customer token>
body data : json
{
"addressInformation": {
"shippingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "400001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH",
"sameAsBilling": 1
},
"billingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "4000001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
add a comment |
As I understand form your question you need to add shipping address while placing an order from REST API
You can use shipping-information API
Get & put Shipping Information.
http://magento-host/index.php/rest/V1/carts/mine/shipping-information
method : POST
Authorization : Bearer <customer token>
body data : json
{
"addressInformation": {
"shippingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "400001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH",
"sameAsBilling": 1
},
"billingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "4000001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
As I understand form your question you need to add shipping address while placing an order from REST API
You can use shipping-information API
Get & put Shipping Information.
http://magento-host/index.php/rest/V1/carts/mine/shipping-information
method : POST
Authorization : Bearer <customer token>
body data : json
{
"addressInformation": {
"shippingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "400001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH",
"sameAsBilling": 1
},
"billingAddress": {
"region": "MH",
"region_id": 0,
"country_id": "IN",
"street": [
"221,Baker-street (e)"
],
"company": "Lumos",
"telephone": "12345678",
"postcode": "4000001",
"city": "Mumbai",
"firstname": "Aditya",
"lastname": "Shah",
"email": "Aditya@Shah.com",
"prefix": "address_",
"region_code": "MH"
},
"shipping_method_code": "flatrate",
"shipping_carrier_code": "flatrate"
}
}
answered Jan 3 at 6:18
Aditya ShahAditya Shah
3,89421036
3,89421036
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
add a comment |
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
but this doesn't show up baseurl/rest/V1/customers/me/ address
– Adarsh Shukla
8 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
pass "saveInAddressBook": 1, in both array.
– Aditya Shah
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
no still i don't get
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
imgur.com/a/8TDChfT is this correct
– Adarsh Shukla
7 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
Have you checked what is missing
– Adarsh Shukla
4 hours ago
add a comment |
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$addresss = $objectManager->get('MagentoCustomerModelAddressFactory');
$address = $addresss->create();
$address->setCustomerId($customerId)
->setFirstname($firstName)
->setLastname($lastName)
->setCountryId($countryCode)
->setPostcode($postCode)
->setCity($city)
->setTelephone($telephone)
->setFax($fax)
->setCompany($company)
->setStreet($street)
->setIsDefaultBilling('0')
->setIsDefaultShipping('0')
->setSaveInAddressBook('1');
if($address->save()){
return true;
}else{
return false;
}
{ "data": { "cust_id": x, "email": "XXX@gmail.com", "first_name":
"xxx", "last_name": "xxx", "region_code": "xxx", "country_id": "xx",
"street": [ "road4" ], "telephone": "xxxxxxx", "postcode": "xxxx",
"city": "xxxxx", "company":"", "fax":"", "default_shipping": "1",
"default_billing": "1" } }
add a comment |
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$addresss = $objectManager->get('MagentoCustomerModelAddressFactory');
$address = $addresss->create();
$address->setCustomerId($customerId)
->setFirstname($firstName)
->setLastname($lastName)
->setCountryId($countryCode)
->setPostcode($postCode)
->setCity($city)
->setTelephone($telephone)
->setFax($fax)
->setCompany($company)
->setStreet($street)
->setIsDefaultBilling('0')
->setIsDefaultShipping('0')
->setSaveInAddressBook('1');
if($address->save()){
return true;
}else{
return false;
}
{ "data": { "cust_id": x, "email": "XXX@gmail.com", "first_name":
"xxx", "last_name": "xxx", "region_code": "xxx", "country_id": "xx",
"street": [ "road4" ], "telephone": "xxxxxxx", "postcode": "xxxx",
"city": "xxxxx", "company":"", "fax":"", "default_shipping": "1",
"default_billing": "1" } }
add a comment |
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$addresss = $objectManager->get('MagentoCustomerModelAddressFactory');
$address = $addresss->create();
$address->setCustomerId($customerId)
->setFirstname($firstName)
->setLastname($lastName)
->setCountryId($countryCode)
->setPostcode($postCode)
->setCity($city)
->setTelephone($telephone)
->setFax($fax)
->setCompany($company)
->setStreet($street)
->setIsDefaultBilling('0')
->setIsDefaultShipping('0')
->setSaveInAddressBook('1');
if($address->save()){
return true;
}else{
return false;
}
{ "data": { "cust_id": x, "email": "XXX@gmail.com", "first_name":
"xxx", "last_name": "xxx", "region_code": "xxx", "country_id": "xx",
"street": [ "road4" ], "telephone": "xxxxxxx", "postcode": "xxxx",
"city": "xxxxx", "company":"", "fax":"", "default_shipping": "1",
"default_billing": "1" } }
$objectManager = MagentoFrameworkAppObjectManager::getInstance();
$addresss = $objectManager->get('MagentoCustomerModelAddressFactory');
$address = $addresss->create();
$address->setCustomerId($customerId)
->setFirstname($firstName)
->setLastname($lastName)
->setCountryId($countryCode)
->setPostcode($postCode)
->setCity($city)
->setTelephone($telephone)
->setFax($fax)
->setCompany($company)
->setStreet($street)
->setIsDefaultBilling('0')
->setIsDefaultShipping('0')
->setSaveInAddressBook('1');
if($address->save()){
return true;
}else{
return false;
}
{ "data": { "cust_id": x, "email": "XXX@gmail.com", "first_name":
"xxx", "last_name": "xxx", "region_code": "xxx", "country_id": "xx",
"street": [ "road4" ], "telephone": "xxxxxxx", "postcode": "xxxx",
"city": "xxxxx", "company":"", "fax":"", "default_shipping": "1",
"default_billing": "1" } }
edited 3 hours ago
Chirag Patel
2,130320
2,130320
answered Jan 3 at 6:14
Purnendar GattuPurnendar Gattu
185
185
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f256503%2fmagento-2-rest-api-add-single-customer-address%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Arsalan, if any answer helps you then you mark accepted to those answer, so it will helpful for future readers, you can mark accept answer by clicking (✓) next to answer.
– Aditya Shah
Jan 17 at 6:24