public function createBill($billId, array $params)
    {
        $params = array_replace_recursive(
            [
                'amount'             => null,
                'currency'           => null,
                'comment'            => null,
                'expirationDateTime' => null,
                'phone'              => null,
                'email'              => null,
                'account'            => null,
                'successUrl'         => null,
                'customFields'       => [
                    'apiClient'        => CLIENT_NAME,
                    'apiClientVersion' => CLIENT_VERSION,
                ],
            ],
            $params
        );

        $bill = $this->requestBuilder(
            $billId,
            self::PUT,
            array_filter(
                [
                    'amount'             => array_filter(
                        [
                            'currency' => (string) $params['currency'],
                            'value'    => $this->normalizeAmount($params['amount']),
                        ]
                    ),
                    'comment'            => (string) $params['comment'],
                    'expirationDateTime' => (string) $params['expirationDateTime'],
                    'customer'           => array_filter(
                        [
                            'phone'   => (string) $params['phone'],
                            'email'   => (string) $params['email'],
                            'account' => (string) $params['account'],
                        ]
                    ),
                    'customFields'       => array_filter($params['customFields']),
                ]
            )
        );
        if (false === empty($bill['payUrl']) && false === empty($params['successUrl'])) {
            $bill['payUrl'] = $this->getPayUrl($bill, $params['successUrl']);
        }

        return $bill;

    }
public function createBill($billId, array $params)
    {
        $params = array_replace_recursive(
            [
                'amount'             => null,
                'currency'           => null,
                'comment'            => null,
                'expirationDateTime' => null,
                'phone'              => null,
                'email'              => null,
                'account'            => null,
                'successUrl'         => null,
                'customFields'       => [
                    'apiClient'        => CLIENT_NAME,
                    'apiClientVersion' => CLIENT_VERSION,
                ],
            ],
            $params
        );

        $bill = $this->requestBuilder(
            $billId,
            self::PUT,
            array_filter(
                [
                    'amount'             => array_filter(
                        [
                            'currency' => (string) $params['currency'],
                            'value'    => $this->normalizeAmount($params['amount']),
                        ]
                    ),
                    'comment'            => (string) $params['comment'],
                    'expirationDateTime' => (string) $params['expirationDateTime'],
                    'customer'           => array_filter(
                        [
                            'phone'   => (string) $params['phone'],
                            'email'   => (string) $params['email'],
                            'account' => (string) $params['account'],
                        ]
                    ),
                    'customFields'       => array_filter($params['customFields']),
                ]
            )
        );
        if (false === empty($bill['payUrl']) && false === empty($params['successUrl'])) {
            $bill['payUrl'] = $this->getPayUrl($bill, $params['successUrl']);
        }

        return $bill;

    }
public function createBill ( $ billId , array $ params ) { $ params = array_replace_recursive ( [ 'amount' => null , 'currency' => null , 'comment' => null , 'expirationDateTime' => null , 'phone' => null , 'email' => null , 'account' => null , 'successUrl' => null , 'customFields' => [ 'apiClient' => CLIENT_NAME , 'apiClientVersion' => CLIENT_VERSION , ] , ] , $ params ) ; $ bill = $ this -> requestBuilder ( $ billId , self :: PUT , array_filter ( [ 'amount' => array_filter ( [ 'currency' => ( string ) $ params [ 'currency' ] , 'value' => $ this -> normalizeAmount ( $ params [ 'amount' ] ) , ] ) , 'comment' => ( string ) $ params [ 'comment' ] , 'expirationDateTime' => ( string ) $ params [ 'expirationDateTime' ] , 'customer' => array_filter ( [ 'phone' => ( string ) $ params [ 'phone' ] , 'email' => ( string ) $ params [ 'email' ] , 'account' => ( string ) $ params [ 'account' ] , ] ) , 'customFields' => array_filter ( $ params [ 'customFields' ] ) , ] ) ) ; if ( false === empty ( $ bill [ 'payUrl' ] ) && false === empty ( $ params [ 'successUrl' ] ) ) { $ bill [ 'payUrl' ] = $ this -> getPayUrl ( $ bill , $ params [ 'successUrl' ] ) ; } return $ bill ; }
Creating bill.

@param string|number $billId The bill identifier.
@param array         $params The parameters:
+ amount             {string|number} The amount;
+ currency           {string}        The currency;
+ comment            {string}        The bill comment;
+ expirationDateTime {string}        The bill expiration datetime (ISOstring);
+ phone              {string}        The phone;
+ email              {string}        The email;
+ account            {string}        The account;
+ successUrl         {string}        The success url;
+ customFields       {array}         The bill custom fields.

@return array Return result.

@throws BillPaymentsException Throw on API return invalid response.
Creating bill .