Paystack
Base path: /api/paystack
POST /create-payment-intent
Initializes a Paystack transaction for the authenticated user. Returns an authorization URL to redirect the user to Paystack's checkout page.
Requires authentication.
Request Body
{
"amount": 500
}
Amount is in Naira. The backend converts it to kobo (multiplies by 100) before sending to Paystack.
Responses
200 - Success: Paystack transaction initialization object, including authorization_url and reference.
POST /verify-payment
Verifies a completed Paystack transaction by reference. Each reference can only be verified once.
Requires authentication.
Request Body
{
"reference": "paystack_reference_here"
}
Responses
200 - Success:
{
"success": true,
"amount": 500,
"userId": "paystack-customer-id"
}
200 - Already processed:
{
"success": false,
"message": "Payment reference has already been processed"
}
POST /mint-tokens
Mints FUC tokens to a user's Stellar wallet. Called internally after payment verification but also exposed as a route for manual admin use.
Requires authentication.
Request Body
{
"userId": "uuid",
"amount": 500
}
Responses
200 - Success:
{
"success": true,
"message": "Tokens minted successfully"
}
GET /callback
Paystack redirects to this endpoint after a payment is completed. It verifies the payment, mints the appropriate FUC tokens and serves an HTML response page.
Public endpoint - no token required.
The callback_url is set to {BASE_URL}/api/paystack/callback when initializing a transaction. Paystack appends reference or trxref as query parameters automatically.
Responses
HTML page - success, error or already-processed depending on the outcome.