$_requestAdapter
$_requestAdapter : \CheddarGetter_Http_AdapterInterface
The adapter to access cookie data and such.
By default, it will use PHP superglobals directly but an implementation based on the abstraction of a framework can be used.
Client object for interacting with the CheddarGetter service
$_requestAdapter : \CheddarGetter_Http_AdapterInterface
The adapter to access cookie data and such.
By default, it will use PHP superglobals directly but an implementation based on the abstraction of a framework can be used.
$_httpClient : \CheddarGetter_Client_AdapterInterface
If you don't use Zend Framework, it's ok, the client will fallback to curl (so you need curl).
__construct(mixed $url, mixed $username, mixed $password, mixed $productCode, string $productId, \CheddarGetter_Client_AdapterInterface $adapter)
Constructor
mixed | $url | string |
mixed | $username | string |
mixed | $password | string |
mixed | $productCode | string |
string | $productId | |
\CheddarGetter_Client_AdapterInterface | $adapter |
setUrl(mixed $url) : \CheddarGetter_Client
Set URL neccessary for for accessing the CheddarGetter API
mixed | $url | string |
setUsername(mixed $username) : \CheddarGetter_Client
Set username neccessary for for accessing the CheddarGetter API
mixed | $username | string |
setPassword(mixed $password) : \CheddarGetter_Client
Set password neccessary for accessing the CheddarGetter API
mixed | $password | string |
setProductCode(mixed $productCode) : \CheddarGetter_Client
Set product code (required for all calls except getAllCustomers)
mixed | $productCode | string |
setProductId(mixed $productId) : \CheddarGetter_Client
Set product id (required for all calls except getAllCustomers unless productCode is used)
mixed | $productId | string |
setMarketingCookieName(mixed $name) : \CheddarGetter_Client
Set name for marketing metrics cookie
mixed | $name | string |
getPlans(array|null $filters) : \CheddarGetter_Response
Get pricing plans
Get all plans in the product.
array|null | $filters |
getPlan(string $code, string|null $id) : \CheddarGetter_Response
Get a single pricing plan
string | $code | Your code for the plan |
string|null | $id | CG id for the plan |
deletePlan(string $code, string|null $id) : \CheddarGetter_Response
Delete a plan
string | $code | Your code for the plan |
string|null | $id | CG id for the plan |
getCustomers(array|null $filters) : \CheddarGetter_Response
Get customers (DEPRECATED: use getCustomersList to query for multiple customers)
Get all customers in the product
array|null | $filters |
getCustomersList(array|null $filters) : \CheddarGetter_Response
Get customers
Get all customers in the product
array|null | $filters |
getCustomer(string $code, string|null $id) : \CheddarGetter_Response
Get a single customer
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
getAllCustomers(array|null $filters) : \CheddarGetter_Response
Get all customers
Get all customers subscribed to any product
array|null | $filters |
newCustomer(array $data) : \CheddarGetter_Response
Create new customer
array | $data |
importCustomers(array $data) : \CheddarGetter_Response
Import customers in bulk
array | $data | An array of arrays |
editCustomer(string $code, string|null $id, array $data) : \CheddarGetter_Response
Change customer and subscription information
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data |
editCustomerOnly(string $code, string|null $id, array $data) : \CheddarGetter_Response
Change customer information only
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data |
deleteCustomer(string $code, string|null $id) : \CheddarGetter_Response
Delete a customer
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
deleteCustomers() : \CheddarGetter_Response
Delete all customers
WARNING: This will delete all customers and all related data in CheddarGetter and will delete all customer data at the gateway if a gateway is configured.
editSubscription(string $code, string|null $id, array $data) : \CheddarGetter_Response
Change subscription information
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data |
cancelSubscription(string $code, string|null $id) : \CheddarGetter_Response
Cancel subscription
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
paypalRevert(string $code, string|null $id) : \CheddarGetter_Response
PayPal Revert (workaround)
This is an experimental workaround for some PayPal shortcomings. It should be unecessary in the near future.
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
addItemQuantity(string $code, string|null $id, array $data) : \CheddarGetter_Response
Increment a usage item quantity
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | Your (itemCode or CG itemId) and [quantity] |
removeItemQuantity(string $code, string|null $id, array $data) : \CheddarGetter_Response
Decrement a usage item quantity
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | Your (itemCode or CG itemId) and [quantity] |
setItemQuantity(string $code, string|null $id, array $data) : \CheddarGetter_Response
Set a usage item quantity
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | Your (itemCode or CG itemId) and quantity |
addCharge(string $code, string|null $id, array $data) : \CheddarGetter_Response
Add a custom charge (debit) or credit to the current invoice
A positive 'eachAmount' will result in a debit. If negative, a credit.
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | chargeCode, quantity, eachAmount[, description] |
deleteCharge(string $code, string|null $id, array $data) : \CheddarGetter_Response
Delete a custom charge (debit) or credit from the customer's current invoice
CG's chargeId is required (found in the customers/get response)
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | chargeId |
newOneTimeInvoice(string $code, string|null $id, array $data) : \CheddarGetter_Response
Create a new one-time invoice
One-time invoices take one or more charges in the same format as newCustomer(). One-time invoices are executed immediately using the customer's existing subscription payment method. One-time invoices do not directly effect the subscription pending invoice or billing period.
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | an array of arrays each with: chargeCode, quantity, eachAmount[, description] |
voidOrRefundInvoice(string $number, string|null $id) : \CheddarGetter_Response
Void or refund invoice
Voiding and refunding can be a bit tricky. Some billing solutions do not allow refunding while a transaction is "voidable". Transactions are usually voidable only for a short time (less than 24 hours). Some billing solutions do not allow voids. Check out the knowledge base article on the subject for more information: {@link http://support.cheddargetter.com/kb/operational-how-tos/credits-and-refunds-and-voids-oh-my}
string | $number | The unique number of the invoice to be voided/refunded generated by CheddarGetter. |
string|null | $id | CG id of the invoice |
voidInvoice(string $number, string|null $id) : \CheddarGetter_Response
Void invoice
Voiding and refunding can be a bit tricky. Some billing solutions do not allow refunding while a transaction is "voidable". Transactions are usually voidable only for a short time (less than 24 hours). Some billing solutions do not allow voids. Check out the knowledge base article on the subject for more information: {@link http://support.cheddargetter.com/kb/operational-how-tos/credits-and-refunds-and-voids-oh-my}
string | $number | The unique number of the invoice to be voided/refunded generated by CheddarGetter. |
string|null | $id | CG id of the invoice |
refundInvoice(string $number, string|null $id, array $amount) : \CheddarGetter_Response
Refund invoice
Voiding and refunding can be a bit tricky. Some billing solutions do not allow refunding while a transaction is "voidable". Transactions are usually voidable only for a short time (less than 24 hours). Some billing solutions do not allow voids. Check out the knowledge base article on the subject for more information: {@link http://support.cheddargetter.com/kb/operational-how-tos/credits-and-refunds-and-voids-oh-my}
string | $number | The unique number of the invoice to be voided/refunded generated by CheddarGetter. |
string|null | $id | CG id of the invoice |
array | $amount | The amount to be refunded if a partial refund. If the invoice is to be fully refunded, do not pass the amount. |
runOutstandingInvoice(string $code, string|null $id, array $data) : \CheddarGetter_Response
Run an outstanding invoice
An outstanding invoice might be one that hasn't been transacted yet or one that has been attempted unsucessfully.
string | $code | Your code for the customer |
string|null | $id | CG id for the customer |
array | $data | [ccCardCode] (optional) |
sendEmailReceipt(string $number, string|null $id) : \CheddarGetter_Response
Send an invoice receipt email
Resend an invoice receipt email. For any transacted invoice. Relevant email notification must be enabled in CG config.
string | $number | The unique number of the invoice. |
string|null | $id | CG id of the invoice |
getPromotions(array|null $filters) : \CheddarGetter_Response
Get promotions
Get all promotions in the product.
array|null | $filters |
getPromotion(string $code, string|null $id) : \CheddarGetter_Response
Get a single promotion
string | $code | Coupon code |
string|null | $id | CG id for the promotion |
setHttpClient(\CheddarGetter_Client_AdapterInterface|\Zend_Http_Client|resource $client) : \CheddarGetter_Client
Set http client
\CheddarGetter_Client_AdapterInterface|\Zend_Http_Client|resource | $client | Either a Zend_Http_Client or curl resource. |
getHttpClient() : \CheddarGetter_Client_AdapterInterface
Get the current http client
setRequestAdapter(\CheddarGetter_Http_AdapterInterface $requestAdapter)
Set request adapter
\CheddarGetter_Http_AdapterInterface | $requestAdapter |
getRequestAdapter() : \CheddarGetter_Http_AdapterInterface
Gets the request adapter.
setMarketingCookie(string $cookieName, int $expire, string $path, string $domain, bool $secure, bool $httpOnly)
Convenience wrapper of setcookie() for setting a persistent cookie containing marketing metrics compatible with CheddarGetter's marketing metrics tracking.
Running this method on every request to your marketing site sets or refines the marketing cookie data over time. There is no performance disadvantage to running this method on every request.
If a lead has this cookie set at the time of signup, CheddarGetter_Client::newCustomer() will automatically add the data to the customer record. In other words, simply run this method on every request and there's nothing else to do to take advantage of the metrics tracking in CheddarGetter.
{@link http://support.cheddargetter.com/faqs/marketing-metrics/marketing-metrics More about CheddarGetter's marketing metrics tracking }
string | $cookieName | |
int | $expire | |
string | $path | |
string | $domain | |
bool | $secure | |
bool | $httpOnly |
if headers are already sent