PayPal phone number not shown (using PP php sdk) - php

We have the following code to transfer our buyer's details to the PayPal:
$ShippingAddr = new AddressType;
// more code ...
$ShippingAddr->Phone = $_userdata['user_phone'];
$BillingAddr = new AddressType;
// more code ...
$BillingAddr->Phone = $_userdata['user_phone'];
$setECReqDetails = new SetExpressCheckoutRequestDetailsType();
// more code ...
$setECReqDetails->Address = $ShippingAddr;
$setECReqDetails->BillingAddress = $BillingAddr;
$setECReqType = new SetExpressCheckoutRequestType();
$setECReqType->Version = '104.0';
$setECReqType->SetExpressCheckoutRequestDetails = $setECReqDetails;
$setECReq = new SetExpressCheckoutReq();
$setECReq->SetExpressCheckoutRequest = $setECReqType;
$setECResponse = $paypalService->SetExpressCheckout($setECReq);
Working fine apart from the phone number which remains empty on PayPal checkout site.
Any idea what we did wrong?

I believe you are trying to get users information as per this webservice. https://developer.paypal.com/docs/api/#get-user-information
So you should call it this way according to the paypal doc,
$_userdata['phone_number'];

Related

EWS CreateAttachment API call not working

I'm currently facing some problems with the CreateAttachment API call in EWS 2010. We are using PHP 5.5 with curl 7.49.1.
We are currently using the following little script to test this issue:
$ewswrapper = new EWSWrapper($host, $user, $pass);
try {
// See examples:
//
// http://jamesarmes.com/php-ews/doc/0.1/examples/contact-set-update-photo.html
// https://github.com/jamesiarmes/php-ews/blob/master/examples/contact/set-photo.php
$picture = base64_decode(" ... some valid base64 image ... ");
$attachment = new EWSType_FileAttachmentType();
$attachment->IsContactPhoto = true;
$attachment->Content = $picture;
$attachment->Name = "ContactPicture.jpg";
$attachment->ContentType = "image/png";
// Create the attachment request
$attRequest = new EWSType_CreateAttachmentType();
$attRequest->ParentItemId = new EWSType_ItemIdType();
$attRequest->ParentItemId->Id = " ... some ItemId of a contact ... ";
$attRequest->ParentItemId->ChangeKey = " ... some ChangeKey of the contact ... ";
$attRequest->Attachments = new EWSType_NonEmptyArrayOfAttachmentsType();
$attRequest->Attachments->FileAttachment = [];
$attRequest->Attachments->FileAttachment[] = $attachment;
$ewswrapper->service->CreateAttachment($attRequest);
} catch (Exception $e) {
var_dump($e->getMessage());
}
The returned status code of the response is 100. As far as we can tell, the response is empty. Dumping the request before sending it shows us a valid xml output that should theoretically work. We have checked both the official Microsoft documentation at https://msdn.microsoft.com/en-us/library/office/aa565931(v=exchg.140).aspx and the API examples at http://jamesarmes.com/php-ews/doc/0.1/examples/contact-set-update-photo.html.
Other requests to the API work perfectly. We can create, update, query and delete just fine, it seems to be this request specifically which fails.
We would highly appreciate any pointers into the right direction! Thanks in advance! If more information is needed regarding the code, infrastructure, etc, please ask!

Quickbooks Php SDK - CheckNullResponseAndThrowException - Response Null or Empty

Please kindly assist me on below error:
2015-04-16 10:45:10 - D:\projects\QuickBooksv3-php-sdk-2.0.5\DataService\DataService.php - 340 - CheckNullResponseAndThrowException - Response Null or Empty
3 days ago, I had successfully test quickbooks php sdk.
But today when I going to integrate with system, it hit error.
The code is same as 3 days ago.
Here is my code:
//Create new invoice
$invoiceObj2 = new IPPInvoice();
$invoiceObj2->DocNumber="1025";
//Add customer
$customerRef2= new IPPReferenceType();
$customerRef2->value= "1";
$invoiceObj2->CustomerRef= $customerRef2;
//Create Line
$line2 = new IPPLine();
$line2->Amount= 1*90.84;
$linetype2= new IPPLineDetailTypeEnum();
$linetype2->value="SalesItemLineDetail";
$lineDetail2 = new IPPSalesItemLineDetail();
$lineDetail2->ItemRef = "4";
$lineDetail2->UnitPrice = 90.84;
$lineDetail2->Qty= 1;
$line2->DetailType=$linetype2;
$line2->SalesItemLineDetail=$lineDetail2;
$invoiceObj2->Line=$line2;
$resultingInvoiceObj2 = $dataService->Add($invoiceObj2);
echo "Created Invoice Id={$resultingInvoiceObj2->Id}. Reconstructed response body:<br/><br/>";
$xmlBody = XmlObjectSerializer::getPostXmlFromArbitraryEntity($resultingInvoiceObj2, $urlResource);
echo "<pre>";
echo $xmlBody . "<br/>";
echo "</pre>";
Please kindly help to point out my mistake. Thanks
Please change the base url for using sandbox QBO account or use production tokens for connecting to existing QBO accounts.
Your issue might be related to this change-https://developer.intuit.com/v2/blog/2014/10/24/intuit-developer-now-offers-quickbooks-sandboxes
You can also try changing the values and then try integrating into QB
I have solved same problem checking required params. Please check required fields.
Required fields are at least:
DocNumber
TxnDate
CustomerRef
at least one Line record
Line.DetailType
Line.Amount
Line.Description
at least one Line.SalesItemLineDetail
Line.SalesItemLineDetail.ItemRef
Line.SalesItemLineDetail.Quantity
Line.SalesItemLineDetail.UnitPrice
I have modified your code and run. Its working
Final modified code:
//Create new invoice
$invoiceObj2 = new IPPInvoice();
$invoiceObj2->DocNumber="1025";
$invoiceObj2->TxnDate = "2016-10-19";
//Add customer
$customerRef2= new IPPReferenceType();
$customerRef2->value= "1";
$invoiceObj2->CustomerRef= $customerRef2;
//Create Line
$line2 = new IPPLine();
$line2->Amount= 1*90.84;
$Line2->Description = 'Test Product';
$linetype2= new IPPLineDetailTypeEnum();
$linetype2->value="SalesItemLineDetail";
$lineDetail2 = new IPPSalesItemLineDetail();
$lineDetail2->ItemRef = "4";
$lineDetail2->UnitPrice = 90.84;
$lineDetail2->Qty= 1;
$line2->DetailType=$linetype2;
$line2->SalesItemLineDetail=$lineDetail2;
$invoiceObj2->Line=$line2;
$resultingInvoiceObj2 = $dataService->Add($invoiceObj2);
echo "Created Invoice Id={$resultingInvoiceObj2->Id}. Reconstructed response body:<br/><br/>";
$xmlBody = XmlObjectSerializer::getPostXmlFromArbitraryEntity($resultingInvoiceObj2, $urlResource);
echo "<pre>";
echo $xmlBody . "<br/>";
echo "</pre>";

php - PayPal Express Checkout Item name and number

