📙
Cray
  • Introduction
    • The Problem
    • How it works?
    • Want to Learn More?
  • APIs
    • Check Health
    • Create Payment order
    • Submit Order
    • Order Status
    • Fetch Approval
    • Supported Chains
    • Supported Token
  • AbstractPay SDK
  • ReactPay Hook
Powered by GitBook
On this page
  • Endpoint
  • Description
  • Request
  • Example Request
  • Example Response

Was this helpful?

  1. APIs

Create Payment order

Endpoint

POST {{base_url}}/create-order

Description

This API creates a new payment order based on the provided parameters. It supports P2P payments, merchant transactions, or dApp interactions.


Request

Headers

Header
Value
Description

apikey

test

API key for authentication.

Content-Type

application/json

Indicates JSON payload.

Body Parameters

Parameter
Type
Required
Description

senderAddress

String

Yes

The address of the sender (e.g., wallet address).

receiverAddress

String

Yes

The address of the receiver (e.g., wallet address).

destinationChain

Integer

Yes

The chain ID for the destination blockchain.

destinationToken

String

No

The token address on the destination chain. Leave empty for native token.

amount

String

Yes

The amount of tokens to transfer.

orderType

String

Yes

The type of the order (e.g., p2p).

minAmountOut

Float

No

The minimum acceptable amount out for the transaction.

action

String

No

Specific action to perform with the order (e.g., "swap").

sourceChain

Integer

No

The chain ID of the source blockchain.

sourceToken

String

No

The token address on the source chain.


Example Request

curl --location '<base_url>/create-order' \
--header 'apikey: <Your API Key>' \
--header 'Content-Type: application/json' \
--data '{
    "params": {
        "senderAddress": "0x7C2Fcd399492D4D43c34F9a41fa7939a2Ce698A8", 
        "receiverAddress": "0xf66f409086647591e0c2f122C1945554b8e0e74F", 
        "destinationChain": 421614,
        "destinationToken": "", 
        "amount": "0.1",
        "orderType": "p2p", 
        "minAmountOut": null, 
        "action": null, 
        "sourceChain": null, 
        "sourceToken": null 
    }
}'

Example Response

Success (200)

{
  "status": "success",
  "message": "Order created successfully",
  "data": {
    "orderId": "12345",
    "senderAddress": "0x7C2Fcd399492D4D43c34F9a41fa7939a2Ce698A8",
    "receiverAddress": "0xf66f409086647591e0c2f122C1945554b8e0e74F",
    "amount": "0.1",
    "destinationChain": 421614,
    "destinationToken": "",
    "orderType": "p2p",
    "timestamp": "2025-01-07T12:34:56Z"
  }
}

Error (400)

{
  "status": "error",
  "message": "Invalid parameters: senderAddress is required"
}

Error (401)

{
  "status": "error",
  "message": "Unauthorized: Invalid API key"
}
PreviousCheck HealthNextSubmit Order

Last updated 3 months ago

Was this helpful?