NYYU Logo
APIPresale Payment

Place A New Presale Order

Create presale orders with customizable NDB token amounts and destination options

Place Presale Order

Create a new presale order with flexible destination options for NDB token delivery

Mutation

🛒
placePreSaleOrder
Create a new presale order for NDB tokens

Schema

placePreSaleOrder(
  presaleId: Int!
  ndbAmount: Float!
  destination: Int!
  extAddr: String
): PreSaleOrder

Parameters

presaleIdRequired
Type: Int!
The unique identifier of the presale round to place an order for
ndbAmountRequired
Type: Float!
The amount of NDB tokens to purchase in this order
destinationRequired
Type: Int!
Specifies where NDB tokens will be delivered after purchase
1Internal - Tokens sent to your NYYU wallet
2External - Tokens sent to an external wallet address
extAddrOptional
Type: String

External wallet address for NDB token delivery. Required when destination is 2

Return Value

📦
Returns PreSaleOrder Object

Contains the created presale order with initial status of 0 (pending payment confirmation)

Example

💻
Internal Delivery Example
Order 500 NDB tokens to internal wallet
mutation {
  placePreSaleOrder(
    presaleId: 1
    ndbAmount: 500.0
    destination: 1
  ) {
    id
    presaleId
    userId
    ndbAmount
    destination
    status
    createdAt
    updatedAt
  }
}
💻
External Delivery Example
Order 500 NDB tokens to external address
mutation {
  placePreSaleOrder(
    presaleId: 1
    ndbAmount: 500.0
    destination: 2
    extAddr: "0x1234567890abcdef1234567890abcdef12345678"
  ) {
    id
    presaleId
    userId
    ndbAmount
    destination
    extAddr
    status
    createdAt
    updatedAt
  }
}

Response Example

📤
Sample Response
Successful order creation
{
  "data": {
    "placePreSaleOrder": {
      "id": 12345,
      "presaleId": 1,
      "userId": "user_abc123",
      "ndbAmount": 500.0,
      "destination": 2,
      "extAddr": "0x1234567890abcdef1234567890abcdef12345678",
      "status": 0,
      "createdAt": 1634567890,
      "updatedAt": 1634567890
    }
  }
}

Order Workflow

🔄
Order Processing Steps
Complete order lifecycle
1
Create Order

Call placePreSaleOrder with presale ID, amount, and destination. Order is created with status 0 (pending)

2
Process Payment

Use one of the payment methods (Stripe, PayPal, Crypto, or Wallet) to pay for the order

3
Confirm Payment

Payment gateway confirms the transaction and updates order status

4
Token Delivery

NDB tokens are delivered to the specified destination (internal wallet or external address)

Important Notes

⚠️
Payment Required

The order is created with status 0 (pending). It must be confirmed through a payment method before token delivery.

🔐
External Address

When destination is 2 (external), you must provide a valid external wallet address in the extAddr field.

Internal Delivery

Choosing destination 1 (internal) delivers tokens to your NYYU wallet automatically upon payment confirmation.

📊
Order Tracking

Use the returned order ID to track payment status and token delivery through other API endpoints.

💡
Best Practice

Always validate the external address format on the frontend before submitting. For Ethereum addresses, ensure they are valid checksummed addresses. Store the order ID immediately after creation for payment processing and order tracking.