Skip to main content

Create Your First Payment Link

Learn how to create payment links that customers can use to send you money through NextAPI. Payment links are perfect for e-commerce, invoices, and collections.

Payment links are secure URLs that direct customers to a payment page where they can complete transactions using various payment methods supported by NextAPI.

curl -X POST "https://api.nextapi.com/v1/payment-links" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"currency": "PHP",
"description": "Product Purchase",
"expires_at": "2024-12-31T23:59:59Z"
}'

Response Example

{
"id": "plink_abc123",
"url": "https://pay.nextapi.com/plink_abc123",
"amount": 50000,
"currency": "PHP",
"status": "active",
"expires_at": "2024-12-31T23:59:59Z"
}

Add customer information and metadata:

curl -X POST "https://api.nextapi.com/v1/payment-links" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"amount": 50000,
"currency": "PHP",
"description": "Custom T-Shirt Order",
"customer": {
"email": "customer@example.com",
"name": "John Doe"
},
"metadata": {
"order_id": "ORD-001",
"product_sku": "TSHIRT-RED-L"
}
}'

Always test payment links in sandbox mode before going live:

# Use sandbox URL for testing
curl -X POST "https://api-sandbox.nextapi.com/v1/payment-links" \
-H "Authorization: Bearer YOUR_SANDBOX_API_KEY" \
# ... rest of the request

Next Steps

  • [Learn about webhooks for payment notifications](../guides/core-concepts/understanding-webhooks
  • [Build an e-commerce checkout](../guides/how-to/build-an-e-commerce-checkout
  • [Take commissions from user sales](../guides/how-to/take-a-commission-from-your-users-sale