PayPal IPN Simulator and Sandbox account - ios

Im making an ipn handler for my iOS Application.
Im using classic paypal api with my app.
The thing is when i test from the PayPal IPN Simulator it works fine.
I got the post message below from the simulator (with express checkout i dont remember):
map[
business:[seller#paypalsandbox.com]
item_number1:[AK-1234]
receiver_id:[seller#paypalsandbox.com]
first_name:[John]
mc_shipping1:[1.02]
tax:[2.02]
residence_country:[US]
txn_type:[cart]
mc_shipping:[3.02]
test_ipn:[1]
custom:[xyz123]
mc_handling:[2.06]
mc_handling1:[1.67]
payer_id:[TESTBUYERID01]
payment_status:[Completed]
receiver_email:[seller#paypalsandbox.com]
mc_currency:[USD]
verify_sign:[AdsvkafFyuBADI8IS081RggbvUxmAu2ntBemAGacZ3Dx56qQzmc9QzhK]
address_country:[United States]
item_name1:[something]
mc_fee:[0.44]
address_state:[CA]
mc_gross1:[9.34]
payer_status:[unverified]
last_name:[Smith]
invoice:[abc1234]
payment_date:[07:44:54 23 May 2013 PDT]
address_city:[San Jose]
mc_gross:[12.34]
address_street:[123, any street]
notify_version:[2.4]
txn_id:[298300930]
payer_email:[buyer#paypalsandbox.com]
address_status:[confirmed]
payment_type:[instant]
address_zip:[95131]
address_country_code:[US]
address_name:[John Smith]
]
But when i tried to test with a Sandbox account i got the post message below which also works fine:
map[
fees_payer:[EACHRECEIVER]
transaction[0].id:[89799058XE923193M]
verify_sign:[AE6aVMFpE6M3pfCoNe9gPQ4pMixOA9NNUFbTWPTrOik1CqrdIVxc3K3M]
pay_key:[AP-9DJ400382D973781B]
transaction[0].id_for_sender_txn:[8MC20151R46812309]
transaction[0].status:[Completed]
action_type:[PAY]
transaction[0].is_primary_receiver:[false]
sender.useCredentials:[true]
transaction[0].pending_reason:[NONE]
transaction[0].amount:[USD 29.00]
payment_request_date:[Thu May 23 07:46:49 PDT 2013]
reverse_all_parallel_payments_on_error:[false]
test_ipn:[1]
status:[COMPLETED]
transaction[0].status_for_sender_txn:[Completed]
transaction[0].paymentType:[SERVICE]
notify_version:[UNVERSIONED]
transaction[0].receiver:[mail-facilitator#something.com]
return_url:[http://www.paypal.com]
log_default_shipping_address_in_transaction:[false]
charset:[windows-1252]
cancel_url:[http://www.paypal.com]
transaction_type:[Adaptive Payment PAY]
ipn_notification_url:[http://something.com/ipnhandler/]
]
But as you can see there is no similarity between these two and there isn't anything usefull for me here.
With simulator i got payer name , email etc. but with using a Sandbox account i think i only notify myself that i got a payment.
I wonder why is this happening and is it gonna be like this when the app live.

A little late, but yes, the IPNs that are being sent as a result of adaptive payments are different because the transaction is different. For example, since there can be multiple receivers, having a single receiver_id field wouldn't make sense. Paypal provides an overview of all fields and possible values: https://developer.paypal.com/docs/classic/adaptive-payments/integration-guide/APIPN/

Related

Error using ActiveMerchant::Billing::AuthorizeNetCimGateway with Authorize.Net's opaqueData

Feb 8, 2018
My Ruby on Rails application has been successfully using ActiveMerchant::Billing::AuthorizeNetCimGateway with the payment type :credit_card for creating a customer profile with an embedded payment profile.
I'm now in the process of migrating to Authorize.Net's Accept.js which accepts credit card info directly sent from their hosted payment form and returns a payment nounce of type COMMON.ACCEPT.INAPP.PAYMENT that can be used for one time to create a payment transaction, customer profile, etc.
I constructed a payment_profile hash with :opaque_data in place of :credit_card. For example:
> payment_profile
=> {:payment=>
{:opaque_data=>
{:data_descriptor=>"COMMON.ACCEPT.INAPP.PAYMENT",
:data_value=> "eyJjb2RlIjoiNTBfMl8wNjAwMDUzNjBDMzAwOUQ3OEUzOUQ1MDk4QTYxMjFGNzlCQ0Y3RDRGQUE4NTNCMEU3MkYyMUJBNTI3NUE0NjQ2Q0ZFQTVFNzMxMDI2Qjg5ODJGNjBFRUE2RDZFMTZCMUY5NzQ4NUJFIiwidG9rZW4iOiI5NTE4MDc3Njg5NDA4MTAwOTAzNTAyIiwidiI6IjEuMSJ9"}},
:bill_to=>{:first_name=>"Firstname", :last_name=>"Lastname", :address=>nil, :city=>nil, :state=>nil, :zip=>nil, :country=>nil, :phone_number=>"(012) 234-5678"}}
I then tried to create a customer profile with an existing code similar to the following:
response = #gateway.create_customer_profile profile: {
email: client.email,
description: client.name,
merchant_customer_id: client.id,
payment_profiles: payment_profile
}
However, I received a response which had a result_code of Error and complained about "incomplete content" for element payment as follows:
> response
=> #<ActiveMerchant::Billing::Response:0x007f9827d14900
#authorization=nil,
#avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
#cvv_result={"code"=>nil, "message"=>nil},
#emv_authorization=nil,
#error_code="E00003",
#fraud_review=nil,
#message=
"The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.",
#params=
{"messages"=>
{"result_code"=>"Error",
"message"=>
{"code"=>"E00003",
"text"=>
"The element 'payment' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has incomplete content. List of possible elements expected: 'creditCard, bankAccount, trackData, encryptedTrackData, payPal, opaqueData, emv' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'."}}},
#success=false,
#test=true>
I have a few questions in my mind:
Does ActiveMerchant::Billing::AuthorizeNetCimGateway even support Accept.js' :opaque_data in place of :credit_card?
If ActiveMerchant::Billing::AuthorizeNetCimGateway does support :opaque_data, what's may be wrong with the above payment_profile and what other content that I'd need to provide for payment element?
I'd appreciate any help in resolving this issue.
While this question is over 4 years old, and I'm assuming you have either found a solution or abandoned your effort, I ran into this same issue recently, and thought it would be helpful to add my findings in case someone else runs into this.
the AuthorizeNetCimGateway does not currently support Accept.js' opaqueData. In looking at the sourcecode for the active_merchant gem, specifically in /lib/active_merchant/billing/gateways/authorize_net_cim.rb, there is ultimately a method add_payment_profile that gets called. In that method, specifically on lines 759-761, you can see that the options are either a credit_card, bank_account, or drivers_license. A tokenized payment is not currently supported.
That being said, there is an open PR#2422 that adds support for this. At the time of writing this, it appears to be failing some rubocop specs, but hopefully it can get deployed in the near future!

Gmail API, Reply to thread not working / forwarding

I'm using the google gmail api in swift. All is working well, it's compiling etc.
I'm now trying forward an email, the only way I see this possible so far is by using a thread id.
So I'm using the API tester found here to send tests. Will will focus on this. It can be found here1
So I've input this, the "raw" is Base64 URL encoded string.
{
"raw": "VG86ICBlbWFpbFRvU2VuZFRvQGdtYWlsLmNvbSAKU3ViamVjdDogIFRoZSBzdWJqZWN0IHRlc3QKSW4tUmVwbHktVG86ICBteUVtYWlsQGdtYWlsLmNvbQpUaHJlYWRJZDogIDE1YjkwYWU2MzczNDQ0MTIKClNvbWUgQ29vbCB0aGluZyBpIHdhbnQgdG8gcmVwbHkgdG8geW91ciBjb252by4u",
"threadId": "15b90ae637344412"
}
The "raw" in plain text is
To: emailToSendTo#gmail.com
Subject: The subject test
In-Reply-To: myEmail#gmail.com
ThreadId: 15b90ae637344412
Some Cool thing i want to reply to your convo..
when I execute it I get this back
{
"id": "15b944f6540396df",
"threadId": "15b90ae637344412",
"labelIds": [
"SENT"
]
}
But when I check both email account, from and to. None of them say the previous messages but are in the same "thread" or convo.
If anyone can help it would be much appreciated I've spent all day on this issue and half of yesterday and did TONS of research on it.
as stated here I should I'm adding the threaded and In-Reply-To in the right way I believe
The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met:
The requested threadId must be specified on the Message or Draft.Message you supply with your request.
The References and In-Reply-To headers must be set in compliance with the RFC 2822 standard.
The Subject headers must match.

How to set Vendor Tax ID and 1099 Eligibility in API?

I'm currently using Consolibyte's PHP QB classes to interface with the QB api.
I've been successfully creating and updating Vendor's in QB for a while. However, we have a new requirement to use the API to store vendor's tax information.
I've tried to lookup the correct syntax to set these, but have been unsuccessful thus far.
My most recent attempt was:
$Vendor->setVendorTaxIdent($provider->taxId);
$Vendor->setIsVendorEligibleFor1099(true);
The rest of the information set gets updated properly, and the return from
$result = $VendorService->update($this->context, $this->realm, $provider->vendorId, $Vendor);
seems to indicate success.
Please let me know if you need anymore context. Thanks!
Have you referred to the documentation?
https://developer.intuit.com/docs/api/accounting/Vendor
The documentation indicates:
TaxIdentifier: String, max 20 characters
Vendor1099: Boolean
The geters and seters exactly mirror the documented fields. So unsurprisingly, you'll have these methods:
$Vendor->setTaxIdentifier($string);
$string = $Vendor->getTaxIdentifier();
And:
$Vendor->setVendor1099($boolean);
$boolean = $Vendor->getVendor1099();
If you continue to have trouble, make sure you post the XML request you're sending to QuickBooks. You can get this by doing:
print($VendorService->lastRequest());
print($VendorService->lastResponse());

Google Wallet for digital goods stopped working

We are trying to integrate Google Wallet for digital goods with or php app and 2 days ago, on 15 November we've managed to get it working. However, when checking again the next day and even today, although the code remained the same, we didn't change a letter in it, it is still not working, giving us this error:
Uh oh. There was a problem.
We couldn't complete your purchase because of a technical issue.
Details of the problem below: Unfortunately, we could not confirm your purchase with the merchant's server. Your order has been canceled. Please contact the merchant if this problem continues.
The code we're using is this:
$response = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents("php://input");
$response = substr_replace($response, "", 0, 4); //remove "
$response = JWT::decode($response, $sellerSecretKey);
header("HTTP/1.1 200 OK");
and like I said it worked fine two days ago and I have the feeling it's working now also, because in our log file we get printed this response
stdClass Object
(
[iss] => Google
[request] => stdClass Object
(
[name] => Product 1.
[description] => You are purchasing a total of 1 products from our Store. Thank you.
[price] => 9.99
[currencyCode] => USD
[sellerData] => client name,email address
)
[response] => stdClass Object
(
[orderId] => GWDG_S.c7a66f5b-4674-43f0-be16-2b72f69a7445
)
[typ] => google/payments/inapp/item/v1/postback/buy
[aud] => 03083876603093172875
[iat] => 1384689627
[exp] => 1384689647
)
The postback url is correctly specified and we are using sandbox to do the tests.
Is this a problem from Google? Are they working on the software or something and this is what's causing the problem? Or are we doing something wrong here?.
Any help would be much apreciated. Thank you.
Meant to comment but it won't fit...
That error points to something in your Postback handler. I just tried sandbox and things seem fine.
I'm not a php dev so this maybe inaccurate - are you responding to Postback with the orderId? Again, this is only based on my read of the code above (I think I only see http 200?)
The only other thing I can think of is that the lag for you to respond is more than 10 seconds(?) - which could explain why could be another reason you have logged data, but Google still cancelled it.
*Strike through text: you'd get data to log because Google will send you the data, it's whether or not you respond properly that matters
Once you decode the JWT with your Seller Secret, you can make sure that the cake purchase is OK and record it. Within 10 seconds of receiving the postback, your server must send a 200 OK response where the only content is the value of the "orderId" field. If it doesn't, Google cancels the transaction.
REF: https://developers.google.com/commerce/wallet/digital/docs/postback#responding
Hth.

How do I fetch orgusers beyond the 1st 100 using the Google Apps OrgUser provisioning API feed

I am using Zend's gdata library for the Google Apps provisioning API. Since Zend doesn't yet support fetching org users (no retrieve function provided by the library for this feed), I am making a custom gdata query to the url (as suggested in the documentation developers.google.com/google-apps/provisioning/#retrieving_organization_users_experimental):
apps-apis.google.com/a/feeds/orguser/2.0/'.$customerId.'?get=all
This works well for <= 100 users.
Now, I have created a domain with 125 users across 5 OUs. When I fetch the above URI, I get the 1st 100 users (as documented and expected). However, I could not find the pagination link mentioned here: developers.google.com/google-apps/provisioning/reference#Results_Pagination
Here's the start of my orguser feed:
<?xml version='1.0' encoding='UTF-8'?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:apps='http://schemas.google.com/apps/2006'><id>https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx</id><updated>2013-01-06T08:17:43.520Z</updated><**link rel='next' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn.**'/><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxx'/>
I tried the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all&startKey=RASS03jtnz0s2orxmbn. link but it gives me the exact same 100 users that the https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxxx?get=all link gives. This is the only occurrence of the word "next" in my feed and so there is not other URI I can try to fetch the next 25 users.
So I have only been able to get 100 users from this API call. How do I go about fetching the next 25 users? Examples/code would be really appreciated. Or what am I doing wrong?
Please help - this is blocking an urgent delivery.
Thanks!,
Vinay.
Your 2nd request should look like:
https://apps-apis.google.com/a/feeds/orguser/2.0/C00xxxxxx?startKey=RASS03jtnz0s2orxmbn&get=all
startKey should be set to the value of the next parameter and get should continue to be all for each page request.
Also, make sure the URL is decoded, if & is encoded as & in the request, then Google's servers will see all of all&startKey=RASS03jtnz0s2orxmbn as the value of get and it won't see a startKey parameter at all.

Resources