In QBO's v3 API (IPP), do all shipping lines map to the same account? - intuit-partner-platform

When I query an invoice that contains a shipping line, I get:
{
"DetailType": "SalesItemLineDetail",
"Amount": 25.0,
"SalesItemLineDetail": {
"ItemRef": {
"value": "SHIPPING_ITEM_ID"
}
}
}
It looks like in the UI, in Advanced Settings, a shipping account can be selected by a user. What's not immediately clear is if I go in and change it, will all previous transactions that used shipping change to that account too? Or will only new shipping transactions from that point forward hit the new account? That, obviously, will impact the usefulness of the item ID provided by the Invoice query response.
Thank you!
As a reference, a Read on the company's Preferences object includes this information:
"AllowShipping": true,
"DefaultShippingAccount": "277",
I guess it's not immediately clear to me if the item that maps to this income account is generated by the system or was created by the user, but it probably doesn't matter. The real question is whether changes to it propagate to prior transactions.

Ok, so I tested this in one of my company files- I see that shipping line in txns does not refer to any accountref and there is no way of knowing to which account this amount is posted.
However, when I changed the default ship account to something else then Company pref query result shows the new account details.
I will have to check with the QBO product team on this one to find our if all existing txns are also impacted or not.
EDIT: Existing txns are not impacted by changing shipping account.

Related

Stripe integration with iOS: Saving and referencing saved cards

I'm trying to make an app that sells a service, for which users pay based on the amount of time they've used it for, so I don't have a physical shipping address involved.
I want to be able to allow my users to save and then reference saved cards in future transactions. I know the way Stripe tracks a specific customer is through a customer_id, but I'm not sure how to attach a card to a specific customer_id and then reference it in future.
Also, I'm a little confused on the use of ephemeral_keys. Some Stripe tutorials talk about needing these on the server side, and some don't mention them at all, and that leaves me very confused.
This one talks about ephemeral_keys while creating a paymentIntent: https://stripe.com/docs/mobile/ios/basic#
And this one doesn't: https://stripe.com/docs/payments/integration-builder
Any help would be greatly appreciated! Please let me know if you need any more information from me.
PS: If you could also point me to some of the relevant View Controllers Stripe uses to save new cards and display saved cards, I'd be more than grateful!
The flow on https://stripe.com/docs/mobile/ios/basic includes the Customer for your payment context, which will cause the created PaymentMethod to be attached to that Customer. You can verify this after the initial payment by retrieving the PaymentMethod on your backend with your secret key and checking its customer field [0].
If you have a PaymentMethod and want to attach it to a Customer, you'd use the API on the backend [1].
You can retrieve a list of the Customer's existing PaymentMethods via the API [2] on the backed as well (again, with your secret key). Then you can pass a list of their id's and some identifying feature (last 4 digits, as an example) to your app in order to display and let the customer select the one they want to use. Then you take that PaymentMethod's 'id' and use it to create the new payment.
Ephemeral keys are usually only used with the iOS (or Android) SDK's, so when you're using the backend of your integration (i.e. the part that is running on a server somewhere and not distributed with your app) you generally don't need to worry about them.
[0] https://stripe.com/docs/api/payment_methods/retrieve
[1] https://stripe.com/docs/api/payment_methods/attach
[2] https://stripe.com/docs/api/payment_methods/list

Request payment part way through course

I'd like students to be able to access the first couple of lessons in Moodle before being presented with a request for payment. I've searched for ages on Google and found nothing, and also searched for all the possible terms I could think of here, and again come up short. Apologies therefore for the lack of contributing research/evidence.
I'm using Paypal as the chosen method of payment at the moment. Moodle is version 3.2.
Is there a way to add this kind of option to the 'access restrictions' in the courses themselves?
There isn't an existing way to restrict activity access based on the users enrolment type.
Without writing some custom code, the easiest way to do this is probably to have a separate course containing the pay-walled content, with paypal enrolment set up.
Add an activity to the free course with a link to the paid course. Use access restrictions to hide it until the other activities are complete.
When a user completes the free course content, the link to the paid course will be revealed, and they can click to enrol using paypal.

Getting country data from PayPal transaction export, or API

