# API Connecting Shopping Cart -\> Mautic

**URL:** <https://forum.mautic.org/t/api-connecting-shopping-cart-mautic/2319>\
**Category:** Product Support\
**Created:** [September 11, 2015, 10:39am UTC](https://forum.mautic.org/t/api-connecting-shopping-cart-mautic/2319 "2015-09-11T10:39:09Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Edutj](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@Edutj](https://forum.mautic.org/u/Edutj)\
**Post date:** [September 11, 2015, 10:39am UTC](https://forum.mautic.org/t/api-connecting-shopping-cart-mautic/2319/1 "2015-09-11T10:39:09Z")

</div>

Hey guys,  
  
  
  
I recently decided to create an API to connect my shopping cart service to mautic, so every buyer enters Mautic as a new lead. The shopping cart system sends the data as a POST using CURL, the data is sent to mauticinstalldirectory/api/index.php.  
  
  
  
The main problem is how to connect the data sent for the first time from the page into mautic. The problem is the same either using oAuth1a and oAuth2…  
  
  
  
So far, we were able to authorize and create a new lead (only if the data predefined inside the API file). Ex:  
  
$lead = $leadApi-\>create(array(  
  
‘ipAddress’ =\> $\_SERVER,  
  
‘firstname’ =\> ‘name’,  
  
‘lastname’ =\> ‘lastname’,  
  
‘email’ =\> ‘email’,  
  
));  
  
  
  
But if i define:  
  
  
  
$lead = $leadApi-\>create(array(  
  
‘ipAddress’ =\> $\_SERVER,  
  
‘firstname’ =\> $\_POST,  
  
‘lastname’ =\> $\_POST,  
  
‘email’ =\> $\_POST,  
  
));  
  
  
  
It doesn’t work.  
  
  
  
Do you guys have any ideas on how to solve this? Do you need more information?

---

<div class="post-metadata">

**Author:** ![Edutj](https://avatars.discourse-cdn.com/v4/letter/e/9de0a6/32.png) [@Edutj](https://forum.mautic.org/u/Edutj)\
**Post date:** [September 11, 2015, 10:39am UTC](https://forum.mautic.org/t/api-connecting-shopping-cart-mautic/2319/2 "2015-09-11T10:39:09Z")

</div>

Hey guys,

I recently decided to create an API to connect my shopping cart service to mautic, so every buyer enters Mautic as a new lead. The shopping cart system sends the data as a POST using CURL, the data is sent to mauticinstalldirectory/api/index.php.

The main problem is how to connect the data sent for the first time from the page into mautic. The problem is the same either using oAuth1a and oAuth2…

So far, we were able to authorize and create a new lead (only if the data predefined inside the API file). Ex:  
$lead = $leadApi-\>create(array(  
‘ipAddress’ =\> $\_SERVER[‘REMOTE\_ADDR’],  
‘firstname’ =\> ‘name’,  
‘lastname’ =\> ‘lastname’,  
‘email’ =\> ‘email’,  
));

But if i define:

$lead = $leadApi-\>create(array(  
‘ipAddress’ =\> $\_SERVER[‘REMOTE\_ADDR’],  
‘firstname’ =\> $\_POST[‘firstname’],  
‘lastname’ =\> $\_POST[‘lastname’],  
‘email’ =\> $\_POST[‘email’],  
));

It doesn’t work.

Do you guys have any ideas on how to solve this? Do you need more information?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [September 11, 2015, 11:59am UTC](https://forum.mautic.org/t/api-connecting-shopping-cart-mautic/2319/3 "2015-09-11T11:59:26Z")

</div>

Does it throw any error? Do you have PHP reporting turned on? Try to put these 2 lines at the beginning of your PHP file:

`error_reporting(-1);
ini_set('display_errors', 'On');`

---

<div class="post-metadata">

**Author:** ![silavapi](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/silavapi/32/7424_2.png) [@silavapi](https://forum.mautic.org/u/silavapi)\
**Post date:** [February 2, 2020, 10:58pm UTC](https://forum.mautic.org/t/api-connecting-shopping-cart-mautic/2319/4 "2020-02-02T22:58:34Z")

</div>


