QuickBooks-V3-PHP-SDK
QuickBooks-V3-PHP-SDK copied to clipboard
Exception when trying to apply Credit Card Payment to Sales Receipt
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 Which version of the SDK are you using?
@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.
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
Is there an update on this? I believe the issue is still present.