2

I'm trying to extend the API response of Magento SalesOrderInfo - more specifically, I'm trying to get back the paymnent additional_information

In my module, in etc/wsdl.xml I added

        <complexType name="salesOrderPaymentEntity">
            <all>
                <element name="last_trans_id" type="xsd:string" minOccurs="0" />
            </all>
        </complexType>

And it works like a charm, it returns the value of last_trans_id from the sales_flat_order_payment table.

I'm now trying to get the paymnent additional_information so I added <element name="additional_information" type="xsd:string" minOccurs="0" /> and my code now looks like this

        <complexType name="salesOrderPaymentEntity">
            <all>
                <element name="last_trans_id" type="xsd:string" minOccurs="0" />
                <element name="additional_information" type="xsd:string" minOccurs="0" />
            </all>
        </complexType>

but the additional_information is not returning anything because it's an array (when I logged it, it returns Array)

I hate asking such a basic question but I've spent hours looking for how to get an array, I looked at how Magento returns the product_options that's also an array but they also declare it as a string.

How can I get the additional_information of payment in my API?

2

Posting the answer here in case someone else bumps in to the same issue.

Magento order object already returns the additional_information as an array, so we just needed to add a typens

<element name="additional_information" type="typens:salesOrderPaymentAdditionalInformationEntity" minOccurs="0" />

and then parse out the line items - I did it for 3 different payment methods (Auth.net, PayPal and Amazon)

        <complexType name="salesOrderPaymentAdditionalInformationEntity">
            <all>
                <element name="response_code" type="xsd:string" minOccurs="0" />
                <element name="response_subcode" type="xsd:string" minOccurs="0" />
                <element name="response_reason_code" type="xsd:string" minOccurs="0" />
                <element name="response_reason_text" type="xsd:string" minOccurs="0" />
                <element name="approval_code" type="xsd:string" minOccurs="0" />
                <element name="auth_code" type="xsd:string" minOccurs="0" />
                <element name="avs_result_code" type="xsd:string" minOccurs="0" />
                <element name="transaction_id" type="xsd:string" minOccurs="0" />
                <element name="reference_transaction_id" type="xsd:string" minOccurs="0" />
                <element name="invoice_number" type="xsd:string" minOccurs="0" />
                <element name="description" type="xsd:string" minOccurs="0" />
                <element name="amount" type="xsd:string" minOccurs="0" />
                <element name="method" type="xsd:string" minOccurs="0" />
                <element name="transaction_type" type="xsd:string" minOccurs="0" />
                <element name="customer_id" type="xsd:string" minOccurs="0" />
                <element name="md5_hash" type="xsd:string" minOccurs="0" />
                <element name="card_code_response_code" type="xsd:string" minOccurs="0" />
                <element name="cavv_response_code" type="xsd:string" minOccurs="0" />
                <element name="acc_number" type="xsd:string" minOccurs="0" />
                <element name="card_type" type="xsd:string" minOccurs="0" />
                <element name="split_tender_id" type="xsd:string" minOccurs="0" />
                <element name="requested_amount" type="xsd:string" minOccurs="0" />
                <element name="balance_on_card" type="xsd:string" minOccurs="0" />
                <element name="profile_id" type="xsd:string" minOccurs="0" />
                <element name="payment_id" type="xsd:string" minOccurs="0" />
                <element name="is_fraud" type="xsd:string" minOccurs="0" />
                <element name="paypal_express_checkout_shipping_method" type="xsd:string" minOccurs="0" />
                <element name="paypal_payer_id" type="xsd:string" minOccurs="0" />
                <element name="paypal_payer_email" type="xsd:string" minOccurs="0" />
                <element name="paypal_payer_status" type="xsd:string" minOccurs="0" />
                <element name="paypal_address_status" type="xsd:string" minOccurs="0" />
                <element name="paypal_correlation_id" type="xsd:string" minOccurs="0" />
                <element name="paypal_express_checkout_payer_id" type="xsd:string" minOccurs="0" />
                <element name="paypal_express_checkout_token" type="xsd:string" minOccurs="0" />
                <element name="paypal_express_checkout_redirect_required" type="xsd:string" minOccurs="0" />
                <element name="paypal_protection_eligibility" type="xsd:string" minOccurs="0" />
                <element name="paypal_payment_status" type="xsd:string" minOccurs="0" />
                <element name="paypal_pending_reason" type="xsd:string" minOccurs="0" />
                <element name="order_reference" type="xsd:string" minOccurs="0" />
            </all>
        </complexType>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.