xendit / xendit-php

Xendit REST API Client for PHP - Card, Virtual Account, Invoice, Disbursement, Recurring Payments, Payout, EWallet, Balance, Retail Outlets Services, xenPlatforms
https://developers.xendit.co/api-reference/
MIT License
152 stars 76 forks source link

Error Class "Xendit\Xendit\Invoice\CreateInvoiceRequest" not found #225

Open steph1902 opened 4 months ago

steph1902 commented 4 months ago

Error Class "Xendit\Xendit\Invoice\CreateInvoiceRequest" not found Laravel 8.75

public function __construct() {
    //    Xendit::setApiKey(env('XENDIT_SECRET_KEY'));
        Configuration::setXenditKey(env('XENDIT_SECRET_KEY'));
    }

    public function create(Request $request)
    {
        // Configuration::setXenditKey("YOUR_API_KEY_HERE");

        $apiInstance = new InvoiceApi();
        $create_invoice_request = new Xendit\Invoice\CreateInvoiceRequest([
            'external_id' => 'test1234',
            'description' => 'Test Invoice',
            'amount' => 10000,
            'invoice_duration' => 172800,
            'currency' => 'IDR',
            'reminder_time' => 1
        ]); // \Xendit\Invoice\CreateInvoiceRequest
        $for_user_id = "62efe4c33e45694d63f585f0"; // string | Business ID of the sub-account merchant (XP feature)

        try {
            $result = $apiInstance->createInvoice($create_invoice_request, $for_user_id);
            return response()->json($result);
        } catch (\Xendit\XenditSdkException $e) {
            return response()->json(['error' => $e->getMessage()], 500);
        }
    }