Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating a Deal With Products #65

Open
0Neji opened this issue Mar 12, 2019 · 1 comment
Open

Creating a Deal With Products #65

0Neji opened this issue Mar 12, 2019 · 1 comment

Comments

@0Neji
Copy link

0Neji commented Mar 12, 2019

Hi,

I'm trying using the API (PHP) to create a new Deal when someone makes a purchase on my WooCommerce site.

I've got this working nicely, but I'd like to assign a product to the Deal at the same time. I can't see any documentation showing how this is done.

Is this possible and if so, how would I go about doing it?

This is the code I'm currently using to create the deal:

$opportunity_json = array(
	"name" => $deal['name'],
	"expected_value" => $order_meta['_order_total'][0],
	"milestone" => "Open",
	/*"custom_data"=> array(
		array(
			"name" => "dataone",
			"value" => "xyz"
		),
		array(
			"name" => "datatwo",
			"value" => "abc"
		)
	),*/
	//"probability" => 50,
	//"close_date" => 1414317504,
	"contact_ids" => array($contact['id'])
);

$opportunity_json = json_encode($opportunity_json);

curl_wrap("opportunity", $opportunity_json, "POST", "application/json");

Thanks,

Ben

@0Neji 0Neji changed the title PHP Api - Creating a Deal With Products Creating a Deal With Products Mar 12, 2019
@rammohan-agile
Copy link
Contributor

hi @0Neji yes we can create a Deal when a user purchase a product For example please look in below post man example to create Deal

URL :- https://{domain}.agilecrm.com/dev/api/opportunity

METHOD :- POST

HEADRES :- Content-Type : application/json
Accept : application/json

place this json in data in body section as RAW

{
"name": "Deal-Tomato",
"expected_value": "500",
"probability": "75",
"close_date": 1455042600,
"milestone": "Proposal",
"contact_ids": [
"5758948741218304"
],
"custom_data": [
{
"name": "Group Size",
"value": "10"
}
]
}

this will create a deal in ur domain , so please pass the PRODUCT details to Json data then the deal will add

Hope this will help you , please let us if you need any further help.

Thanks,
Agile Crm Support Team .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants