# Create Payment Session

Partner and Merchant will use their own API credentials as usual.&#x20;

## Credentials and Authentication

Using the authentication parameter below:

| username (Merchant API UID)        | 2aaa1633-e63f-4371-9b85-91d936aa56a1 |
| ---------------------------------- | ------------------------------------ |
| password (Merchant API Auth Token) | ZyUfF8EmyabcMWPcaocX                 |

To create a session. the merchant needs to use basic authentication

To send basic auth credentials with Curl, use the "-u login: password" command-line option. Curl automatically converts the login: password pair into a Base64-encoded string and adds the "Authorization: Basic \[token]" header to the request. In this Curl request with Basic Auth Credentials example, we send a request with basic authorization credentials&#x20;

`curl https://securepay.my/echo -u "login:password"`

## API Credentials

![](/files/-MKSwjrme80ReF3XzCbw)

## Partner UID

Every partner will be issued one or more partner UID (partner\_uid). SecurePay will identify partner accounts by using this identifier. &#x20;

## Request Parameters

Please use POST method. The only compulsory parameter is the transaction\_amount however merchants usually needs to supply **order number** in order to keep track record on their side. Your POST request will be returned in JSON format (later you can access payment\_url)

**Curl Request**

`curl -X POST https://sandbox.securepay.my/api/apis/payments -u 2aaa1633-e63f-4371-9b85-91d936aa56a1:ZyUfF8EmyabcMWPcaocX -d 'transaction_amount=200&order_number=231212&cancel_url=https://test.com'`

**Result**

