Process a Sale {#concept}
=========================

This section describes how to send a sale request to process a payment.  
A sale request authorizes and captures a payment in the same request. A successful sale response includes an Touch 'n Go redirect URL and a `PENDING` status. Redirect the customer to the Touch 'n Go URL to allow the customer to complete the checkout using their Touch 'n Go account. When the customer completes the checkout, the customer is redirected to your website.  
When you receive a successful response, save the sale request ID in the requestID response field to perform a follow-on check status request or refund request.

Calculating the Grand Total
---------------------------

Include the grand total in the request by using the purchaseTotals_grandTotalAmount field.  
For information about how to calculate the grand total, see [Calculating the Grand Total for Line Items](/docs/cybs/en-us/thunes/developer/all/so/thunes/thunes-ref-info/thunes-intro-total.md "").

Endpoints
---------

Set the apSaleService_run field to `true`, and send the request to one of these endpoints:  
**Production:** `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor`{#concept_d8e301}  
**Test:** `https://ics2wstest.ic3.com/commerce/1.x/transactionProcessor`{#concept_d8e308}

Testing Information
-------------------

Touch 'n Go does not support a test endpoint. Send all test transactions to the production endpoint.

Processing a Sale {#paypal-session-task}
========================================

Follow these steps to successfully process sale.

1. Send a `POST` request to the `https://ics2ws.ic3.com/commerce/1.x/transactionProcessor` endpoint and include these required fields:

   [apPaymentType](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-payment-type.md "")
   :
   Set to `TND`.

   [apSaleService_cancelURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-cancel-url.md "")
   :
   Set to the URL to which the customer is redirected after the payment is cancelled.
   :
   Add `?action=cancel` to the end of the URL to help identify the response.

   [apSaleService_failureURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-failure-url.md "")
   :
   Set to the URL to which the customer is redirected after the payment fails to complete.
   :
   Add `?action=failure` to the end of the URL to help identify the response.

   [apSaleService_successURL](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-success-url.md "")
   :
   Set to the URL to which the customer is redirected after successfully completing the payment.
   :
   Add `?action=success` to the end of the URL to help identify the response.

   [apSaleService](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/ap-sale-service-run.md "")
   :
   Set to `true`.

   [billTo_country](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-country.md "")
   :
   Set to `MY`.

   [billTo_email](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-email.md "")
   :

   [billTo_firstName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-first-name.md "")
   :

   [billTo_lastName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-last-name.md "")
   :

   [merchantID](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-id.md "")
   :

   [merchantReferenceCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-reference-code.md "")
   :

   [purchaseTotals_currency](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-currency.md "")
   :
   Set to `MYR`.
   {#paypal-session-task_crncy}
   {#paypal-session-task_crncy}

   [purchaseTotals_grandTotalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/purchase-totals-grand-total-amount.md "")
   :

   {#paypal-session-task_step-1-cmd}

2. You can include these optional fields in the request:

   [billTo_city](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-city.md "")
   :

   [billTo_phoneNumber](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-phone-number.md "")
   :

   [billTo_postalCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-postal-code.md "")
   :

   [billTo_state](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-state.md "")
   :

   [billTo_street1](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/bill-to-street1.md "")
   :

   [invoiceHeader_merchantDescriptor](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/invoice-header-merchant-descriptor-a.md "")
   :

   [item_#_productCode](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-code.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_productDescription](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-description.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_productName](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-name.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_productSKU](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-product-sku.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_quantity](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-quantity.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_taxAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-tax-amount.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_totalAmount](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-total-amount.md "")
   :
   If this field is present, the purchaseTotals_currency field is optional.
   :
   Replace the `#` character with a sequential number starting from `0`.

   [item_#_unitPrice](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/item-no-unit-price.md "")
   :
   Replace the `#` character with a sequential number starting from `0`.

   [merchantDefinedData_mddField_#](https://developer.cybersource.com/docs/cybs/en-us/api-fields/reference/all/so/api-fields/merchant-defined-data-mdd-field-1-100.md "")
   :
   {#paypal-session-task_step-2-cmd}

3. Redirect the customer to the returned URL in the merchantURL response field.

   ```
   &lt;merchantURL&gt;&lt;/merchantURL&gt;
   ```

   {#paypal-session-task_step-3-cmd}

4. When the customer completes the checkout using their Touch 'n Go credentials, the customer is redirected to the merchant website based on the URL that you included in the apSaleService_successURL request field.{#paypal-session-task_step-4-cmd}
   {#paypal-session-task_step-4}

5. Save the request ID in the requestID field from the sale response. Include the request ID in a check status request to confirm that the payment is complete.

   ```
   &lt;requestID&gt;&lt;/requestID&gt;
   ```

{#paypal-session-task_step-5-cmd}

Example: Processing a Sale {#x-ex-rest}
=======================================

Request

```
&lt;requestMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.211"&gt;
  &lt;merchantID&gt;altpay_mid2&lt;/merchantID&gt;
  &lt;merchantReferenceCode&gt;Sale&lt;/merchantReferenceCode&gt;
  &lt;billTo&gt;
    &lt;firstName&gt;Test&lt;/firstName&gt;
    &lt;lastName&gt;Testerson&lt;/lastName&gt;
    &lt;country&gt;MY&lt;/country&gt;
    &lt;email&gt;test@email.com&lt;/email&gt;
  &lt;/billTo&gt;
  &lt;purchaseTotals&gt;
    &lt;currency&gt;MYR&lt;/currency&gt;
    &lt;grandTotalAmount&gt;1.00&lt;/grandTotalAmount&gt;
  &lt;/purchaseTotals&gt;
  &lt;apPaymentType&gt;TND&lt;/apPaymentType&gt;
  &lt;apSaleService run="true"&gt;
    &lt;cancelURL&gt;https://www.testcancel.com?action=cancel&lt;/cancelURL&gt;
    &lt;successURL&gt;https://www.testsuccess.com?action=success&lt;/successURL&gt;
    &lt;failureURL&gt;https://www.testfailure.com?action=failure&lt;/failureURL&gt;
  &lt;/apSaleService&gt;
&lt;/requestMessage&gt;
```

Response to a Successful Request

```
&lt;replyMessage xmlns="urn:schemas-cybersource-com:transaction-data-1.211"&gt;
  &lt;merchantReferenceCode&gt;Sale&lt;/merchantReferenceCode&gt;
  &lt;requestID&gt;7533018272376391304066&lt;/requestID&gt;
  &lt;decision&gt;ACCEPT&lt;/decision&gt;
  &lt;reasonCode&gt;100&lt;/reasonCode&gt;
  &lt;requestToken&gt;AxjnrwSTmF2hDxXBlYOCANgZYiy606GxmSmcyOn+bmZ6xrlB8iipDJpJl6MYhzEaTmF2hDxXBlYOCAAAHAMM&lt;/requestToken&gt;
  &lt;purchaseTotals&gt;
    &lt;currency&gt;MYR&lt;/currency&gt;
  &lt;/purchaseTotals&gt;
  &lt;apSaleReply&gt;
    &lt;reasonCode&gt;100&lt;/reasonCode&gt;
    &lt;paymentStatus&gt;pending&lt;/paymentStatus&gt;
    &lt;responseCode&gt;00001&lt;/responseCode&gt;
    &lt;merchantURL&gt;https://payment.limonetik.com/Razer/Order/PayPage/641145429770&lt;/merchantURL&gt;
    &lt;processorTransactionID&gt;641145429770&lt;/processorTransactionID&gt;
    &lt;reconciliationID&gt;XEKVNC1LJ3LG&lt;/reconciliationID&gt;
    &lt;amount&gt;1.00&lt;/amount&gt;
    &lt;processorResponse&gt;00001&lt;/processorResponse&gt;
    &lt;dateTime&gt;2025-07-23T20:17:08Z&lt;/dateTime&gt;
  &lt;/apSaleReply&gt;
&lt;/replyMessage&gt;
```

Response Statuses for Processing a Sale {#x-req-fields}
=======================================================

`Cybersource` responds to your sale request with one of these statuses in the field:

* `FAILED`: The sale cannot be completed.
* `PENDING`: The sale request is accepted but is not completed. Send a check status request as often as necessary to obtain the information that you need. For more information, see [Check a Status](/docs/cybs/en-us/thunes/developer/all/so/thunes/thunes-touchngo-intro/thunes-touchngo-status-intro.md "").
  {#x-req-fields_ul_pdp_lkr_3yb}

