NeroPay Docs
API & Integrations

Custom PHP and Laravel Integration

Ready plugin guide

Custom PHP and Laravel Integration

Connect Custom PHP / Laravel to NeroPay using server-side API calls and webhooks.

Custom PHP / LaravelCheckoutWebhooks

Recommended Custom PHP / Laravel flow

  1. Create or open the Custom PHP / Laravel order/invoice.
  2. Send a NeroPay API request from the server side.
  3. Store the returned NeroPay id on the Custom PHP / Laravel order/invoice record.
  4. Redirect the customer or display the payment link.
  5. Receive webhook confirmation and update the order/invoice status.
POST/payment-intents

Create the NeroPay payment for a Custom PHP / Laravel order or invoice.

ParameterTypeRequiredDescription
identifierstringYesUnique order or invoice reference from Custom PHP / Laravel.
amountdecimalYesOrder total in major currency units.
currencystringYesCurrency code from the order.
detailsstringYesOrder or invoice description.
success_urlurl stringYesReturn URL after success.
cancel_urlurl stringYesReturn URL after cancellation.
ipn_urlurl stringYesWebhook URL handled by the plugin.
metadataobjectOptionalShort references such as order id, invoice id or customer id.
 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . $secretKey,
        'Accept: application/json',
        'Content-Type: application/json',
        'X-NeroPay-Timestamp: ' . $timestamp,
        'X-NeroPay-Signature: ' . $signature,
        'Idempotency-Key: ' . bin2hex(random_bytes(16)),
    ],
    CURLOPT_POSTFIELDS => $rawBody,
]);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

echo $response;
{
  "success": true,
  "data": {
    "id": "pay_nero_123",
    "identifier": "CUSTOM_PHP_/_LARAVEL-1001",
    "status": "pending",
    "checkout_url": "https://eu.neropay.app/checkout/..."
  }
}

Webhook update

When transaction.succeeded is received, verify the event, retrieve the transaction if needed and mark the Custom PHP / Laravel order as paid.

transaction.succeeded => paid
transaction.cancelled => cancelled
transaction.failed => failed
refund.succeeded => refunded

Laravel controller example

 $request->amount,
        'currency' => 'GBP',
        'description' => 'Order #' . $request->order_id,
        'reference' => 'ORDER-' . $request->order_id,
    ];

    $timestamp = time();
    $rawBody = json_encode($payload, JSON_UNESCAPED_SLASHES);
    $secret = config('services.neropay.secret_key');

    $response = Http::withHeaders([
        'Authorization' => 'Bearer ' . $secret,
        'Accept' => 'application/json',
        'Content-Type' => 'application/json',
        'X-NeroPay-Timestamp' => $timestamp,
        'X-NeroPay-Signature' => hash_hmac('sha256', $timestamp . '.' . $rawBody, $secret),
        'Idempotency-Key' => (string) str()->uuid(),
    ])->withBody($rawBody, 'application/json')
      ->post('https://eu.neropay.app/v2/payment-intents');

    return $response->json();
}