Why isn't the item name and number not being submitted with the DoExpressCheckout?
Here is what I am sending:
// Single-item purchase
$nvps["METHOD"] = "SetExpressCheckout";
$nvps["RETURNURL"] = "http://www.domain.com/angelpaypal/test/success.php"; // server
$nvps["CANCELURL"] = "http://www.domain.com/angelpaypal/test/fail.php"; // server
$nvps["PAYMENTREQUEST_0_PAYMENTACTION"] = "Sale";
$nvps["PAYMENTREQUEST_0_NOTIFYURL"] = "http://www.domain.com/includes/ipn/paypal/config/ipn-listener.php";
$nvps["PAYMENTREQUEST_0_AMT"] = "$Price";
$nvps["PAYMENTREQUEST_0_CURRENCYCODE"] = "USD";
$nvps["PAYMENTREQUEST_0_ITEMAMT"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_NAME0"] = "$Desc";
$nvps["L_PAYMENTREQUEST_0_NUMBER0"] = "$Item";
$nvps["L_PAYMENTREQUEST_0_AMT0"] = "$Price";
$nvps["L_PAYMENTREQUEST_0_QTY0"] = "1";
$nvps["L_PAYMENTREQUEST_0_ITEMCATEGORY0"] = "Digital"; // specific to Digital Goods
Below is the response:
TOKEN = EC-7RN61912TS2838617
SUCCESSPAGEREDIRECTREQUESTED = false
TIMESTAMP = 2014-03-07T19:16:39Z
CORRELATIONID = b65c4f8669542
ACK = Success
VERSION = 109.0
BUILD = 9917844
INSURANCEOPTIONSELECTED = false
SHIPPINGOPTIONISDEFAULT = false
PAYMENTINFO_0_TRANSACTIONID = 3PF8162359151561E
PAYMENTINFO_0_TRANSACTIONTYPE = expresscheckout
PAYMENTINFO_0_PAYMENTTYPE = instant
PAYMENTINFO_0_ORDERTIME = 2014-03-07T19:16:39Z
PAYMENTINFO_0_AMT = 5.00
PAYMENTINFO_0_FEEAMT = 0.45
PAYMENTINFO_0_TAXAMT = 0.00
PAYMENTINFO_0_CURRENCYCODE = USD
PAYMENTINFO_0_PAYMENTSTATUS = Completed
PAYMENTINFO_0_PENDINGREASON = None
PAYMENTINFO_0_REASONCODE = None
PAYMENTINFO_0_PROTECTIONELIGIBILITY = Ineligible
PAYMENTINFO_0_PROTECTIONELIGIBILITYTYPE = None
PAYMENTINFO_0_SECUREMERCHANTACCOUNTID = KEPBS3TF5VPSL
PAYMENTINFO_0_ERRORCODE = 0
PAYMENTINFO_0_ACK = Success
As yuo can see, I am specifying item name and number, although in the response above, I don't see these fields - I want to use them in the IPN (NOTIFYURL) I've added
What you've shown here is SetExpressCheckout. Setting the items here will only make them show up on the PayPal review page during checkout. It will not carry all the way through to the final transaction unless you include those same itemizes details in the DoExpressCheckoutPayment request.
DECP is the end all, be all. Whatever gets sent with that is what ends up in the final PayPal details.

How to create an addon domain using xmlapi-php?

I am trying to create an addon domain using xmlapi-php. I have a shared hosting account.
This sample code is from github
<?php
include '../xmlapi.php';
$ip = getenv('REMOTE_HOST');
$root_pass = getenv('REMOTE_PASSWORD');
$domain = "somedns.com";
$xmlapi = new xmlapi($ip);
$xmlapi->password_auth("root",$root_pass);
$xmlapi->set_http_client('curl');
$xmlapi->set_port(2086);
$xmlapi->set_debug(1);
print $xmlapi->adddns($domain,$ip);
?>
I am having trouble getting this code to work to create an addon domain. How can it be done?
Well I've figured it out to the best of my ability and here is the solution for all the lost souls out there:
Authentication
You need run the following code at least once for authentication and xml api wrapper:
// AUTHENTICATION -------------------------
include("xmlapi.php");
$host = "Host ip address or Site.com";
$my_user = "Your cPanel user ID";
$my_pass = "Your cPanel password";
$xmlapi = new xmlapi($host);
$xmlapi->set_port(2083);
$xmlapi->password_auth($my_user, $my_pass);
$xmlapi->set_output('json');
$xmlapi->set_debug(1);
Now you can start using the functions provided in the xmlapi.php but you are not limited to them.
Email Creation Example
// Calling on the function "addpop" "email_user#email_domain" -------------------------
$email_user = "apitest";
$email_password = "adfm90f";
$email_domain = "somesite.com";
$email_query = '10';
$email_quota = '600';
//$result will be set equal to the JSON output returned by the call
//api1_query is the function
//in the array is where you pass the required parameters
$result = $xmlapi->api1_query($my_user, "Email", "addpop",
array($email_user, $email_password, $email_quota, $email_domain));
Displaying the results
$result = json_decode($result, true); //Decoding the JSON results to PHP
print_r($result); //Printing the array onto the page
//example of displaying a particular array key, in this example its "result"
echo $result['data']['result'];

Using Zend Google data api to add Google Calendar event with attendee/guest value

I am trying to make a privet application with php on zend google data api. I need to create events from a script. The problem I am facing is, I cannot add guest/attendee/participant from the script on the event. Actually I couldn't find the correct parameter.
The function I am using:
function createEvent ($client, $title = 'Tennis with Beth',
$desc='Meet for a quick lesson', $where = 'On the courts',
$startDate = '2008-01-20', $startTime = '10:00',
$endDate = '2008-01-20', $endTime = '11:00', $tzOffset = '-08')
{
$gdataCal = new Zend_Gdata_Calendar($client);
$newEvent = $gdataCal->newEventEntry();
$newEvent->title = $gdataCal->newTitle($title);
$newEvent->where = array($gdataCal->newWhere($where));
$newEvent->content = $gdataCal->newContent("$desc");
$when = $gdataCal->newWhen();
$when->startTime = "{$startDate}T{$startTime}:00.000{$tzOffset}:00";
$when->endTime = "{$endDate}T{$endTime}:00.000{$tzOffset}:00";
$newEvent->when = array($when);
// Upload the event to the calendar server
// A copy of the event as it is recorded on the server is returned
$createdEvent = $gdataCal->insertEvent($newEvent);
return $createdEvent->id->text;
}
I tried to add it by $newEvent->guests,$newEvent->attendees, $newEvent->Participants.
Anybody know the way?
Also it will be helpful if you can also tell me how to choose a calendar with id instead of the primary calendar. Thanks in advance.
You can set this using the following code :-
$who = $gcal->newwho();
$who->setEmail('myEm...#myDomain.com');
$event->setWho(array($who));

Categories