I am trying to add payments to an invoice using the Quickbooks PHP SDK.
I can create customers, invoices, items, sales lines etc but I am a little stuck when it comes to the correct way to create and link a payment to an invoice.
This is what I have been trying:
$qbLinkedInvoice = new IPPLinkedTxn();
$qbLinkedInvoice->TxnId = 277; // the QB invoice ID
$qbLinkedInvoice->TxnType = 'Invoice';
$qbPayment = new IPPPayment();
$qbPayment->Amount = 10.0;
$qbPayment->CustomerRef = 164; // the QB cusotmer ID
$qbPayment->LinkedTxn = $qbLinkedInvoice;
$createdQbPayment = $this->dataService->Add($qbPayment);
But this just gives:
CheckNullResponseAndThrowException - Response Null or Empty
Which means something isn't formatted correctly. All the refs are correct (Exist in quickbooks, invoice, customer etc).
I have been sending up invoice line items by creating an IPPSalesItemLineDetail Object and then assigning that to the line and then assigning that to the invoice as the 'Line' array property at the point when the invoice is created in quickbooks but I can't seem to figure out how to send a payment and link that to an invoice.
There aren't any samples within the SDK that give me any clues either.
Any help would be greatly appreciated. Thanks.
Found how to do it. I was missing a IPPLine object to tie the Payment and LinkedTxn objects together. This is what worked:
$qbLinkedInvoice = new IPPLinkedTxn();
$qbLinkedInvoice->TxnId = 277;
$qbLinkedInvoice->TxnType = 'Invoice';
$qbLine = new IPPLine();
$qbLine->Amount = 10.0;
$qbLine->LinkedTxn = $qbLinkedInvoice;
$qbPayment = new IPPPayment();
$qbPayment->CustomerRef = 164;
$qbPayment->TotalAmt = 10.0;
$qbPayment->Line = [$qbLine];
$createdQbPayment = $this->dataService->Add($qbPayment);
Refer to the example here is you are using PHP official SDK, you can just pass an array to create Invoice and Payment:
https://github.com/intuit/QuickBooks-V3-PHP-SDK
Related
I'm currently using square/connect-php-sdk createOrder to create a Square Order.
$api_config = new SquareConnect\Configuration();
$api_config->setAccessToken($access_token);
$api_config->setHost($host);
$api_client = new SquareConnect\ApiClient($api_config);
$apiInstance = new SquareConnect\Api\OrdersApi($api_client);
$orderRequest = new SquareConnect\Model\CreateOrderRequest();
$orderRequest->setIdempotencyKey(uniqid());
$order = new SquareConnect\Model\Order();
$money = new SquareConnect\Model\Money();
$money->setAmount(intval(500))
->setCurrency("USD");
$line_item = new SquareConnect\Model\OrderLineItem();
$line_item->setCatalogObjectId(<square item id>)
->setQuantity("1")
->setBasePriceMoney($money);
$line_items[] = $line_item;
$order->setLineItems($line_items);
$orderRequest->setOrder($order);
$result = $apiInstance->createOrder($location_id, $orderRequest);
This returns an Order ID (along with other order data) which I store locally.
I then process a credit card using the Square Payment Form: https://developer.squareup.com/docs/payment-form/payment-form-walkthrough
This gives me a nonce which I then send with the Order ID and the price.
$apiInstance = new SquareConnect\Api\PaymentsApi($api_client);
$paymentRequest = new SquareConnect\Model\CreatePaymentRequest();
$paymentRequest->setIdempotencyKey(uniqid());
$paymentRequest->setLocationId($location_id);
$money = new SquareConnect\Model\Money();
$money->setAmount(intval($total_cost))
->setCurrency("USD");
$paymentRequest->setAmountMoney($money);
$paymentRequest->setOrderId($sq_order_id);
$paymentRequest->setSourceId($nonce);
$result = $apiInstance->createPayment($paymentRequest);
This gives me a Payment ID (along with other payment data).
On the Square Dashboard, I am able to see the transaction in the Transactions section, but the Orders section of the dashboard is empty.
My question is How do I get it to show in the Orders section?
In order for the order to show up in your dashboard you need to do two things:
1. Pay for the order (it sounds like you did this part)
2. Include a fulfillments parameter in the CreateOrder request: https://developer.squareup.com/docs/orders-api/order-ahead-usecase#add-fulfillment-information-to-make-a-pickup-order
I am using paypal adaptive payments for my website. I have many sellers and different products. when I am as a user try to buy any product from my website then I can't see product name in Paypal form summary instead there is the name and surname of the seller.
Let me know please which parameter is being used to Pass product name ..
Here is the screenshot
With Adaptive Payments you can't send itemized details in the Pay request itself. Instead, you have to call Pay like usual, but then follow that up with a call to SetPaymentOptions. With that you'll pass in the PayKey you get back from the Pay request, and then you can setup all the additional details like itemized info that SetPaymentsOptions provides.
Then you would redirect to PayPal after that, and it should show you what you're after.
With Adaptive Payments, the item details you set with SetPaymentOptions are only displayed to the customer via Embedded flow.
The Embedded flow uses either a lightbox or a minibrowser for the checkout pages.
Here’s a technical instruction on how to implement the embedded flow in your front-end page, https://developer.paypal.com/docs/classic/adaptive-payments/ht_ap-embeddedPayment-curl-etc/
I am having the same issue. It looks like it works only in an Embedded Payment Flow.
Embedded Payment Flow Using Adaptive Payments
$receiverOptions = new PayPal\Types\AP\ReceiverOptions();
$setPaymentOptionsRequest->receiverOptions[] = $receiverOptions;
$receiverOptions->description = 'Description';
$invoiceItems = array();
$item = new PayPal\Types\AP\InvoiceItem();
$item->name = 'Item Name';
$item->price = 10;
$item->itemPrice = 10;
$item->itemCount = 1;
$invoiceItems[] = $item;
$receiverOptions->invoiceData = new PayPal\Types\AP\InvoiceData();
$receiverOptions->invoiceData->item = $invoiceItems;
$receiverId = new PayPal\Types\AP\ReceiverIdentifier();
$receiverId->email = 'email#domain.com';//Change it
$receiverOptions->receiver = $receiverId;
$setPaymentOptionsRequest->payKey = $_POST['payKey'];
$servicePaymentOptions = new PayPal\Service\AdaptivePaymentsService($config);
try {
/* wrap API method calls on the service object with a try catch */
$responsePaymentOptions = $servicePaymentOptions->SetPaymentOptions($setPaymentOptionsRequest);
print_r($responsePaymentOptions); die;
} catch(Exception $ex) {
//error
}
if (isset($responsePaymentOptions) && $responsePaymentOptions->responseEnvelope->ack == "Success")
{
//Success
}
This is the essential bit of PHP:
// Add subscription
$subscription = new Recurly_Subscription();
$subscription->plan_code = $planCode;
$subscription->currency = 'USD';
$subscription->quantity = 1;
if ($couponCode != "") { $subscription->coupon_code = $couponCode; }
$subscription->account = new Recurly_Account();
$subscription->account->account_code = $customerID;
$subscription->billing_info = new Recurly_BillingInfo();
$subscription->account->billing_info->token_id = $token;
$subscription->create();
When this code runs, $token has the tokenID created by an earlier call to recurly.token (...) with the billing info.
The account already exists on Recurly -- the account ID, first and last names, but no billing info. This is because we allow people to signup for a complimentary service before subscribing. So I want to create the subscription on the extant account. Initially, following the code examples, the create() call was subscription->account->create(). But that failed because the account existed already.
This sounds like an issue with the old PHP library, which did not support tokenization of billing information. An upgrade to the PHP client library should fix this issue.
I use Payum stable version 0.13 and Zend framework v2 for make payments via AuthorizeNet.
My code for test:
$storage = $this->getServiceLocator()
->get('payum')
->getStorage('LowbiddoPayment\Entity\AgreementDetails');
$details = $storage->create();
$details['currency'] = 'USD';
$details['amount'] = 100;
$details['card_num'] = new SensitiveValue('4111111111111111');
$details['exp_date'] = new SensitiveValue('10/16');
$details['description'] = 'Test';
$storage->update($details);
$this->getServiceLocator()
->get('payum.security.token_factory')
->setUrlPlugin($this->url());
$doneUrl = $this->url()->fromRoute('payment_done', array('id' => $orderId), array('force_canonical' => true));
$captureToken = $this->getServiceLocator()
->get('payum.security.token_factory')
->createCaptureToken('authorize-net-aim', $details, $doneUrl);
I have this error
/vendor/payum/payum/src/Payum/AuthorizeNet/Aim/Action/CaptureAction.php:58
Credit card details has to be set explicitly or there has to be an action that supports ObtainCreditCard request.
How can I fix it?
Thanks!
PayumModule does not provide (yet) a built-in ObtainCreditCardAction. So there are two ways to go.
You can ask for credit card information yourself. Like create a form than render it. User fills it and submit. You get that info and pass it to Payum with the rest of information. Authorize.Net AIM asks for 'card_num', 'exp_date' fields.
The other way is to create a zend specific ObtainCreditCardAction and add it to Payment object using addAction method. Here's an example of ObtainCreditCardAction for Symfony: https://github.com/Payum/Payum/blob/master/src/Payum/Core/Bridge/Symfony/Action/ObtainCreditCardAction.php
$proxy = new SoapClient('http://magentolocal.com/mag/api/soap/?wsdl');
$sessionId = $proxy->login('test', 'test123');
$getorderid = "100000054";
$getdetails = $proxy->call($sessionId, 'sales_order.info', $getorderid);
print_r($getdetails);
it is return an array, it contain a payment_id,so where can i pass a payment_id and get a payment information of that order.
Magento don't have API methods to work with payments, but there is some usefull methods to work with invoices - http://www.magentocommerce.com/wiki/doc/webservices-api/api#mage_sales