-
Notifications
You must be signed in to change notification settings - Fork 1
feat: add Intent API Docs #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
akbarsaputrait
wants to merge
3
commits into
RozoAI:main
Choose a base branch
from
akbarsaputrait:feat/intent-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| # Rozo Payment API | ||
|
|
||
| Backend-focused API documentation for creating, managing, and tracking payments through the Intent Pay system. | ||
|
|
||
| **Base URL:** `https://intentapi.rozo.ai` | ||
|
|
||
| ## Documentation Structure | ||
|
|
||
| - [API Endpoints](./endpoints.md) - REST API reference with cURL and fetch examples | ||
| - [Payment Bridging](./payment-bridging.md) - Cross-chain payment logic and receiving addresses | ||
| - [Data Types](./types.md) - Interface definitions and data structures | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ### cURL Example | ||
|
|
||
| ```bash | ||
| curl -X POST https://intentapi.rozo.ai/payment-api \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer YOUR_API_KEY" \ | ||
| -d '{ | ||
| "appId": "your-app-id", | ||
| "display": { | ||
| "intent": "Purchase item", | ||
| "paymentValue": "1", | ||
| "currency": "USD" | ||
| }, | ||
| "destination": { | ||
| "chainId": "8453", | ||
| "amountUnits": "1", | ||
| "tokenSymbol": "USDC" | ||
| } | ||
| }' | ||
| ``` | ||
|
|
||
| ### JavaScript Fetch | ||
|
|
||
| ```javascript | ||
| const response = await fetch("https://intentapi.rozo.ai/payment-api", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| Authorization: "Bearer YOUR_API_KEY", | ||
| }, | ||
| body: JSON.stringify({ | ||
| appId: "your-app-id", | ||
| display: { | ||
| intent: "Purchase item", | ||
| paymentValue: "1", | ||
| currency: "USD", | ||
| }, | ||
| destination: { | ||
| chainId: "8453", | ||
| amountUnits: "1", | ||
| tokenSymbol: "USDC", | ||
| }, | ||
| }), | ||
| }); | ||
|
|
||
| const payment = await response.json(); | ||
| ``` | ||
|
|
||
| ## Authentication | ||
|
|
||
| Include API credentials in request headers as configured in your application: | ||
|
|
||
| ```bash | ||
| Authorization: Bearer YOUR_API_KEY | ||
| ``` | ||
|
|
||
| ## Support | ||
|
|
||
| For questions about the Rozo Payment API, contact the development team or refer to the main documentation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| # API Endpoints | ||
|
|
||
| Base URL: `https://intentapi.rozo.ai` | ||
|
|
||
| ## Create Payment | ||
|
|
||
| `POST /payment-api` | ||
|
|
||
| Creates a new payment request. | ||
|
|
||
| **Request Body:** `PaymentRequestData` | ||
| **Response:** `PaymentResponseData` | ||
|
|
||
| ### cURL Example | ||
|
|
||
| ```bash | ||
| curl -X POST https://intentapi.rozo.ai/payment-api \ | ||
| -H "Content-Type: application/json" \ | ||
| -H "Authorization: Bearer YOUR_API_KEY" \ | ||
| -d '{ | ||
| "appId": "your-app-id", | ||
| "display": { | ||
| "intent": "Premium subscription", | ||
| "paymentValue": "29.99", | ||
| "currency": "USD" | ||
| }, | ||
| "destination": { | ||
| "chainId": "8453", | ||
| "amountUnits": "29.99", | ||
| "tokenSymbol": "USDC" | ||
| }, | ||
| "externalId": "sub_12345", | ||
| "metadata": { | ||
| "userId": "user_67890" | ||
| } | ||
| }' | ||
| ``` | ||
|
|
||
| ### JavaScript Fetch | ||
|
|
||
| ```javascript | ||
| const response = await fetch("https://intentapi.rozo.ai/payment-api", { | ||
| method: "POST", | ||
| headers: { | ||
| "Content-Type": "application/json", | ||
| Authorization: "Bearer YOUR_API_KEY", | ||
| }, | ||
| body: JSON.stringify({ | ||
| appId: "your-app-id", | ||
| display: { | ||
| intent: "Premium subscription", | ||
| paymentValue: "29.99", | ||
| currency: "USD", | ||
| }, | ||
| destination: { | ||
| chainId: "8453", | ||
| amountUnits: "29.99", | ||
| tokenSymbol: "USDC", | ||
| }, | ||
| }), | ||
| }); | ||
|
|
||
| const payment = await response.json(); | ||
|
|
||
| // Example response: | ||
| /* | ||
| { | ||
| "id": "2a41baa0-c2b8-4360-af5a-eda0fef3e914", | ||
| "status": "payment_unpaid", | ||
| "createdAt": "2025-09-21T15:29:29.857+00:00", | ||
| "display": { | ||
| "intent": "Pay", | ||
| "currency": "USDC" | ||
| }, | ||
| "source": null, | ||
| "destination": { | ||
| "destinationAddress": "GAA3PV4SN4AEFGYXTHLO7X4ETQEM6PERUJN2NGRGMKEHNJSYYTIFMM5S", | ||
| "txHash": null, | ||
| "chainId": "1500", | ||
| "amountUnits": "0.1", | ||
| "tokenSymbol": "USDC", | ||
| "tokenAddress": "USDC:GA5ZSEJYB37JRC5AVCIA5MOP4RHTM335X2KGX3IHOJAPP5RE34K4KZVN" | ||
| }, | ||
| "metadata": { | ||
| "receivingAddress": "0x13735745e512befb599ab1bf44021290cab148c9", | ||
| "payinchainid": "137", | ||
| "payintokenaddress": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359", | ||
| "webhookUrl": "https://example.com/webhook" | ||
| }, | ||
| "url": "http://checkout.example.com/pay?id=2a41baa0-c2b8-4360-af5a-eda0fef3e914" | ||
| } | ||
| */ | ||
| ``` | ||
|
|
||
| ## Get Payment by ID | ||
|
|
||
| `GET /payment-api/id/{paymentId}` | ||
|
|
||
| Retrieves payment by Rozo payment ID. | ||
|
|
||
| **Parameters:** | ||
|
|
||
| - `paymentId` (string): Payment ID | ||
|
|
||
| **Response:** `PaymentResponseData` | ||
|
|
||
| ### cURL Example | ||
|
|
||
| ```bash | ||
| curl -X GET https://intentapi.rozo.ai/payment-api/id/pay_abc123 \ | ||
| -H "Authorization: Bearer YOUR_API_KEY" | ||
| ``` | ||
|
|
||
| ### JavaScript Fetch | ||
|
|
||
| ```javascript | ||
| const response = await fetch( | ||
| "https://intentapi.rozo.ai/payment-api/id/pay_abc123", | ||
| { | ||
| headers: { | ||
| Authorization: "Bearer YOUR_API_KEY", | ||
| }, | ||
| } | ||
| ); | ||
|
|
||
| const payment = await response.json(); | ||
| ``` | ||
|
|
||
| ## HTTP Status Codes | ||
|
|
||
| | Code | Description | | ||
| | ---- | --------------------------------- | | ||
| | 200 | Success | | ||
| | 400 | Bad Request - Invalid data | | ||
| | 401 | Unauthorized - Invalid auth | | ||
| | 404 | Not Found - Payment doesn't exist | | ||
| | 429 | Too Many Requests - Rate limited | | ||
| | 500 | Internal Server Error | | ||
|
|
||
| ## Error Response Format | ||
|
|
||
| ```typescript | ||
| { | ||
| data: null, | ||
| error: Error, | ||
| status: 400 | ||
| } | ||
| ``` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Good practice to include example error responses would be helpful here. Consider adding an example after the error response format definition:
{ "data": null, "error": { "message": "Invalid payment amount", "code": "INVALID_AMOUNT" }, "status": 400 }