# Get Payment Link

**Method:** `GET`\
**Endpoint:** `https://malum.co/api/v3/reseller/payment_link`\
**Response format:** JSON

***

### Required query parameters

<table><thead><tr><th>Parameter</th><th>Type</th><th width="201">Example</th><th>Notes</th></tr></thead><tbody><tr><td><code>transaction_code</code></td><td>string (UUID v4)</td><td><code>193a3981-XXXX-XXXX-XXXX-241a26f3b74e</code></td><td>Must be a valid UUID v4 of a previously created order</td></tr><tr><td><code>payment_method</code></td><td>string</td><td><code>WERTEUR,WERT,...</code>   </td><td>Payment gateway identifier, case-insensitive, spaces removed</td></tr></tbody></table>

***

### How it works

1. The API validates the `transaction_code` format (must be UUID v4).
2. The system normalizes `payment_method`:
   * Spaces removed
   * Converted to lowercase
3. The backend checks if a matching gateway integration file exists.
4. The transaction is loaded using `transaction_code`.
5. The transaction must exist and still be in `pending` status.
6. The selected gateway module generates a redirect URL.
7. The API responds with a URL where the customer should be redirected.

***

### Example request

```http
GET https://malum.co/api/v3/reseller/payment_link?transaction_code=193a3981-XXXX-XXXX-XXXX-241a26f3b74e&payment_method=WERTEUR
```

***

### Success response

```json
{
  "status": "success",
  "message": "Gateway http redirect",
  "data": {
    "redirect_url": "https://demo.tld/"
  },
  "timestamp": 1770161149
}
```

**Field notes**

* `redirect_url` is where you should send the customer to complete the payment.
* The URL may point to an intermediary redirect or directly to a third-party gateway page.
* `timestamp` is a server-side Unix timestamp of the response.
* Malum is hidden and not shown.

***

### Error responses

Errors return JSON with:

* `status`: `failed`
* `message`: description of the problem
* `data`: may be empty or include debug information

Common messages include:

* `Invalid Request. Missing transaction code.`
* `Invalid transaction code format.`
* `An error with the payment method occurred, please try again later.`
* `Transaction not found.`
* `Transaction is not pending anymore.`
* `An error occurred, please try again later.`

***

### Integration flow summary

1. Create an order using the **checkout** endpoint and store the `transaction_code`.
2. Retrieve available methods via **payment\_options**.
3. Call **payment\_link** with the chosen `payment_method`.
4. Redirect your customer to the returned `redirect_url`.