{"payment\_url":"<https://sandbox.securepay.my/api/apis/GSHJD1664332374/payment\\_session","data":{"buyer\\_name":null,"buyer\\_email":null,"buyer\\_phone":null,"transaction\\_amount":"200.00","order\\_number":"231212","product\\_description":"Payment> for order no. 231212","slug":"GSHJD1664332374","callback\_url":null,"redirect\_url":null,"cancel\_url":"<https://test.com","timeout\\_url":null,"currency":"MYR","currency\\_amount":"200.00","partner\\_uid":null,"other\\_params":null,"created\\_at":"2022-09-28T10:32:54.087+08:00","updated\\_at":"2022-09-28T10:32:54.087+08:00"}>

The payment form can be accessed through payment\_url <https://sandbox.securepay.my/api/apis/GSHJD1664332374/payment\\_session>

**Payment Form (**<https://sandbox.securepay.my/api/apis/GSHJD1664332374/payment_session>**)**

<figure><img src="/files/6mhFg5O4mqjVFhvnI6EC" alt=""><figcaption><p>Generated page</p></figcaption></figure>

| Parameter            | Description                                                                                                                                                                                                                                                                                         | Condition  | Example                                                                                         |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------------------------------------- |
| order\_number        | Unique order number generated by merchant end for reference.                                                                                                                                                                                                                                        | Optional   | 20200425132755                                                                                  |
| buyer\_name          | Valid buyer full name in one line.                                                                                                                                                                                                                                                                  | Optional   | AHMAD AMSYAR MOHD ALI                                                                           |
| buyer\_email         | Valid buyer email address for status update                                                                                                                                                                                                                                                         | Optional   | <amsyar@gmail.com>                                                                              |
| buyer\_phone         | Valid buyer phone number e.g: +60123121989                                                                                                                                                                                                                                                          | Optional   | +60123121678                                                                                    |
| transaction\_amount  | Amount format: 100.20 , 1000.00, 7000.30                                                                                                                                                                                                                                                            | Compulsory | 1540.40                                                                                         |
| product\_description | <p>Meaningful Product Description e.g.</p><ul><li>Payment for order number 123</li><li>Payment for vintage table part #89782</li></ul>                                                                                                                                                              | Optional   | Payment for order no 20200425132755                                                             |
| callback\_url        | Server to server. Securepay platform will post the payment status.                                                                                                                                                                                                                                  | Optional   |                                                                                                 |
| redirect\_url        | Browser to browser, Securepay platform will post to the endpoint browser.                                                                                                                                                                                                                           | Optional   |                                                                                                 |
| partner\_uid         | Partner UID value                                                                                                                                                                                                                                                                                   | optional   | c52853e0-24d6 .....                                                                             |
| currency             | SecurePay platform will convert the transaction amount into Malaysian Ringgit (RM/MYR). You need to pass the original currency value e.g: transaction\_amount is 2 and currency is USD. So the conversion will be generated at the current rate e.g: 9.22 MYR. At this momment we only support USD. | optional   | USD                                                                                             |
| cancel\_url          | SecurePay page for bank selection. If set the cancel URL. Button cancel will appear.                                                                                                                                                                                                                | optional   | <p>e.g: </p><p><https://yourdom.com/securepay>\_<em>cancel?order\_</em>number=123123</p><p></p> |
| timeout\_url         | SecurePay page for bank selection. if set the timeout URL. The page will timeout within 3 minutes                                                                                                                                                                                                   | optional   | <p>e.g: </p><p><https://yourdom.com/securepay_timeout><em>?order\_</em>number=123123</p>        |

### Set buyer\_name,buyer\_email,buyer\_phone,callback\_url and redirect\_url

**Request**

`curl -X POST https://sandbox.securepay.my/api/apis/payments -u 2aaa1633-e63f-4371-9b85-91d936aa56a1:ZyUfF8EmyabcMWPcaocX -d 'transaction_amount=200&order_number=231213&cancel_url=https://test.com&buyer_name=Amir Haris&buyer_email=amir@test.com&buyer_phone=01239997978&callback_url=https://test.com/callback&redirect_url=https://test.com/redirect'`

**Result**

{"payment\_url":"<https://sandbox.securepay.my/api/apis/RLIXQ1664333462/payment\\_session","data":{"buyer\\_name":"Amir> Haris","buyer\_email":"<amir@test.com>","buyer\_phone":"01239997978","transaction\_amount":"200.00","order\_number":"231213","product\_description":"Payment for order no. 231213","slug":"RLIXQ1664333462","callback\_url":"<https://test.com/callback","redirect\\_url":"https://test.com/redirect","cancel\\_url":"https://test.com","timeout\\_url":null,"currency":"MYR","currency\\_amount":"200.00","partner\\_uid":null,"other\\_params":null,"created\\_at":"2022-09-28T10:51:02.267+08:00","updated\\_at":"2022-09-28T10:51:02.267+08:00"}>

**Generated Payment Form** (<https://sandbox.securepay.my/api/apis/RLIXQ1664333462/payment\\_session>)

<figure><img src="/files/6xIUUXoqgNSz7HG8q3OB" alt=""><figcaption></figcaption></figure>

### Set currency and product\_description

**Request**

`curl -X POST https://sandbox.securepay.my/api/apis/payments -u 2aaa1633-e63f-4371-9b85-91d936aa56a1:ZyUfF8EmyabcMWPcaocX -d 'transaction_amount=200&order_number=231214&cancel_url=https://test.com&buyer_name=Amir Haris&buyer_email=amir@test.com&buyer_phone=01239997978&callback_url=https://test.com/callback&redirect_url=https://test.com/redirect&currency=USD&product_description=Electronic Picture Frame with order number 231214'`

**Result**

{"payment\_url":"<https://sandbox.securepay.my/api/apis/MKJUP1664333854/payment\\_session","data":{"buyer\\_name":"Amir> Haris","buyer\_email":"<amir@test.com>","buyer\_phone":"01239997978","transaction\_amount":"922.15","order\_number":"231214","product\_description":"Electronic Picture Frame with order number 231214","slug":"MKJUP1664333854","callback\_url":"<https://test.com/callback","redirect\\_url":"https://test.com/redirect","cancel\\_url":"https://test.com","timeout\\_url":null,"currency":"USD","currency\\_amount":"200.00","partner\\_uid":null,"other\\_params":null,"created\\_at":"2022-09-28T10:57:34.874+08:00","updated\\_at":"2022-09-28T10:57:34.874+08:00"}>

**Generated Payment Form** `(`<https://sandbox.securepay.my/api/apis/MKJUP1664333854/payment\\_session>)

<figure><img src="/files/duFazmUJDjqvc3bXfczW" alt=""><figcaption></figcaption></figure>


---

# 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.securepay.my/api/payment-session-beta/payment.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.
