Create and Monitor Payment Requests
The Payment Flow
Understanding the complete payment flow helps you integrate Fluxis effectively into your application:
Code
Flow Breakdown
- Your app creates a payment request via Fluxis API for a specific amount
- Fluxis returns payment request details including a NASPIP token
- Customer sees payment request as a QR code or payment link
- Customer pays using their crypto wallet
- Fluxis detects payment on the blockchain and notifies you
- Transaction confirms and you fulfill the order
Creating a Payment Request
To create a payment request, you'll need:
📋 Required Information
Point of Sale ID - The UUID of your Point of Sale
Amount - Payment amount as a decimal string (e.g., "49.99")
Unique Asset ID (UAI) - More information about UAI here.
Reference ID - Optional: Your internal order or transaction ID
You can create your first payment request in our API Playground - Payment Request.
Alternatively, use hosted checkout (POST /v1/pos/{posID}/payment-request-checkout) to receive a checkout_url you can redirect customers to without building your own NASPIP UI.
The NASPIP Token
The NASPIP token is a cryptographically signed string that contains all the payment instructions:
Code
This token can be:
- Encoded as a QR code for mobile wallet scanning
- Shared as a payment link for web/desktop wallets
- Shared by NFC enabled wallets to perform proximity or offline payment
Display Options
Most merchants display the NASPIP token as a QR code for easy mobile scanning.
Encode the token field from the create-payment-request response as a QR image in your app.
URL-based NASPIP tokens
Some tokens embed a url instead of inline payment instructions. Use POST /v1/naspip/read with the token — when the payload contains a URL without payment_options, Fluxis resolves payment instructions by fetching that URL server-side before returning the decoded data.
Payment Request States
Payment requests progress through different states during their lifecycle:
State Transition Diagram
Code
State Descriptions
| State | Meaning | What to Do |
|---|---|---|
created | Awaiting payment (active for ~8 minutes) | Display to customer, monitor for changes |
processing | Payment detected, awaiting blockchain confirmation | Continue monitoring, inform customer |
completed | Payment received and confirmed | Fulfill order, close payment request |
expired | Timeout reached without payment | Offer to create new payment request |
underpaid | Received less than expected amount | Contact support for resolution |
overpaid | Received more than expected amount | Contact support for resolution |
failed | Unexpected error during processing | Contact support, may need to create new request |
Edge Cases
The underpaid, overpaid, and failed states are edge cases that require coordination with Fluxis support for proper handling based on your business requirements.
More about that here: Payment Flows - Edge Cases.
Monitoring Payment Status
After creating a payment request, you need to monitor its status to know when payment is received. There are two approaches:
Option 1: Polling
Periodically check the payment request status by calling the status endpoint.
Endpoint: GET /v1/pos/{posID}/payment-request/{paymentRequestID}
Try it in our API Playground - Get Payment Request.
Polling Strategy
Recommended polling interval:
- First 2 minutes: Poll every 2-3 seconds
- After 2 minutes: Poll every 5 seconds
After expiration: Stop polling or poll every 30 seconds for grace period
Pros:
- Simple to implement
- Works with any infrastructure
- No additional setup required
Cons:
- Not real-time
- Creates API overhead
- May miss rapid state changes
Option 2: Webhooks
Configure account-level webhooks to receive notifications when payment status changes. This is the recommended approach for production systems.
Endpoint: POST /v1/account/{accountID}/webhook
Try it in the API Playground — Create webhook.
Webhook Setup
Register a full HTTPS URL and set event_type to payment_request:
Code
Fluxis generates the signing secret and returns it once in the create response. Webhooks fire for processing, completed, underpaid, and overpaid — not for expired or failed.
See Webhooks guide and Webhook Signature Verification. After registration, validate your handler with POST /v1/account/{accountID}/webhook/{webhookID}/test.
Pros:
- Real-time notifications
- No polling overhead
- Efficient and scalable
- Event-driven architecture
Cons:
- Requires public endpoint
- Need to implement webhook handler
- Should verify webhook signatures
::::tip Best Practice Use webhooks for production and polling as a fallback. Implement both methods to ensure you never miss a payment confirmation. ::::
Handling Different Scenarios
Scenario 1: Successful Payment
- Customer scans QR code or clicks payment link
- Customer confirms payment in their wallet
- Payment appears on blockchain
- Status changes to
processing - Transaction receives sufficient confirmations
- Status changes to
completed - You fulfill the order
Your action: Fulfill the order when status is completed.
Scenario 2: Expired Payment Request
- ~8 minutes pass without payment
- Status changes to
expired - Payment request is no longer valid
Your action: Offer customer option to create a new payment request.
Scenario 3: Slow Transaction
- Customer initiates payment near expiration
- Transaction broadcasts but isn't confirmed before timeout
- Fluxis grace period processes the late transaction
- Status updates to
processingthencompleted
Your action: Continue monitoring even after expiration for 2-3 additional minutes.
Best Practices
1. Always Use Reference IDs
Include your internal order or transaction ID in the
reference_id field. This makes reconciliation and debugging
much easier.
2. Display Clear Payment Information
Show customers:
- Payment amount in both crypto and fiat
- Time remaining (countdown timer)
- Network being used
- Expected confirmation time
3. Handle Expiration Gracefully
Don't abandon the customer if a payment expires. Offer a clear option to create a new payment request with one click.
4. Never Trust Status Alone
Always verify the amount field matches your expected amount.
Don't fulfill orders for underpaid or failed
payments without coordination.
5. Store Payment Request Data
Keep a record in your database linking:
- Your order ID
- Fluxis payment request ID
- Creation timestamp
- Current status
- Amount and asset
Common Integration Patterns
E-commerce Checkout Flow
Code
Point of Sale Terminal
Code
Troubleshooting
Payment Request Not Creating
Symptoms: Error when creating payment request
Common causes:
- Invalid or expired access token
- Point of Sale ID doesn't exist or doesn't belong to your organization
- Invalid UAI format
- Amount is zero or negative
Solution: Verify your authentication token, Point of Sale ID, and request parameters.
Status Not Updating
Symptoms: Status stuck on created despite customer payment
Common causes:
- Payment sent to wrong address
- Payment sent with wrong asset/network
- Insufficient network confirmations
- Customer payment pending in wallet
Solution: Ask customer to verify transaction hash. Check blockchain explorer to confirm transaction status.
Webhooks Not Received
Symptoms: No webhook notifications arriving
Common causes:
- Webhook URL not publicly accessible
- Firewall blocking Fluxis IP addresses
- Webhook endpoint returning errors
- SSL/TLS certificate issues
Solution: Call POST /v1/account/{accountID}/webhook/{webhookID}/test for a signed sample delivery. Check server logs, verify SSL, and confirm signature verification passes before processing events.
Testing Your Integration
Before going live, thoroughly test your integration:
Test Checklist
- Create payment request with valid parameters
- Display NASPIP token as QR code
- Monitor status changes via polling
- Handle
completedstatus correctly - Handle
expiredstatus gracefully - Test webhook delivery and parsing
- Verify webhook signature using secret from create response
- Test webhook via
POST /v1/account/{accountID}/webhook/{webhookID}/test - Handle network errors and retries
- Test edge cases (
underpaid,overpaid) - Verify amount precision (decimals)
Testing Environment
Contact Fluxis support to obtain test API credentials and test network assets for integration testing before going live.