Post payment request. The call is idempotent; that is, if one posts
        the same pos_id and pos_tid twice, only one payment request is created.

        Arguments:
            ledger:
                Log entries will be added to the open report on the specified
                ledger
            display_message_uri:
                Messages that can be used to inform the POS operator about the
                progress of the payment request will be POSTed to this URI if
                provided
            callback_uri:
                If provided, mCASH will POST to this URI when the status of the
                payment request changes, using the message mechanism described
                in the introduction. The data in the "object" part of the
                message is the same as what can be retrieved by calling GET on
                the "/payment_request/<tid>/outcome/" resource URI.
            customer:
                Customer identifiers include msisdn, scan token or access token
            currency:
                3 chars https://en.wikipedia.org/wiki/ISO_4217
            amount:
                The base amount of the payment
            additional_amount:
                Typically cash withdrawal or gratuity
            additional_edit:
                Whether user is allowed to additional amount for gratuity or
                similar
            allow_credit:
                Whether to allow credit payment for this payment request.
                Credit incurs interchange
            pos_id:
                The POS this payment request originates from, used for
                informing user about origin
            pos_tid:
                Local transaction id for POS. This must be unique for the POS
            text:
                Text that is shown to user when asked to pay. This can contain
                linebreaks and the text has to fit on smartphones screens.
            action:
                Action to perform, the main difference is what it looks like in
                App UI.
            expires_in:
                Expiration in seconds from when server received request
            required_scope:
                Scopes required to fulfill payment
            required_scope_text:
                Text that is shown to user when asked for permission.
            links:
                A list of links to be shown in app in various states
                [{"uri": "http://example.com/uri1",
                  "caption": "This is always shown",
                  "show_on": ["pending", "fail", "ok"]}]
            line_items:
                A list of product lines in the payment request. Each item should
                contain product_id, vat, description (optional), vat_rate, total,
                item_cost, quantity and optionally tags, which is a list of tag
                dicts containing tag_id and label. The sum of all
                line item totals must be equal to the amount argument.
                [{"product_id": "product-1", vat: "0.50",
                description: "An optional description", vat_rate: "0.25",
                total: "5.00", item_cost: "2.50", quantity: "2", "tags": [
                    {"tag_id": "product-info-5", "label": "Some product info"}
                ]}]

def create_payment_request(self, customer, currency, amount, allow_credit,
                               pos_id, pos_tid, action, ledger=None,
                               display_message_uri=None, callback_uri=None,
                               additional_amount=None, additional_edit=None,
                               text=None, expires_in=None, required_scope=None,
                               required_scope_text=None, links=None, line_items=None):
        """Post payment request. The call is idempotent; that is, if one posts
        the same pos_id and pos_tid twice, only one payment request is created.

        Arguments:
            ledger:
                Log entries will be added to the open report on the specified
                ledger
            display_message_uri:
                Messages that can be used to inform the POS operator about the
                progress of the payment request will be POSTed to this URI if
                provided
            callback_uri:
                If provided, mCASH will POST to this URI when the status of the
                payment request changes, using the message mechanism described
                in the introduction. The data in the "object" part of the
                message is the same as what can be retrieved by calling GET on
                the "/payment_request/<tid>/outcome/" resource URI.
            customer:
                Customer identifiers include msisdn, scan token or access token
            currency:
                3 chars https://en.wikipedia.org/wiki/ISO_4217
            amount:
                The base amount of the payment
            additional_amount:
                Typically cash withdrawal or gratuity
            additional_edit:
                Whether user is allowed to additional amount for gratuity or
                similar
            allow_credit:
                Whether to allow credit payment for this payment request.
                Credit incurs interchange
            pos_id:
                The POS this payment request originates from, used for
                informing user about origin
            pos_tid:
                Local transaction id for POS. This must be unique for the POS
            text:
                Text that is shown to user when asked to pay. This can contain
                linebreaks and the text has to fit on smartphones screens.
            action:
                Action to perform, the main difference is what it looks like in
                App UI.
            expires_in:
                Expiration in seconds from when server received request
            required_scope:
                Scopes required to fulfill payment
            required_scope_text:
                Text that is shown to user when asked for permission.
            links:
                A list of links to be shown in app in various states
                [{"uri": "http://example.com/uri1",
                  "caption": "This is always shown",
                  "show_on": ["pending", "fail", "ok"]}]
            line_items:
                A list of product lines in the payment request. Each item should
                contain product_id, vat, description (optional), vat_rate, total,
                item_cost, quantity and optionally tags, which is a list of tag
                dicts containing tag_id and label. The sum of all
                line item totals must be equal to the amount argument.
                [{"product_id": "product-1", vat: "0.50",
                description: "An optional description", vat_rate: "0.25",
                total: "5.00", item_cost: "2.50", quantity: "2", "tags": [
                    {"tag_id": "product-info-5", "label": "Some product info"}
                ]}]
        """
        arguments = {'customer': customer,
                     'currency': currency,
                     'amount': amount,
                     'allow_credit': allow_credit,
                     'pos_id': pos_id,
                     'pos_tid': pos_tid,
                     'action': action,
                     'ledger': ledger,
                     'display_message_uri': display_message_uri,
                     'callback_uri': callback_uri,
                     'additional_amount': additional_amount,
                     'additional_edit': additional_edit,
                     'text': text,
                     'expires_in': expires_in}

        if required_scope:
            arguments['required_scope'] = required_scope
            arguments['required_scope_text'] = required_scope_text
        if links:
            arguments['links'] = links

        if line_items:
            arguments['line_items'] = line_items

        return self.do_req('POST', self.merchant_api_base_url + '/payment_request/',
                           arguments).json()