Closed z03n87 closed 4 years ago
Looks like you are using the old API. What's the xendit-php
version are you using? v2 of our library introduced breaking changes. Please have a look at https://github.com/xendit/xendit-php/blob/master/examples/InvoiceExample.php for your reference
version 2.3 So, in this new version what is use Dotenv\Dotenv; use Xendit\Xendit;
Where do I get this?
I would recommend you to use https://getcomposer.org/ and follow our installation instruction https://github.com/xendit/xendit-php#installation
Thanks for the respond.
I did install via composer, and get all files with autoload.php
so I try this code:
require 'vendor/autoload.php'; Xendit::setApiKey('xnd_development_xxxxx');
$params = ['external_id' => 'demo_147580196270','payer_email' => 'sample_email@xendit.co','description' => 'Trip to Bali','amount' => 32000];
$createInvoice = \Xendit\Invoice::create($params); var_dump($createInvoice);
Still error : Uncaught Error: Class 'Xendit' not found
below is the image of my installation via composer:
Have you included this use Xendit\Xendit;
? @z03n87
ok finally Done, thanks a lot.
Hi, I try to create invoice with this php code:
require 'vendor/autoload.php';
$options['secret_api_key'] = 'xnd_development_xxxxxx';
$xenditPHPClient = new XenditClient\XenditPHPClient($options);
$external_id = 'demo_1475801962607'; $amount = 230000; $payer_email = 'sample_email@xendit.co'; $description = 'Trip to Bali';
$response = $xenditPHPClient->createInvoice($external_id, $amount, $payer_email, $description); print_r($response);
I get autoload.php by installing via composer require xendit/xendit-php
When I run the script, getting this error: Uncaught Error: Class 'XenditClient\XenditPHPClient' not found
Please help what's wrong with my code?!