# General integration steps

*<mark style="color:orange;">These are the general integration steps; the integration methods differ only in the input fields.</mark>*

* **Source demo:**&#x20;
  * .Net: <https://github.com/galaxypayvn/sample-upc-dotnet>
  * Node JS: <https://github.com/galaxypayvn/sample-upc-nodejs>

* **Integration Keys:**

<table><thead><tr><th width="160.33333333333331">Name</th><th width="296">Value</th><th>Remark</th></tr></thead><tbody><tr><td><strong>Signature Salt</strong> (SHA256)</td><td>GALAXY PAY will provide</td><td>Use for Signature</td></tr><tr><td><strong>API Key</strong></td><td>GALAXY PAY will provide</td><td>Use for Authenticate</td></tr><tr><td><strong>Base URL</strong></td><td><a href="https://uat-secure.galaxypay.vn/api/v1/transaction/pay">https://uat-secure.galaxypay.vn</a></td><td>UAT Environment</td></tr><tr><td></td><td><a href="https://secure.galaxypay.vn">https://secure.galaxypay.vn</a></td><td>PRODUCTION Environment</td></tr></tbody></table>

&#x20;        **Note:**

&#x20;           API Key and Salt Signature will differ between **UAT** and **PRODUCTION** environment.

* **Message structure:**
  * Service:                        REST API
  * HTTP Method:            POST
  * Content Type:             application/json
  * The Request structure:

<table><thead><tr><th width="62">#</th><th width="123">Component</th><th width="140">Param</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td><strong>Header</strong></td><td><strong>APIKey</strong></td><td><p>Key for authentication request. </p><p>Provided by GALAXY PAY.</p></td></tr><tr><td></td><td></td><td><strong>Signature</strong></td><td>Request signature, created with <mark style="color:red;"><strong>SHA256 &#x26; Salt</strong></mark></td></tr><tr><td></td><td></td><td>Accept</td><td>Accept encoding: <mark style="color:red;"><strong>application/json</strong></mark></td></tr><tr><td></td><td></td><td>Content-Type</td><td>Request content type: <mark style="color:red;"><strong>application/json</strong></mark></td></tr><tr><td>2</td><td><strong>Body</strong></td><td></td><td>JSON content</td></tr></tbody></table>

## General integration steps

{% stepper %}
{% step %}

### Step 1: APIKey & Salt:

* APIKey: Use for Authentication
* Salt: Use for Signature

GALAXY PAY will provide. If you don’t have an API Key & Salt, use: <https://uat-demo.galaxypay.vn/documents#auth>

{% endstep %}

{% step %}

### Step 2: Signature Algorithm: <a href="#step-2-signature-algorithm" id="step-2-signature-algorithm"></a>

Apply hash algorithm **SHA256** with **Salt**.

**Signature = SHA256(**<mark style="background-color:orange;">**SignData**</mark>**&#x20;+ Salt)**

Sample Code

<pre><code>// JavaScript Example
var salt = "GO@2021";

// JSON Data (JSON Object)
<strong>var request =
</strong>{
    "requestID": "14653fa1-2f69-4f4f-9d4b-240e1bebbdf3",
    "requestDateTime": 20220426083322,
    "requestData": {
        "apiOperation": "PAY",
        "orderID": "2a43e4b9-c5df-49e6-8b18-42af9bcd150e",
        "orderNumber": 205249008064,
        "orderAmount": 100000,
        "orderCurrency": "VND",
        "orderDateTime": 20220426083322,
        "orderDescription": "DEMO TRANSACTION",
        "paymentMethod": "DOMESTIC",
        "sourceType": "970400",
        "language": "vi"
    }
};

// JSON String (JSON Serialized as string)
// {"requestID":"14653fa1-2f69-4f4f-9d4b-240e1bebbdf3","requestDateTime":20220426083322,"requestData":{"apiOperation":"PAY","orderID":"2a43e4b9-c5df-49e6-8b18-42af9bcd150e","orderNumber":205249008064,"orderAmount":100000,"orderCurrency":"VND","orderDateTime":20220426083322,"orderDescription":"DEMO TRANSACTION","paymentMethod":"DOMESTIC","sourceType":"970400","language":"vi"}}
var signData = JSON.stringify(request);

// require('crypto-js');
// signature = SHA256(signData + salt) 
// b4b7cb5596680bb343f399922fc32e63fd69191c573e83c0383fd734531eab03
var signature = crypto.SHA256(signData + salt).toString();

</code></pre>

You can test Signature in [API Playground](https://uat-demo.galaxypay.vn/documents#post-/api/v1/transaction/pay)
{% endstep %}

{% step %}

### Step 3: Send request message

View the request fields for each integration method [here](/upc/payment-gateway/api-specification/payment.md)
{% endstep %}

{% step %}

### Step 4: Receive response message

View the response fields for each integration method [here](/upc/payment-gateway/api-specification/payment.md)
{% endstep %}
{% endstepper %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.galaxypay.vn/upc/payment-gateway/payment-solution/general-integration-steps.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
