|
11 | 11 | // Crea las configuraciones del cliente http fiscalapi. |
12 | 12 | // Lea como obtener sus credenciales: https://docs.fiscalapi.com/credentials-info |
13 | 13 | $settings = new FiscalApiSettings( |
14 | | - 'https://localhost:7173', |
15 | | - 'sk_development_833a58f9_8212_43ce_b544_f2fa93b1e895', |
16 | | - 'e839651d-1765-4cd0-ba7f-547a4c20580f', |
| 14 | + 'https://test.fiscalapi.com', |
| 15 | + '<apiKey>', |
| 16 | + '<tenant>', |
17 | 17 | false, // Imprimir raw request / response |
18 | 18 | false, // Desactivar verificación SSL. (por seguridad NO debería asignar false en producción) |
19 | 19 | ); |
|
353 | 353 | // $apiResponse = $client->getInvoiceService()->create($invoice); |
354 | 354 | // consoleLog($apiResponse); |
355 | 355 |
|
| 356 | + // ------------------------------------------------------------------ |
| 357 | + // Crear factura global por valores |
| 358 | + // ------------------------------------------------------------------ |
| 359 | + // $invoice = [ |
| 360 | + // 'versionCode' => "4.0", |
| 361 | + // 'series' => "F", |
| 362 | + // 'date' => $currentDate, |
| 363 | + // 'paymentFormCode' => "01", |
| 364 | + // 'paymentMethodCode' => "PUE", |
| 365 | + // 'currencyCode' => "MXN", |
| 366 | + // 'typeCode' => "I", |
| 367 | + // 'expeditionZipCode' => "01160", |
| 368 | + // 'exchangeRate' => 1, |
| 369 | + // 'exportCode' => "01", |
| 370 | + // 'globalInformation' => [ |
| 371 | + // 'periodicityCode' => "01", |
| 372 | + // 'monthCode' => "05", |
| 373 | + // 'year' => 2025 |
| 374 | + // ], |
| 375 | + // 'issuer' => [ |
| 376 | + // 'tin' => "FUNK671228PH6", |
| 377 | + // 'legalName' => "KARLA FUENTE NOLASCO", |
| 378 | + // 'taxRegimeCode' => "621", |
| 379 | + // 'taxCredentials' => [ |
| 380 | + // [ |
| 381 | + // 'base64File' => $base64Cert, |
| 382 | + // 'fileType' => 0, |
| 383 | + // 'password' => $password |
| 384 | + // ], |
| 385 | + // [ |
| 386 | + // 'base64File' => $base64Key, |
| 387 | + // 'fileType' => 1, |
| 388 | + // 'password' => $password |
| 389 | + // ] |
| 390 | + // ] |
| 391 | + // ], |
| 392 | + // 'recipient' => [ |
| 393 | + // 'tin' => "XAXX010101000", |
| 394 | + // 'legalName' => "PUBLICO EN GENERAL", |
| 395 | + // 'zipCode' => "01160", |
| 396 | + // 'taxRegimeCode' => "616", |
| 397 | + // 'cfdiUseCode' => "S01", |
| 398 | + // 'email' => "someone@somewhere.com" |
| 399 | + // ], |
| 400 | + // 'items' => [ |
| 401 | + // [ |
| 402 | + // 'itemCode' => "01010101", |
| 403 | + // 'quantity' => 1, |
| 404 | + // 'unitOfMeasurementCode' => "ACT", |
| 405 | + // 'description' => "Venta", |
| 406 | + // 'unitPrice' => 1230.00, |
| 407 | + // 'taxObjectCode' => "02", |
| 408 | + // 'itemSku' => "venta0001", |
| 409 | + // 'itemTaxes' => [ |
| 410 | + // [ |
| 411 | + // 'taxCode' => "002", |
| 412 | + // 'taxTypeCode' => "Tasa", |
| 413 | + // 'taxRate' => "0.160000", |
| 414 | + // 'taxFlagCode' => "T" |
| 415 | + // ] |
| 416 | + // ] |
| 417 | + // ] |
| 418 | + // ] |
| 419 | + // ]; |
| 420 | + |
| 421 | + // $apiResponse = $client->getInvoiceService()->create($invoice); |
| 422 | + // consoleLog($apiResponse); |
| 423 | + |
| 424 | + |
| 425 | + // ------------------------------------------------------------------ |
| 426 | + // Crear factura global por referencias |
| 427 | + // ------------------------------------------------------------------ |
| 428 | + $invoice = [ |
| 429 | + 'versionCode' => "4.0", |
| 430 | + 'series' => "F", |
| 431 | + 'date' => $currentDate, |
| 432 | + 'paymentFormCode' => "01", |
| 433 | + 'paymentMethodCode' => "PUE", |
| 434 | + 'currencyCode' => "MXN", |
| 435 | + 'typeCode' => "I", |
| 436 | + 'exportCode' => "01", |
| 437 | + 'expeditionZipCode' => "01160", |
| 438 | + 'exchangeRate' => 1, |
| 439 | + 'globalInformation' => [ |
| 440 | + 'periodicityCode' => "01", |
| 441 | + 'monthCode' => "05", |
| 442 | + 'year' => 2025 |
| 443 | + ], |
| 444 | + 'issuer' => [ |
| 445 | + 'id' => "78d380fd-1b69-4e3c-8bc0-4f57737f7d5f" |
| 446 | + ], |
| 447 | + 'recipient' => [ |
| 448 | + 'id' => "4e7ba2d7-2302-42f1-9fe4-6b75069f0fc9" |
| 449 | + ], |
| 450 | + 'items' => [ |
| 451 | + [ |
| 452 | + 'itemCode' => "01010101", |
| 453 | + 'quantity' => 1, |
| 454 | + 'unitOfMeasurementCode' => "ACT", |
| 455 | + 'description' => "Venta", |
| 456 | + 'unitPrice' => 1230.00, |
| 457 | + 'taxObjectCode' => "02", |
| 458 | + 'itemSku' => "venta0001", |
| 459 | + 'itemTaxes' => [ |
| 460 | + [ |
| 461 | + 'taxCode' => "002", |
| 462 | + 'taxTypeCode' => "Tasa", |
| 463 | + 'taxRate' => "0.160000", |
| 464 | + 'taxFlagCode' => "T" |
| 465 | + ] |
| 466 | + ] |
| 467 | + ] |
| 468 | + ] |
| 469 | + ]; |
| 470 | + |
| 471 | + $apiResponse = $client->getInvoiceService()->create($invoice); |
| 472 | + consoleLog($apiResponse); |
| 473 | + |
| 474 | + |
356 | 475 |
|
357 | 476 | // ------------------------------------------------------------------ |
358 | 477 | // Crear factura de ingreso con IVA 16% |
|
0 commit comments