[Skip to main content](#vessel-content)

#   Add Address via Script.. is there any API ?

##

- **[veeco](/forum/user/18501-veeco "View veeco's Profile")**
- [![veeco's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/18501-veeco "View veeco's Profile") Topic Author
- [ Offline](/forum/user/18501-veeco)

Less More

- Posts: 175
- Thank you received: 0
-
-

10 years 5 months ago [\#242963](#242963) by [veeco](/forum/user/18501-veeco "View veeco's Profile")  *[Add Address via Script.. is there any API ?](/forum/27-checkout/885066-add-address-via-script-is-there-any-api#242963 "-- HikaShop version -- : 2.6.3  Hello, i have a custom checkout, i need to add address via script.. is there any API that handle this ? if not, can you point me which script that done this process.. i will try to duplicate the script in my custom script  Thanks")* was created by *[veeco](/forum/user/18501-veeco "View veeco's Profile")*

-- HikaShop version -- : 2.6.3

Hello,
i have a custom checkout, i need to add address via script.. is there any API that handle this ? if not, can you point me which script that done this process.. i will try to duplicate the script in my custom script

Thanks

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NTA2Ni1hZGQtYWRkcmVzcy12aWEtc2NyaXB0LWlzLXRoZXJlLWFueS1hcGk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14326
-
-

10 years 5 months ago [\#242965](#242965) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Add Address via Script.. is there any API ?](/forum/27-checkout/885066-add-address-via-script-is-there-any-api#242965 "-- HikaShop version -- : 2.6.3  Hello, i have a custom checkout, i need to add address via script.. is there any API that handle this ? if not, can you point me which script that done this process.. i will try to duplicate the script in my custom script  Thanks")*

Hi,

I would recommend to have a look at the code of the the PayPal Express plugin where it creates an address based on the data provided by PayPal: Code:

$address = $this-&gt;createAddress($vars,$userid); $addressClass = hikashop_get('class.address'); $addressid = $addressClass-&gt;save($address); function createAddress($vars,$userid) { if (empty($userid) ) return false; else { $db = JFactory::getDBO(); if(!empty($vars['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE'] ) ) { $db-&gt;setQuery('SELECT zone_namekey FROM &#96;#__hikashop_zone&#96; WHERE zone_code_2 = '. $db-&gt;Quote($vars['PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE']).' AND zone_type = \'country\';'); $country = $db-&gt;loadResult(); } if (empty($country) ) { $db-&gt;setQuery('SELECT zone_namekey FROM &#96;#__hikashop_zone&#96; WHERE zone_name_english = '. $db-&gt;Quote($vars['PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME']).' AND zone_type = \'country\';'); $country = $db-&gt;loadResult(); if (empty($country)) $country = $vars['PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME']; } if (empty($vars['PAYMENTREQUEST_0_SHIPTOSTATE'] ) ) $state = "NULL"; else { $db-&gt;setQuery('SELECT zone_namekey FROM &#96;#__hikashop_zone&#96; WHERE zone_code_2 = ' .$db-&gt;Quote($vars['PAYMENTREQUEST_0_SHIPTOSTATE']).' AND zone_type = \'state\';'); $state = $db-&gt;loadResult(); if (empty($state) ) $state = $vars['PAYMENTREQUEST_0_SHIPTOSTATE']; } $address = new stdClass(); $address-&gt;address_user_id = $userid; $address-&gt;address_firstname = $vars['FIRSTNAME']; $address-&gt;address_lastname = $vars['LASTNAME']; $address-&gt;address_street = $vars['PAYMENTREQUEST_0_SHIPTOSTREET']; $address-&gt;address_post_code = $vars['PAYMENTREQUEST_0_SHIPTOZIP']; $address-&gt;address_city = $vars['PAYMENTREQUEST_0_SHIPTOCITY']; $address-&gt;address_state = $state; $address-&gt;address_country = $country; } return $address; }

You can find that in plugins/hikashoppayment/paypalexpress/

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg4NTA2Ni1hZGQtYWRkcmVzcy12aWEtc2NyaXB0LWlzLXRoZXJlLWFueS1hcGk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.053 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
