I'm using the QBFC13 Library to sync QuickBooks and my .NET app.
But I can't seem to find out how can I add a payment to quickbooks from my app.
I've notice that I have this method:
IPaymentMethodAdd paymentMehtodAddRq = requestMsgSet.AppendPaymentMethodAddRq()
But I don't know how to fill the parameters for it to work.
Can somebody please help me with an example of a simple payment passing the: ClientId and the Amount Paid?
Note: I'm using C#.
This is a 2 step process.
Create a bill
Make the Payment
Create a bill;
IMsgSetRequest requestMsgSet = sessionManager.getMsgSetRequest();
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
IBillAdd addBill = requestMsgSet.AppendBillAddRq();
addBill.VendorRef.FullName.SetValue(vendorName);
addBill.TxnDate.SetValue(DateTime.Now);
addBill.DueDate.SetValue(dueDate);
addBill.APAccountRef.FullName.SetValue(accountPayable);
addBill.Memo.SetValue(accountPayableMemo);
IExpenseLineAdd expenceLineAdd = addBill.ExpenseLineAddList.Append();
expenceLineAdd.AccountRef.FullName.SetValue(accountExpenses);
expenceLineAdd.Amount.SetValue(value);
expenceLineAdd.Memo.SetValue(accountExpensesLineMemo);
IMsgSetResponse responseSet = sessionManager.doRequest(true, ref requestMsgSet)
Make the Payment : You can do the payment using cheque or credit card
Credit Card,
IMsgSetRequest requestMsgSet = sessionManager.getMsgSetRequest();
requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;
IBillPaymentCreditCardAdd paymentAdd = requestMsgSet.AppendBillPaymentCreditCardAddRq();
paymentAdd.CreditCardAccountRef.FullName.SetValue("CreditCardAccount");
paymentAdd.PayeeEntityRef.FullName.SetValue("TestVendor");
paymentAdd.TxnDate.SetValue(DateTime.Now);
paymentAdd.Memo.SetValue("test payment credit card");
IAppliedToTxnAdd appliedToTxnAdd = paymentAdd.AppliedToTxnAddList.Append();
appliedToTxnAdd.TxnID.SetValue("7D-1509602561");
appliedToTxnAdd.PaymentAmount.SetValue((double)250.00);
IMsgSetResponse responseSet = sessionManager.doRequest(true, ref requestMsgSet)
See the Onscreen Reference Guide included with the SDK that has the available parameters and fields. http://developer-static.intuit.com/qbsdk-current/common/newosr/index.html
Related
I'm using the PayflowNETAPI class of the PayflowPro API (Payflow_dotNET.dll) to submit a transaction to store credit cards so my company doesn't have to (for PCI Compliant reassons).
I'm using the PNREF from the credit card store transaction to make reference transaction but I keep getting "RESULT=2&PNREF=&RESPMSG=Invalid tender"
I've tried Authorization, Capture, and Sale transactions and they all give the same result. What am I doing wrong?
I've read through the Payflow Gateway Developer Guide and Reference several times (https://developer.paypal.com/docs/classic/payflow/integration-guide/). All the examples for Authorization, Capture, and Sale transactions have the credit card information in the request. There is some small sections that explain and outline credit card uploads but never use the result of the request in a reference transaction.
Below is a sample application and the output
string creditCardUploadRequest = "TRXTYPE=L&TENDER=C&ACCT=4111111111111111&EXPDATE=1218&CVV2=250&BILLTOFIRSTNAME=Homer&BILLTOLASTNAME=Simpson&BILLTOSTREET=350 5th Ave&BILLTOCITY=New York&BILLTOSTATE=NY&BILLTOZIP=10118&BILLTOCOUNTRY=840&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH";
var client = new PayPal.Payments.Communication.PayflowNETAPI(HostAddress: "pilot-payflowpro.paypal.com", HostPort: 443, Timeout: 90);
var ccUploadResponse = client.SubmitTransaction(ParamList: creditCardUploadRequest, RequestId: PayflowUtility.RequestId);
//place the responses into collection
var payPalCollection = new NameValueCollection();
foreach (string element in ccUploadResponse.Split('&'))
{
string[] Temp = element.Split('=');
payPalCollection.Add(Temp[0], Temp[1]);
}
Console.WriteLine("creditCardUploadRequest succeeded = {0}", payPalCollection.Get("RESPMSG") == "Approved");
string authorizationRequest = "TRXTYPE=A&ORIGID=" + payPalCollection.Get("PNREF") + "&INVNUM=ORD123456&AMT=50&COMMENT1=My Product Sale&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH";
var authorizationResponse = client.SubmitTransaction(ParamList: authorizationRequest, RequestId: PayflowUtility.RequestId);
foreach (string element in authorizationResponse.Split('&'))
{
Console.WriteLine(element);
}
Console.WriteLine("\nDONE");
Console.ReadKey();
OUTPUT:
creditCardUploadRequest succeeded = True
RESULT=2
PNREF=A7X08AB571EC
RESPMSG=Invalid tender
DONE
In your second call you are missing the variable "TENDER=C" . Add that and it should be fine .
"string authorizationRequest = "TRXTYPE=A&ORIGID=" + payPalCollection.Get("PNREF") + "&INVNUM=ORD123456&AMT=50&COMMENT1=My Product Sale&USER=<USER>&VENDOR=<VENDOR>&PARTNER=<PARTNER>&PWD=<PASSWORD>&VERBOSITY=HIGH"
Have successfully implemented PayPal.Api.Payments.Payer using:
PayPal.Api.Payments.Address billingAddress = new PayPal.Api.Payments.Address();
...
creditCard.billing_address = billingAddress;
HOWEVER, when I look at the dashboard and go to print packing slip; I see "No Address Provided" and "The sender of this payment is Unregistered".
Does the buyer need to be "registered" with paypal for the shipping information to show up or am I not setting something correctly. I have looked pretty extensively. Billing info is set correctly.
Thank you
Thank you, that worked. Here is my working code for others.
PayPal.Api.Payments.Transaction transaction = new PayPal.Api.Payments.Transaction();
transaction.item_list.shipping_address.city = reader[5].ToString().Trim();
transaction.item_list.shipping_address.line1 = reader[2].ToString().Trim();
transaction.item_list.shipping_address.postal_code = reader[7].ToString().Trim();
transaction.item_list.shipping_address.state = reader[6].ToString().Trim();
transaction.item_list.shipping_address.country_code = reader[20].ToString().Trim();
transaction.amount = amount;
transaction.description = "xxx";
List transactions = new List();
transactions.Add(transaction);
all working now on http://niupure.com
PayPal does not share billing information through transaction details. Because of this, you will need to set the payment.transactions[0].item_list.shipping_address as well as the billing information.
I'm trying to integrate the paypal rest api to my web application. After digging through all available sources I'm stuck.
I'm using the paypal rest api example from here:
GitHub-PayPal-DotNet-Sample
I updated the nuget to the latest sdk version and replaced the cliendId and secret with my own live keys.
Now my problem is, always I choose "credit_card" I get an 401 error response:
{
"name": "UNAUTHORIZED_PAYMENT",
"message": "Unauthorized payment",
"information_link": "https://developer.paypal.com/webapps/developer/docs/api/#UNAUTHORIZED_PAYMENT",
"debug_id": "1d25a990be5db"
}
I set the currency to "CHF" (application runs in Switzerland) and the amount to "0.05" for testing purposes. I also retrieve a valid access token!
Tried various credit cards some belongs to my merchant account some not, still the same error.
With the option "paypal" it seems to work, but I want to offer credit cards directly within the application.
Is something not available in Switzerland? Any suggestions for this problem? Did I overlook something?
Thanks in advance!
Sample Code:
Payment pay = null;
Amount amount = new Amount();
amount.currency = "CHF";
amount.total = "0.05";
Transaction transaction = new Transaction();
transaction.amount = amount;
transaction.description = orderDescription;
List<Transaction> transactions = new List<Transaction>();
transactions.Add(transaction);
FundingInstrument fundingInstrument = new FundingInstrument();
CreditCardToken creditCardToken = new CreditCardToken();
creditCardToken.credit_card_id = GetSignedInUserCreditCardID(email);
fundingInstrument.credit_card_token = creditCardToken;
List<FundingInstrument> fundingInstrumentList = new List<FundingInstrument>();
fundingInstrumentList.Add(fundingInstrument);
Payer payer = new Payer();
payer.funding_instruments = fundingInstrumentList;
payer.payment_method = paymntMethod.ToString(); //credit_card
Payment pyment = new Payment();
pyment.intent = "sale";
pyment.payer = payer;
pyment.transactions = transactions;
pay = pyment.Create(AccessToken);
return pay;
Per this Direct card payment is only supported in the US, UK (look at the page for further requirements for UK).
Using C# , I want to read the Shares , Comments and Likes of a Google + post like this https://plus.google.com/107200121064812799857/posts/GkyGQPLi6KD
That post is an activity. This page includes infomation on how to get infomation about activities. This page gives some examples of using the API. This page has downloads for the Google API .NET library, which you can use to access the Google+ APIs, with XML documentation etc.
You'll need to use the API Console to get an API key and manage your API usage.
Also take a look at the API Explorer.
Here's a working example:
Referencing Google.Apis.dll and Google.Apis.Plus.v1.dll
PlusService plus = new PlusService();
plus.Key = "YOURAPIKEYGOESHERE";
ActivitiesResource ar = new ActivitiesResource(plus);
ActivitiesResource.Collection collection = new ActivitiesResource.Collection();
//107... is the poster's id
ActivitiesResource.ListRequest list = ar.List("107200121064812799857", collection);
ActivityFeed feed = list.Fetch();
//You'll obviously want to use a _much_ better way to get
// the activity id, but you aren't normally searching for a
// specific URL like this.
string activityKey = "";
foreach (var a in feed.Items)
if (a.Url == "https://plus.google.com/107200121064812799857/posts/GkyGQPLi6KD")
{
activityKey = a.Id;
break;
}
ActivitiesResource.GetRequest get = ar.Get(activityKey);
Activity act = get.Fetch();
Console.WriteLine("Title: "+act.Title);
Console.WriteLine("URL:"+act.Url);
Console.WriteLine("Published:"+act.Published);
Console.WriteLine("By:"+act.Actor.DisplayName);
Console.WriteLine("Annotation:"+act.Annotation);
Console.WriteLine("Content:"+act.Object.Content);
Console.WriteLine("Type:"+act.Object.ObjectType);
Console.WriteLine("# of +1s:"+act.Object.Plusoners.TotalItems);
Console.WriteLine("# of reshares:"+act.Object.Resharers.TotalItems);
Console.ReadLine();
Output:
Title: Wow Awesome creativity...!!!!!
URL:http://plus.google.com/107200121064812799857/posts/GkyGQPLi6KD
Published:2012-04-07T05:11:22.000Z
By:Funny Pictures & Videos
Annotation:
Content: Wow Awesome creativity...!!!!!
Type:note
# of +1s:210
# of reshares:158
I have pages that I admin in the Facebook and I want to share a link(not post) from that page using Facebook C# SDK. How can I do that? For clarify question, Facebook pages has link button that you can share link with page's picture.
Simply facebookclient.Post("me/feed",parameters);
For the parameters see https://developers.facebook.com/docs/reference/api/post/
messagePost["message"] = message;
messagePost["caption"] = caption;
messagePost["description"] = descr;
messagePost["link"] = "http://xxx";
FacebookClient fbClient = new FacebookClient(FacebookAdminToken); //users have to accept your app
dynamic fbAccounts = fbClient.Get("/" + FacebookAdminId + "/accounts");
if (pageID != null)
{
foreach (dynamic account in fbAccounts.data)
{
if (account.id == pageID)
{
messagePost["access_token"] = account.access_token;
break;
}
}
dynamic publishedResponse = fbClient.Post("/" + pageID + "/links", messagePost);
message.Success = true;
}
Hope his helps.
there is two majour problems with my solution:
1) my FacebookAdmintoken was created using the soon to be deprecated offline_status. there currently is no way for the access_token to stay alive otherwise. Facebook claims it does, but it just doesn't work.
2) there is a bug in the facebook API. when you use post('/id/LINKS') you cannot specify the picture (FB chooses a random pic from the site) and using post('/id/FEED') people can see the result, but they cannot SHARE it.
Seriously FB, get your act together!!!!!