0% found this document useful (0 votes)
31 views3 pages

REST API Payment Documentation

Uploaded by

Nguyen Nhat Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

REST API Payment Documentation

Uploaded by

Nguyen Nhat Anh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

📚 System Design VN: https://fb.com/groups/systemdesign.

vn
🧑‍💻 Ronin Engineer: https://ronin-engineer.github.io/introduction

REST API Document


API Make payment

1. API Specs

Name Make payment

Description Create a transaction between 2 normal accounts

URL https://{{ronin_engineer}}/payment-service/v1/payments

Method POST

Header ● Content-Type: application/json


● Idempotency-Key: string (example: oc8tKg1P2FV44hpj)

Params ● page: int (default = 0)


● size: int (default = 10)

Request Body {
"debit_account": "acc01",
"credit_account": "acc02",
"amount": 1000
}

Response Status Code: 200


{
"meta": {
"code": "200000",
"type": "SUCESS",
"message": "Sucess",
"service_id": "payment-service",
"extra_meta": {}
},
"data": {
"transaction_id": "FT2308163234",
"debit_account": "acc01",
"credit_account": "acc02",
"amount": 1000
}
}

Status Code: 401


{
"meta": {
"code": "400001",
"type": "INSUFFICIENT_DEBIT_AMOUNT",
"message": "Debit account has insufficient amount of
balance",
"service_id": "payment-service",
"extra_meta": {}
},
"data": null
}

Sample curl --location --request GET


'https://roninengineer.dev/products/jobs/export?name=pin' \
--header 'Content-Type: application/json' \
--data '{
"job_id": "j001",
"status": "PROCESSING",
"issued_at": 1692163008000
}'

2. Request Body
Parameter Type Required Default Description

debit_account String x Tài khoản trừ tiền.


Business logic.
Format.
Sample

credit_account String x Tài khoản cộng tiền

amount Int x 0 Số tiền


3. Response Body
Parameter Type Required Default Description

transaction_id String x Mã giao dịch

debit_account String x Tài khoản ghi nợ

credit_account String x Tài khoản ghi có

amount Int x 0 Số tiền

4. Errors
Status Code Code Type Description

200 200000 SUCCESS Thành công

400 400001 INSUFFICIENT_DEBIT_A Tài khoản ghi nợ không đủ tiền


MOUNT

401000 INSUFFICIENT_CREDIT_ Tài khoản ghi có bị khoá


AMOUNT

📚 System Design VN: https://fb.com/groups/systemdesign.vn


🧑‍💻 Ronin Engineer: https://ronin-engineer.github.io/introduction

You might also like