code from :
projectname/vendor/xendit/xendit-php/lib/Invoice/InvoiceApi.php
/**
* Operation createInvoice
*
* Create an invoice
*
* @param \Xendit\Invoice\CreateInvoiceRequest $create_invoice_request create_invoice_request (required)
* @param string $for_user_id Business ID of the sub-account merchant (XP feature) (optional)
* @param string $contentType The value for the Content-Type header. Check self::contentTypes['createInvoice'] to see the possible values for this operation
*
* @throws \Xendit\XenditSdkException on non-2xx response
* @throws \InvalidArgumentException
* @return \Xendit\Invoice\Invoice
*/
public function createInvoice($create_invoice_request, $for_user_id = null, string $contentType = self::contentTypes['createInvoice'][0])
{
list($response) = $this->createInvoiceWithHttpInfo($create_invoice_request, $for_user_id, $contentType);
return $response;
}
code saya:
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Xendit\Configuration;
use Xendit\Invoice\InvoiceApi;
use Xendit\Invoice\CreateInvoiceRequest;
use App\Models\Payment;
use Xendit\Invoice;
use Xendit\Xendit;
class PaymentController extends Controller
{
public function createInvoice()
{
Configuration::setXenditKey(env('XENDIT_SECRET_KEY'));
$apiInstance = new InvoiceApi();
$create_invoice_request = new CreateInvoiceRequest([
'external_id' => 'test1234',
'description' => 'Test Invoice',
'amount' => 10000,
'invoice_duration' => 172800,
'currency' => 'PHP',
'reminder_time' => 1
]);
try {
$result = $apiInstance->createInvoice($create_invoice_request);
return response()->json(['message' => 'Invoice created successfully', 'data' => $response]);
} catch (\Xendit\XenditSdkException $e) {
return response()->json(['message' => 'Exception when calling InvoiceApi->createInvoice: ' . $e->getMessage(), 'full_error' => $e->getFullError()], 500);
}
}
}
error:
ErrorException
Only variables should be passed by reference
tapi invoicenya berhasil kebuat di dashboard xenditnya, fixing errornya gimana ya .. trims before
ask
hi sori mau nanya perihal xendit
code from : projectname/vendor/xendit/xendit-php/lib/Invoice/InvoiceApi.php
code saya:
error:
tapi invoicenya berhasil kebuat di dashboard xenditnya, fixing errornya gimana ya .. trims before