Secure Transactions Development Tutorials, Guides & Insights
Unlock 1+ expert-curated secure transactions tutorials, real-world code snippets, and modern dev strategies. From fundamentals to advanced topics, boost your secure transactions skills on DeveloperBreeze.
Adblocker Detected
It looks like you're using an adblocker. Our website relies on ads to keep running. Please consider disabling your adblocker to support us and access the content.
Tutorial
php
Integrating and Using NMI Payment Gateway in Laravel
In a controller, you can use the NMI service as follows:
use App\Services\NMI;
class PaymentController extends Controller
{
protected $nmi;
public function __construct(NMI $nmi)
{
$this->nmi = $nmi;
}
public function storeCustomer(Request $request)
{
$creditCard = $request->only(['cc_number', 'exp_date', 'cvv']);
$customerVaultId = $this->nmi->addCustomerVault($creditCard);
return response()->json(['customer_vault_id' => $customerVaultId]);
}
public function processPayment(Request $request)
{
$customerVaultId = $request->input('customer_vault_id');
$amount = $request->input('amount');
$paymentResponse = $this->nmi->processPaymentUsingVault($customerVaultId, $amount);
return response()->json($paymentResponse);
}
}Aug 14, 2024
Read More