The "country" field in the PayPal transaction history CSV exports is almost always empty. However, PayPal must know the country where a transaction originates, and in fact tools such as Putler can display the country for nearly all transactions.
I wish to obtain this data myself, but since the export doesn't appear to have it, should I obtain it by using the API? And which of the APIs wold be appropriate to use for this purpose?
Thanks in advance.
Yes you can probably do this using the API. First you'll need to search your account's transaction history. After that you'll get a list of transaction ID's, you can then retrieve information about a specific ID which includes the country code of the buyer.
You can see more details here: https://developer.paypal.com/docs/classic/express-checkout/ht_searchRetrieveTransactionData-curl-etc/

PayPal callback API NO_SHIPPING_OPTION_DETAILS ignored

I'm using the callback API to prevent someone selecting a non-UK shipping address. I've supplied a callback url, I've set CALLBACKVERSION to 61.0.
When I go into the sandbox and choose an address I know the callback page is being called as I've added code to email me the values submitted to it and the value returned to PayPal. For anything with a SHIPTOCOUNTRY that isn't GB the response is
METHOD=CallbackResponse&NO_SHIPPING_OPTION_DETAILS=1
I've also tried setting a fuller response in case it doesn't like some required field to be missing
METHOD=CallbackResponse&CURRENCYCODE=GBP&L_SHIPPINGOPTIONNAME0=Standard&L_SHIPPINGALABEL0=Standard&L_SHIPPINGAMOUNT0=2.95&L_SHIPPINGOPTIONISDEFAULT0=true&L_SHIPPINGOPTIONNAME1=Express&L_SHIPPINGALABEL1=Express&L_SHIPPINGAMOUNT1=5.95&L_SHIPPINGOPTIONISDEFAULT1=false&NO_SHIPPING_OPTION_DETAILS=1
But it's still allowing non-UK addresses and just using the shipping options set during the initial set up request.
Any suggestions on where I'm going wrong?
After opening a ticket as suggested by PayPal_Patrick the problem was that I was adding the callbackversion in the wrong place. The full response to reject a shipping address on callback is:
METHOD=CallbackResponse&NO_SHIPPING_OPTION_DETAILS=1&CALLBACKVERSION=61
There are different transaction ID's for Buyer and Seller accounts.
I think this might be an issue caused by the country associated with the buyer account being used. I'm going to reach out to the product team for Express Checkout and see if it is intended functionality or not - I don't believe it would be.
If you want to stay updated on the issue I would recommend creating a ticket to PayPal.com/mts, give me the ticket number, I'll grab it and keep you involved.

How can I determine if a Zen Cart customer is logged is as admin in checkout?

I need to find out if a customer (during checkout) is also currently logged in as a Zen Cart administrator. The purpose is for allowing certain actions to be available for an administrator placing an order on behalf of a customer (say, by telephone).
My first idea was to check $_SESSION['admin_id'].
However this does not seem to be set, instead $_SESSION['customer_id'] is.
I think this is because different session names are chosen in the admin and customer areas (zenAdminId vs zenid).
How can I find out if this customer would be logged in as an admin, had they been in the admin area at the same time?
I am working on the checkout step prior to sending off to a hosted payment service provider.
Edit: the merchant is logged in as an admin and is entering the customer's details, which are different to those of the admin account, into the checkout screens. It is a customer-not-present/MOTO setup.
You are correct - $_SESSION['customer_id'] is set. And there's nothing in the customer's table which indicates if this person is an admin. However, if they use the same email address for their customer account and for their admin account, you can look up their email in the customers table with $_SESSION['customer_id'], then match that against the admin_email field in the emails in Use this to look up table "admin."
It is worth noting that if your admin cookie isn't restricted by path SESSION_USE_ROOT_COOKIE_PATH=True that you can simply check for the cookie zenAdminID. You can read the contents of this cookie by querying zen_sessions, the sesskey being the value in zenAdminID.
You have to base64_decode the value from the result to get the session. It gives a serialised object, although unfortunately you are unable to use unserialize on it. You can load it as the current $_SESSION but this would overwrite your current one.
I simply did this to get the admin_id:
preg_match('/admin_id\|s:1:"([0-9]+?)"/', $admin_session, $admin_matches);
$admin_matches[1] giving the admin id value.