PHP code example of billie / shopware6-payment-module

1. Go to this page and download the library: Download billie/shopware6-payment-module library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

billie / shopware6-payment-module example snippets


/** @var \Symfony\Component\DependencyInjection\ContainerInterface $container */

/** @var \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $repository */
$repository = $container->get('billie_order_data.repository');

/** @var \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $repository */

$orderId = 'YOUR_ORDER_ID';
$criteria = new \Shopware\Core\Framework\DataAbstractionLayer\Search\Criteria();
$criteria->addFilter(new \Shopware\Core\Framework\DataAbstractionLayer\Search\Filter\EqualsFilter(
    \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_ORDER_ID,
    $orderId
));

/** @var \Billie\BilliePayment\Components\Order\Model\OrderDataEntity $billieOrderData */
$billieOrderData = $repository->search($criteria, \Shopware\Core\Framework\Context::createDefaultContext())->first();

$billieOrderData->getId(); // ID of the Billie order data entity
$billieOrderData->getReferenceId(); // billie order reference id (uui)
$billieOrderData->getExternalInvoiceNumber(); // external invoice number
$billieOrderData->getExternalInvoiceUrl(); // external invoice url
$billieOrderData->getExternalDeliveryNoteUrl(); // external delivery note url
$billieOrderData->getBankIban(); // bank account: iban
$billieOrderData->getBankBic(); // bank account: bic
$billieOrderData->getBankName(); // bank account: name

/** @var \Shopware\Core\Checkout\Order\OrderEntity $order */
$order = [...];

/** @var \Billie\BilliePayment\Components\Order\Model\OrderDataEntity $billieOrderData */
$billieOrderData = $order->getExtension(\Billie\BilliePayment\Components\Order\Model\Extension\OrderExtension::EXTENSION_NAME);

$billieOrderData->getExternalInvoiceNumber(); // External invoice number
$billieOrderData->getExternalInvoiceUrl(); // external invoice url
$billieOrderData->getExternalDeliveryNoteUrl(); // external delivery note url

/** @var \Shopware\Core\Framework\DataAbstractionLayer\EntityRepository $repository */

$repository->upsert([
    [
        \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_ID => 'ID of the Billie order data entity', // This is always 
        \Billie\BilliePayment\Components\Order\Model\OrderDataEntity::FIELD_EXTERNAL_DELIVERY_NOTE_URL => 'external delivery note url',
    ]
], \Shopware\Core\Framework\Context::createDefaultContext());