src/gateways/Gateway.php
private function _saveSubscriptionInvoice(array $stripeInvoice, Subscription $subscription): Invoice
    {
        $invoiceService = StripePlugin::getInstance()->getInvoices();
        $invoice = $invoiceService->getInvoiceByReference($stripeInvoice['id']) ?: new Invoice();
        $invoice->subscriptionId = $subscription->id;
        $invoice->reference = $stripeInvoice['id'];
        $invoice->invoiceData = $stripeInvoice;
        $invoiceService->saveInvoice($invoice);

        return $invoice;
    }
private function _saveSubscriptionInvoice(array $stripeInvoice, Subscription $subscription): Invoice
    {
        $invoiceService = StripePlugin::getInstance()->getInvoices();
        $invoice = $invoiceService->getInvoiceByReference($stripeInvoice['id']) ?: new Invoice();
        $invoice->subscriptionId = $subscription->id;
        $invoice->reference = $stripeInvoice['id'];
        $invoice->invoiceData = $stripeInvoice;
        $invoiceService->saveInvoice($invoice);

        return $invoice;
    }
private function _saveSubscriptionInvoice ( array $ stripeInvoice , Subscription $ subscription ) : Invoice { $ invoiceService = StripePlugin :: getInstance ( ) -> getInvoices ( ) ; $ invoice = $ invoiceService -> getInvoiceByReference ( $ stripeInvoice [ 'id' ] ) ? : new Invoice ( ) ; $ invoice -> subscriptionId = $ subscription -> id ; $ invoice -> reference = $ stripeInvoice [ 'id' ] ; $ invoice -> invoiceData = $ stripeInvoice ; $ invoiceService -> saveInvoice ( $ invoice ) ; return $ invoice ; }
Save a subscription invoice.

@param $stripeInvoice
@param $subscription
@return Invoice
Save a subscription invoice .