<?php require_once __DIR__ . '/../src/autoload.php'; use MyPay\Checkout\Checkout; try { $checkout = new Checkout("NjQ1MzVDNUE2M0Y0QUI0NzU4NTQwMEFGNkU1QUZGQTdDMTZDOTJFNw=="); $dados = $checkout->ckeckInvoice("ff520c91fd6f01d5ba757cb9b71dc58c"); //Invoice Unique Id $status = $checkout->getInvoiceStatus(); } catch (\MyPay\Core\MyPayException $e) { echo $e->getMessage(); }
public function testExcetionNewInvoiceData() { $this->setExpectedException('MyPay\\Core\\MyPayException'); $checkout = new Checkout("Invalid Token", true); $invoice = array("Nothing"); $checkout->createInvoice($invoice); }
<?php require_once __DIR__ . '/../src/autoload.php'; use MyPay\Checkout\Checkout; use MyPay\Invoice\Invoice; use MyPay\Invoice\InvoiceProduct; $checkout = new Checkout("NjQ1MzVDNUE2M0Y0QUI0NzU4NTQwMEFGNkU1QUZGQTdDMTZDOTJFNw=="); $invoice = new Invoice(); $invoice->setCancelUrl("http://www.example.net/cancel"); $invoice->setSuccessUrl("http://www.example.net/success"); $invoice->setCustomerEmail("*****@*****.**"); $invoice->setCustomerName("Test Invoice User"); $invoice->setInvoiceCurrency('USD'); $invoice->setInvoiceDeliveryFee("0.00"); $invoice->setInvoiceDiscounts("0.00"); $invoice->setInvoiceNumber("0099203"); $invoice->setInvoiceDescription("Test Invoice Description"); $product = new InvoiceProduct(); $product->setDescription("Test Purposes"); $product->setName("Test Product"); $product->setQuantity("10"); $product->setUnityPrice("1.00"); $invoice->addProducts($product); $checkout->createInvoice($invoice); $invoiceId = $checkout->getInvoiceToken(); // UNIQUE ID FOR YOUR INVOICE $invoicePayURL = $checkout->getPayInvoiceUrl(); // URL TO SEND YOUR CUSTOMER TO PAY