---
# System prepended metadata

title: Toman Partner Views (draft)

---

# Toman Partner Views (draft)

## Payment Model
```json
{
    "uuid": "dc5f4898-2d82-4263-b2da-47171304cb96",
    "redirect_to_psp": "https://enigma.tomainpay.net/qerqw1231werq2341werqfxzcasdfqwe"
    "amount_rials": 12000,
    "mobile_number": "09123456789"|null,
    "check_national_id": true,
    "tracker_id": "CustomPaymentIdForMyBusiness12345",
    "callback_path": "/payment/result/",
    "hashed_card_numbers": [
        "6980fa3166e6cabf885dd90d31648859dd38a2d99a854ef3a762e931813c0169",
        "6980fa3166e6cabf8f1aa343b1648859dd38a2d99a854ef3a762e931813c0169",
    ],
    "created_at": "2021-01-01T12:12:12+0330",
    "verified_at": null,
    "valid_until": "2021-01-01T12:12:12+0330",
    "status": "created",
    "psp": "sep",
    "terminal_number": "uweo230981234"
    "rrn": "wtrw;ertwertwert",
    "reference_number": 8324123412341234
}
```


## Errors format
```json
{
    "code": "constant_error_id",
    "description": "Some non-constant information about the error for the developer (not the user)"
}
```
### Example:
```json
{
    "code": "user_not_found",
    "description": "A user with the given email could not be found"
}
```


## Get token (create payment)

Method: POST
Path: `payments`
Body:
```json
{
    "amount": 12000,
    "phone_number": "09123456789"|null,
    "check_national_id": true,
    "tracker_id": "CustomPaymentIdForMyBusiness12345",
    "memo": "SomeDataForMyBusiness12345",
    "callback_path": "/payment/result/"|null,
    "card_number": "6037123456789012" // Do we need this?
}
```

Response:
Payment Object

Error codes:

- no_psp_available

## Send to PSP

Method: GET
Path: `payments/dc5f4898-2d82-4263-b2da-47171304cb96/redirect`


Response:
HTML Page containing a dynamic redirect to PSP payment page.


## Partner callback

Method: POST
Path: `https://partner.com/verify`
Body:
```json
{
    "uuid": "dc5f4898-2d82-4263-b2da-47171304cb96",
    "psp_switch_url": "https://enigma.tomainpay.net/qerqw1231werq2341werqfxzcasdfqwe"
    "amount": 12000,
    "phone_number": "09123456789",
    "check_national_id": true,
    "tracker_id": "CustomPaymentIdForMyBusiness12345",
    "memo": "SomeDataForMyBusiness12345",
    "callback_path": "/payment/result/",
    "card_number": "6037123456789012",
    "created_at": "2021-01-01T12:12:12+0330",
    "status": "callback"
}
```
Response: Empty

## Verify

Method: POST
Path: `payments/dc5f4898-2d82-4263-b2da-47171304cb96/verify`
Body: Empty
Response: 
```json

```
