Cowdidocs
API ReferenceTransactions

Preview Transaction

Get transaction preview including fees before initiating. Use 'type' field to specify: SEND_MONEY, BUY_GOODS, or PAY_BILL

POST
/v1/transactions/preview

Request Body

application/json

Preview request for buy goods transaction

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/transactions/preview" \  -H "Content-Type: application/json" \  -d '{    "type": "BUY_GOODS",    "account_id": "550e8400-e29b-41d4-a716-446655440000",    "amount": {      "value": 50000,      "currency": "KES"    },    "till_number": "123456",    "recipient_name": "ABC Store"  }'
{  "type": "SEND_MONEY",  "amount": 30000,  "fee": 1100,  "total": 31100,  "channel": "MPESA",  "currency": "KES",  "can_proceed": true,  "validation": {    "account_valid": true,    "account_name": "John D****** O******",    "name_match": "PARTIAL_MATCH",    "validation_message": "The name 'John Doe' partially matches the account holder 'John D****** O******'. Please confirm this is the correct recipient.",    "requires_confirmation": true  }}
{  "code": "BAD_REQUEST",  "description": "Bad Request"}
{  "code": "UNAUTHORISED",  "description": "Unauthorised"}
{  "code": "WAITING_LIST",  "description": "User is in the waiting list"}
{  "code": "TOO_MANY_REQUESTS",  "description": "Too Many Requests"}
{  "code": "INTERNAL_SERVER_ERROR",  "description": "Internal Server Error"}