# Retail

**Request Headers**

| Name            | Desc                                               | Note      |
| --------------- | -------------------------------------------------- | --------- |
| X-CLIENT-ID     | Nilai dari Client ID                               | Mandatory |
| X-CLIENT-SECRET | Nilai dari Client Secret                           | Mandatory |
| X-SIGNATURE     | Hasil nilai signature yang telah dibuat sebelumnya | Mandatory |

**Request Body**

| Name                       | Desc                                                                         | Note      |
| -------------------------- | ---------------------------------------------------------------------------- | --------- |
| partner\_reference\_number | Nomor referensi dari merchant dan bersifat Unik.                             | Mandatory |
| retail\_code               | Kode retail sesuai pada table                                                | Mandatory |
| amount                     | Harus lebih besar dari 9999                                                  | Mandatory |
| expired                    | Format yyyyMMddHHiiss                                                        | Mandatory |
| remark                     | Catatan transaksi                                                            | Optional  |
| customer\_id               | ID pelanggan dari merchant                                                   | Mandatory |
| customer\_name             | Nama pelanggan dari merchant                                                 | Mandatory |
| customer\_email            | Email pelanggan dari merchant                                                | Mandatory |
| customer\_phone            | Nomor HP pelanggan dari merchant                                             | Mandatory |
| redirect\_url              | URL untuk mengembalikan ke halaman tertentu jika status transaksi berhasil   | Optional  |
| callback\_url              | URL Callback mengembalikan data transaksi ke merchant (khusus untuk sandbox) | Optional  |

Contoh Kode dalam PHP:

```
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-sandbox.ipaymax.com/transaction/create/retail',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "partner_reference_number": "TRX12341232144",
    "bank_code": "ALFAMART",
    "amount": 10000,
    "expired": "20241102230000",
    "remark": "Coba kak",
    "customer_id": "31857118",
    "customer_name": "Sahabat Ipaymax",
    "customer_phone": "08123456789",
    "customer_email": "pay@ipaymax.com",
    "redirect_url": ""
}',
  CURLOPT_HTTPHEADER => array(
    'X-CLIENT-ID: 3346754028',
    'X-CLIENT-SECRET: sandbox-ipaymax',
    'X-SIGNATURE: dc1aeb9a2c16f235d47bae5a155d89e183059958b649ee6b59067d4656fecc9f',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

```

**Contoh Response Berhasil**

```
{
    "responseCode": "00",
    "responseMessage": "OK",
    "responseData": {
        "reference_number": "REF987654",
        "partner_reference_number": "PARTNER456789",
        "bank_code": "ALFAMART",
        "bank_name": "ALFAMART",
        "amount": 100000,
        "expired_at": "2024-10-30 14:30:00",
        "status": "pending",
        "remark": "Payment for order",
        "redirect_url": "https://example.com/redirect",
        "customer_id": "12",
        "customer_name": "John Doe",
        "customer_phone": "+6281234567890",
        "customer_email": "johndoe@example.com",
        "checkout_url": "https://example.com/checkout",
        "payment_ref": "abcde1234",
        "instructions": [
            {
                "title": "Indomaret",
                "description": "Tata cara bayar"
	    }
        ]
    }
}
```

**Contoh Response Gagal**

```
{
    "responseCode": "99",
    "responseMessage": "An unexpected error occurred. Please try again later, or contact support if the issue persists."
}
```

List Kode Bank:

| Nama      | Kode      |
| --------- | --------- |
| ALFAMART  | ALFAMART  |
| INDOMARET | INDOMARET |

FAQ :

* Minimal transaksi IDR 10000
* Maksimum transaksi IDR 2.000.000.000
* Transaksi berhasil jika  responseCode berniali  "00"
* Transaksi gagal jika responseCode bernilai selain dari "00"
* Status Transaksi : pending/success/failed


---

# 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.ipaymax.com/create-transactions/retail.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.
