The NotificationAPIFunctions.php library contains a set of functions that are used to handle asynchronous responses that Google Checkout sends to inform you of new orders or to send you updates about the financial-order-state or the fulfillment-order-state for your orders. For example, a new-order-notification tells you about a new order that was submitted through Google Checkout.
You need to modify the shell functions in the NotificationAPIFunctions.php library so that they call your internal order processing systems. The functions should transfer the information in a notification to your order processing systems so that your systems can react to the notification in the appropriate manner.
The functions in this library would be called by the ProcessXmlData function in the ResponseHandlerAPIFunctions.php library.
These functions all have one required parameter ($xml_data_obj). This parameter contains the XML DOM representation of the notification sent by Google Checkout.
Please refer to the ResponseHandler.php implementation to see a sample page that handles Google Checkout Notification API responses.
Note: The ResponseHandler.php implementation can also handle asynchronous Google Checkout responses, which are handled in the ResponseHandlerAPIFunctions.php library, or Merchant Calculations API requests, which are handled by the MerchantCalculationsAPIFunctions.php library.
Definition:
The ProcessNewOrderNotification function is a shell function for handling a <new-order-notification>. You will need to modify this function to transfer the information contained in a <new-order-notification> to your internal systems that handle that data.
Parameters:
| Parameter Name | Definition |
|---|---|
| $dom_response_obj | Required. This parameter contains a DOM object representation of an XML document. |
Functions that call ProcessNewOrderNotification:
Code:
/*
* +++ CHANGE ME +++
* New order notifications inform you of new orders that have
* been submitted through Google Checkout. A <new-order-notification>
* message contains a list of the items in an order, the tax
* assessed on the order, the shipping method selected for the
* order and the shipping address for the order.
*
* If you are implementing the Notification API, you need to
* modify this function to relay the information in the
* <new-order-notification> to your internal systems that
* process this order data.
*/
SendNotificationAcknowledgment();
}
Definition:
The ProcessOrderStateChangeNotification function is a shell function for handling a <order-state-change-notification>. You will need to modify this function to transfer the information contained in a <order-state-change-notification> to your internal systems that handle that data.
Parameters:
| Parameter Name | Definition |
|---|---|
| $dom_response_obj | Required. This parameter contains a DOM object representation of an XML document. |
Functions that call ProcessOrderStateChangeNotification:
Code:
/*
* +++ CHANGE ME +++
* Order state change notifications signal an update to an order's
* financial status or its fulfillment status. An
* <order-state-change-notification> identifies the new financial
* and fulfillment statuses for an order. It also identifies the
* previous statuses for the order. Google Checkout will send an
* <order-state-change-notification> to confirm status changes that
* you trigger by using the Order Processing API requests. For
* example, if you send Google Checkout a <cancel-order> request,
* Google Checkout will respond through the Notification API to inform
* you that the order's status has been changed to "canceled".
*
* If you are implementing the Notification API, you need to
* modify this function to relay the information in the
* <order-state-change-notification> to your internal systems that
* process financial or fulfillment status information.
*/
SendNotificationAcknowledgment();
}
Definition:
The ProcessChargeAmountNotification function is a shell function for handling a <charge-amount-notification>. You will need to modify this function to transfer the information contained in a <charge-amount-notification> to your internal systems that handle that data.
Parameters:
| Parameter Name | Definition |
|---|---|
| $dom_response_obj | Required. This parameter contains a DOM object representation of an XML document. |
Functions that call ProcessChargeAmountNotification:
Code:
/*
* +++ CHANGE ME +++
* Charge amount notifications inform you that a customer has been
* charged for either the full amount or a partial amount of an
* order. A <charge-amount-notification> contains the order number
* that Google assigned to the order, the value of the most recent
* charge to the customer and the total amount that has been
* charged to the customer for the order. Google Checkout will send a
* <charge-amount-notification> after charging the customer.
*
* If you are implementing the Notification API, you need to
* modify this function to relay the information in the
* <charge-amount-notification> to your internal systems that
* process this order data.
*/
SendNotificationAcknowledgment();
}
Definition:
The ProcessChargebackAmountNotification function is a shell function for handling a <chargeback-amount-notification>. You will need to modify this function to transfer the information contained in a <chargeback-amount-notification> to your internal systems that handle that data.
Parameters:
| Parameter Name | Definition |
|---|---|
| $dom_response_obj | Required. This parameter contains a DOM object representation of an XML document. |
Functions that call ProcessChargebackAmountNotification:
Code:
/*
* +++ CHANGE ME +++
* Chargeback amount notifications inform you that a customer
* has initiated a chargeback against an order and that Google Checkout
* has approved the chargeback. A <chargeback-amount-notification>
* contains the order number that Google assigned to the order,
* the value of the most recent chargeback against the order
* and the total amount that has been charged back against the
* order. Google Checkout will send a <chargeback-amount-notification>
* after approving the chargeback.
*
* If you are implementing the Notification API, you need to
* modify this function to relay the information in the
* <chargeback-amount-notification> to your internal systems that
* process this order data.
*/
SendNotificationAcknowledgment();
}
Definition:
The ProcessRefundAmountNotification function is a shell function for handling a <refund-amount-notification>. You will need to modify this function to transfer the information contained in a <refund-amount-notification> to your internal systems that handle that data.
Parameters:
| Parameter Name | Definition |
|---|---|
| $dom_response_obj | Required. This parameter contains a DOM object representation of an XML document. |
Functions that call ProcessRefundAmountNotification:
Code:
/*
* +++ CHANGE ME +++
* Refund amount notifications inform you that a customer has been
* refunded either the full amount or a partial amount of an order
* total. A <refund-amount-notification> contains the order number
* that Google assigned to the order, the value of the most recent
* refund to the customer and the total amount that has been
* refunded to the customer for the order. Google Checkout will send a
* <refund-amount-notification> after refunding the customer.
*
* If you are implementing the Notification API, you need to
* modify this function to relay the information in the
* <refund-amount-notification> to your internal systems that
* process this order data.
*/
SendNotificationAcknowledgment();
}
Definition:
The ProcessRiskInformationNotification function is a shell function for handling a <risk-information-notification>. You will need to modify this function to transfer the information contained in a <risk-information-notification> to your internal systems that handle that data.
Parameters:
| Parameter Name | Definition |
|---|---|
| $dom_response_obj | Required. This parameter contains a DOM object representation of an XML document. |
Functions that call ProcessRiskInformationNotification:
Code:
/*
* +++ CHANGE ME +++
* Risk information notifications provide financial information about
* a transaction to help you ensure that an order is not fraudulent.
* A <risk-information-notification> includes the customer's billing
* address, a partial credit card number and other values to help you
* verify that an order is not fraudulent. Google Checkout will send you a
* <risk-information-notification> message after completing its
* risk analysis on a new order.
*
* If you are implementing the Notification API, you need to
* modify this function to relay the information in the
* <risk-information-notification> to your internal systems that
* process this order data.
*/
SendNotificationAcknowledgment();
}
Definition:
The SendNotificationAcknowledgment function responds to a Google Checkout notification with a <notification-acknowledgment> message. As long as your server responds to a notification message with a 200 HTTP response code, Google Checkout will assume the notification has been sent successfully. However, we recommend that you send a <notification-acknowledgment> as a means of confirming that you handled the notification successfully.
Functions that call SendNotificationAcknowledgment:
Code:
$acknowledgment = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" .
"<notification-acknowledgment xmlns=\"" .
$GLOBALS["schema_url"] . "\"/>";
echo $acknowledgment;
// Log <notification-acknowledgment>
LogMessage($GLOBALS["logfile"], $acknowledgment);
}
