$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
Related
I would like to test a payment with already created token from the previous transaction, but can't really find a way to do that using SOAP Toolkit API.
I found this in their documentation:
Requesting an On-Demand Transaction
An on-demand transaction is a real-time transaction using the details stored in a customer profile. On-demand transactions that you can request are:
Credit cards—authorization, sale (an authorization and capture), and credit.
Electronic checks—debit and credit.
PINless debits—debit.
To request an on-demand sale transaction:
Step 1 Set the ccAuthService_run service field to true.
Step 2 Set the ccCaptureService_run service field to true.
Step 3 Include the following fields in the request:
merchantID
merchantReferenceCode
purchaseTotals_currency
purchaseTotals_grandTotalAmount
recurringSubscriptionInfo_subscriptionID
So I assumed that recurringSubscriptionInfo_subscriptionID is the token that I need to provide, and wrote this code:
$referenceCode = 'my_merchant_id';
$client = new CybsSoapClient();
$request = $client->createRequest($referenceCode);
// Build a sale request (combining an auth and capture).
$ccAuthService = new stdClass();
$ccAuthService->run = 'true';
$request->ccAuthService = $ccAuthService;
$ccCaptureService = new stdClass();
$ccCaptureService->run = 'true';
$request->ccCaptureService = $ccCaptureService;
$request->merchantID = 'my_merchant_id';
$request->merchantReferenceCode = uniqid();
$request->purchaseTotals_currency = 'USD';
$request->purchaseTotals_grandTotalAmount = '25';
$request->recurringSubscriptionInfo_subscriptionID = 'xxxxxxxx';
$reply = $client->runTransaction($request);
When I first run this code, the API complained that I didn't provide billing info, but I thought that's not necessary cause I provided the token for payment. After adding the billing info, it started complaining about missing credit card number, which doesn't make any sense, cause the whole point is to avoid sending those information and use payment token instead.
I believe you need to enable name-value-pairs in order to provide fields using _ for nesting (e.g: recurringSubscriptionInfo_subscriptionID), when I changed your code to use XML payloads it worked:
// ...
$ccAuthService = new stdClass();
$ccAuthService->run = 'true';
$request->ccAuthService = $ccAuthService;
$ccCaptureService = new stdClass();
$ccCaptureService->run = 'true';
$request->ccCaptureService = $ccCaptureService;
$request->merchantID = '<my merchant id>';
$request->merchantReferenceCode = uniqid();
$recurringSubscriptionInfo = new stdClass();
$recurringSubscriptionInfo->subscriptionID = '<my subscription token>';
$request->recurringSubscriptionInfo = $recurringSubscriptionInfo;
$purchaseTotals = new stdClass();
$purchaseTotals->currency = 'USD';
$purchaseTotals->grandTotalAmount = '100';
$request->purchaseTotals = $purchaseTotals;
// ...
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
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
}
Hello im using paypal express checkout with the merchant sdk.
I have implemented recurring payment using the integration manual, but the given example doesnt make an initial payment(charge the user right away).
My code for making the payment is:
Initializing the payment:
$cart = $this->cart->getCart();
$items = $cart['items'];
$itemTotal = 0;
foreach ($items as $k => $item) {
$product = $this->addItem($item);
$itemTotal += $product->Amount;
$this->paymentDetails->PaymentDetailsItem[$k] = $product;
}
$this->orderTotal->currencyID = 'USD';
$this->orderTotal->value = $this->cart->getCartAmount();
$this->paymentDetails->OrderTotal = $this->orderTotal;
$this->paymentDetails->PaymentAction = 'Sale';
$this->paymentDetails->InvoiceID = $invoice_id->{'$id'};
$setECReqDetails = new \PayPal\EBLBaseComponents\SetExpressCheckoutRequestDetailsType();
$setECReqDetails->PaymentDetails[0] = $this->paymentDetails;
$setECReqDetails->CancelURL = $this->cancelURL;
$setECReqDetails->ReturnURL = $this->returnURL;
$billingAgreementDetails = new \PayPal\EBLBaseComponents\BillingAgreementDetailsType('RecurringPayments');
$billingAgreementDetails->BillingAgreementDescription = 'recurringbilling';
$setECReqDetails->BillingAgreementDetails = array($billingAgreementDetails);
$setECReqType = new \PayPal\PayPalAPI\SetExpressCheckoutRequestType();
$setECReqType->Version = $this->version;
$setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;
$setECReq = new \PayPal\PayPalAPI\SetExpressCheckoutReq();
$setECReq->SetExpressCheckoutRequest = $setECReqType;
return $this->paypalService->SetExpressCheckout($setECReq);
And then on the return url i supplied i create the recurring payment with this code:
$profileDetails = new \PayPal\EBLBaseComponents\RecurringPaymentsProfileDetailsType();
$profileDetails->BillingStartDate = "2014-01-24T00:00:00:000Z";
$paymentBillingPeriod = new \PayPal\EBLBaseComponents\BillingPeriodDetailsType();
$paymentBillingPeriod->BillingFrequency = 10;
$paymentBillingPeriod->BillingPeriod = "Day";
$paymentBillingPeriod->Amount = new \PayPal\CoreComponentTypes\BasicAmountType("USD", "1.0");
$scheduleDetails = new \PayPal\EBLBaseComponents\ScheduleDetailsType();
$activationDetails = new \PayPal\EBLBaseComponents\ActivationDetailsType();
$activationDetails->InitialAmount = new \PayPal\CoreComponentTypes\BasicAmountType('USD', 49);
$activationDetails->FailedInitialAmountAction = 'ContinueOnFailure';
$scheduleDetails->Description = "recurringbilling";
$scheduleDetails->ActivationDetails = $activationDetails;
$scheduleDetails->PaymentPeriod = $paymentBillingPeriod;
$createRPProfileRequestDetails = new \PayPal\EBLBaseComponents\CreateRecurringPaymentsProfileRequestDetailsType();
$createRPProfileRequestDetails->Token = $token;
$createRPProfileRequestDetails->ScheduleDetails = $scheduleDetails;
$createRPProfileRequestDetails->RecurringPaymentsProfileDetails = $profileDetails;
$createRPProfileRequest = new \PayPal\PayPalAPI\CreateRecurringPaymentsProfileRequestType();
$createRPProfileRequest->CreateRecurringPaymentsProfileRequestDetails = $createRPProfileRequestDetails;
$createRPProfileReq = new \PayPal\PayPalAPI\CreateRecurringPaymentsProfileReq();
$createRPProfileReq->CreateRecurringPaymentsProfileRequest = $createRPProfileRequest;
return $this->paypalService->CreateRecurringPaymentsProfile($createRPProfileReq);
}
In my sandbox account i can see that the recurring payment is created, but there is no initial payment.
My question is: How can i setup this recurring payment, so that an initial payment is made?
Hope i`ve explained good my problem. If you need more information comment.
EIDT: My question was how to create a recurring payment with initial payment. and i edited my code snippet. After some reading i saw that i missed to set it up with setting "ActivationDetailsType". I set it up and it works fine with one problem ... The payment profile is pending for 4-5 hours and then comes through. I read in forums and etc... that this was a sandbox issue but unfortunetly i cannot be sure that the payment will not be deleyd. In my case i need the payment to be approved right away. My new question is, when creating recurring payment profile, and the response for the account is ok(succes or what not) and the profile is pending can i count the payment as successful and be sure i`ll get the money for sure
Thank you for the time.
Regards,
Georgi
Quite late but I'm having similar concerns.
My new question is, when creating recurring payment profile, and the response for the account is ok(succes or what not) and the profile is pending can i count the payment as successful and be sure i`ll get the money for sure?
I'm currently working on it but I wouldn't count the pay until PayPal reflects the payment. I would utilize the IPN to trigger actions that should be made when the payment has come through. As for the 4-5 hour processing by PayPal (though sources from the web say production should not have the same delay), I'll just be sure to notify the buyer that his/her payment is still being processed by PayPal.
I have to export the orders to a file, here is my code to go through the orders:
$orders = Mage::getModel('sales/order')->getCollection()
->addAttributeToSelect(array('status', 'ncm'))
->addFieldToFilter(
array(
array('attribute' => 'status', 'eq' => 'complete')
)
);
$order = $orders->getFirstItem();
//print_r($order);
//exit;
//foreach($orders as $order){
$id = $order->getIncrementId();
$payment = $order->getPayment();
$method = $payment->getMethodInstance();
print_r($payment);
//}
I need to print some information about the payment
like the method, the amount, how many months it was split, if was credit card, i need the reutrning id of the transaction and so the list goes on
how can I do that?
I think it will be
$payment = $order->getPayment();
It will retrieve the current order payment instance.
//Get Payment
$payment = $order->getPayment()
//Get card type
$payment->getData('cc_type')
//Get Payment Info
$payment->getMethodInstance()->getCode();
$payment->getMethodInstance()->getTitle();
//Get Credit Card info
$payment->getMethodInstance()->getCardsStorage()
$payment->getMethodInstance()->getCardsStorage()->getCards() //array()
To get the method code only it's far safer to use
$order->getPayment()->getMethod();
Skipping instance object which can generate exception if the payment method was uninstalled.