QuickBooks-V3-PHP-SDK icon indicating copy to clipboard operation
QuickBooks-V3-PHP-SDK copied to clipboard

Exception when trying to apply Credit Card Payment to Sales Receipt

Open rogerd330 opened this issue 4 years ago • 4 comments

Getting exception: Property CreditChargeInfo does not exist when trying to create a Sales Receipt for a transaction being processed by the Payment API. Using the sandbox for both Payments and SalesReceipt.

Sample code:

$salesReceiptObj = SalesReceipt::create([
            "CustomerRef" => [
                "value" => $customerRequestObj->Id,
            ],
            "BillEmail" => [
                "Address" => $billingEmail,
            ],
            "Line" => [[
                "Id" => "1",
                "LineNum" => 1,
                "Description" => "Pest Control Services",
                "Amount" => 35.0,
                "DetailType" => "SalesItemLineDetail",
                "SalesItemLineDetail" => [
                    "ItemRef" => [
                        "value" => "1",
                        "name" => "Pest Control",
                    ],
                    "UnitPrice" => 35,
                    "Qty" => 1,
                    "TaxCodeRef" => [
                        "value" => "NON",
                    ],
                ],
            ]],
            "PaymentType" => "CreditCard",
            "CreditCardPayment" => [
                "CreditChargeInfo" => [
                    "ProcessPayment" => true,
                ],
                "CreditChargeResponse" => [
                    "CCTransId" => "E2XT5I2FFZGS"
                ]
            ],
            "TxnSource" => "IntuitPayment",
        ]);

Should the FacadeClassMapper.php CreditCardPayment be mapped to CreditCardPayment instead of BillPaymentCreditCard? It seems BillPaymentCreditCard doesn't have the properties to support the sample request above.

My end goal is to store card IDs from the Payment API and use them to charge customers and create a sales receipt in QBO for our accounting purposes. The sample code above is the only/best way I found to accomplish this.

Thanks

rogerd330 avatar Jan 23 '20 15:01 rogerd330

@rogerd330 Which version of the SDK are you using?

bsivalingam avatar Mar 06 '20 00:03 bsivalingam

@bsivalingam I was using version 5.3.2 and it is happened to me.

I believe the solution by @rogerd330 above does fix the issue, but potentially breaks other resources that may depend on that class to be loaded. I don't have the time to go through every resource in the API to see if it is used. I ended up forking the library and doing it and it seems to work for my use case.

behrhartuhin avatar Mar 09 '20 22:03 behrhartuhin

Opening up SDK for hacktoberfest contributions.

Hacktoberfest is underway right now and we would love for you to contribute 🚀 . More information on #hacktoberfest is here

Develop-with-Intuit for Hacktoberfest

abisalehalliprasan avatar Oct 06 '20 21:10 abisalehalliprasan

Is there an update on this? I believe the issue is still present.

DIntriglia avatar Feb 23 '22 21:02 DIntriglia