Customer earns points when an invoice belongs a customer is recorded in Imonggo or through API. This happens automatically if the customer is a member of a defined group that earns points.
Example:
Use Customer API to to get customer information and see available points. This example assumes customer id is 1534.
curl -u 5c4fc5805eb643716bbc17dad456a0c6cf2e23fa:X \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \ "https://test_account.imonggo.com/api/customers/1534.xml"
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<alternate_code></alternate_code
<available_points>30511.0</available_points>
<birthday nil="true"></birthday>
<city></city>
<code>0098420130000033</code>
<company_name></company_name>
<country>PH</country>
<customer_type_id>8</customer_type_id>
<email></email>
<fax></fax>
<first_name>Juan</first_name>
<id>1534</id>
<last_name>Cruz</last_name>
<mobile></mobile>
<name>Juan Cruz</name>
<remark></remark>
<state></state>
<status nil="true"></status>
<street></street>
<tax_exempt>false</tax_exempt>
<telephone></telephone>
<tin></tin>
<zipcode></zipcode>
<customer_type_name>Gold</customer_type_name>
<discount_text>0.0%</discount_text>
<point_to_amount_ratio>200.0</point_to_amount_ratio>
<birthdate nil="true"></birthdate>
<utc_created_at>2013-05-25T02:24:31Z</utc_created_at>
<utc_updated_at>2013-07-13T00:52:24Z</utc_updated_at>
</customer>
To consume $10 from this customer:
curl -u 5c4fc5805eb643716bbc17dad456a0c6cf2e23fa:X \
-H "Accept: application/xml" \
-H "Content-Type: application/xml" \
-X POST \
"https://test_account.imonggo.com/api/rewards.xml?q=spend&customer_id=1534&amount=10&reference=X-1"
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<points-spent type="decimal">2000.0</points-spent>
<amount-spent type="decimal">10.0</amount-spent>
<points-available type="decimal">28511.0</points-available>
</hash>
Parameters:
q - 'spend'
customer_id - given customer id
amount - amount to spend, number of points consumed will automatically be computed via defined points-to-amount ratio in the membership definition
reference - reference number for this transaction, if the transaction is an invoice, use invoice transaction number. The uniqueness of this reference is not enforced.
Return Value
The Reward API will return points-spend, amount-spend and points-available if the transaction is successful; otherwise, it will return corresponding error message (e.g. in case of insufficient points).