Magento 2 REST API how to create an order on behalf of customer with Admin or integration token - rest

In our integration with Magento we need to create an order for a customer (not a guest) without the customer token. We're hoping that it is possible using Admin or Integration token.
Every thing works fine up to the point the order needs to be created by posting the payment information.
We only see APIs to do it with customer token (/carts/mine/payment-information) or for guest customer (/guest-carts/{cartId}/payment-information).
Does this means it is not possible to create an order on behalf of a customer using an Admin or Integration token ?
Thank you!

To apply a payment method, you should be able to use the carts/{cartId}/selected-payment-method API. Note that the cartId is the actual int id and not the masked id.
Example PUT payload for {{magentoProtocol}}://{{magentoDomain}}/rest/default/V1/carts/:cartId/selected-payment-method
{
"method": {
"method": "stripe_payments",
"additional_data": {
"cc_stripejs_token": "{{stripePaymentToken}}",
"cc_save": false
}
}
}

Related

Get information about customer without password of user using the Shopware 6 REST API

I am trying to get information about a customer using the REST API of Shopware 6 (using this API). Therefor I need a ContextToken for that user. The only way to get a context token for a user is to log him in, but for that I need the password of a user which I do not have. Is there any way to get the ContextToken of a user with only his email address or hist customer id?
Shopware comes with 2 different APIs, the Store-API and the Admin-API. Refer to the docs.
The Store-API is there to build a storefront and thus you need to authenticate as the user using that API.
When you build custom integrations you should use the Admin-API, as that API can be used for CRUD-like operations on all entities of the system. For the admin API you can generate an API-Token and use it to query data of all customers.

How to get Authenticated user's Google Ad Account ID using Google Ads API v0 using a REST API?

I have been trying to figure out after referring to their official documentation (Google Ads API Document) which is not clear enough
Here is what I have tried till now.
I have created an app where users can log in with their Google Ad words account. I need to fetch their Ad performance reports via REST API.
To make an API request to fetch performance reports, we need the Google Ad Words Account ID of the authenticated user. Currently, as I am testing it with my personal account, I can login to my Ad words Console and get the Ad Words Account ID. But, how do I fetch the Ad Words Account ID dynamically for other users who authenticate via my App?
I tried looking for a way in their official documentation. But I couldn't figure out.
Could someone help me with the REST API URL which needs to be called to fetch the authenticated user's Ad words Account ID.
In addition to previous answer, I guess this is what you are looking for:
https://developers.google.com/adwords/api/docs/guides/first-api-call#create_test_accounts
It explains how to setup Google Ad Words API and get your ID.
According to the documentation here Account overview, you need to list the customers to get the ID. For each user that logs in as long as they do not have access to multiple accounts you should get a single customer and their ID.
CustomerService
CustomerService provides information about your accounts. It has a
getCustomers() method that takes no arguments and returns a list of
Customer objects containing fields such as customerId, currencyCode,
and dateTimeZone. CustomerService also has a mutate() method that can
be used to update various attributes of a customer, including the
autoTaggingEnabled and conversionTrackingSetting fields.
If no clientCustomerId is specified in a request, the response will
contain multiple entries if more than one account is directly
accessible by the authenticated account.

Obtaining userId with UberRUSH access token

I have a question regarding UberRUSH three-legged-oauth and webhooks.
We are developing multi-tenant application that will act on behalf of UberRUSH users.
We are implementing three-legged-oauth flow, and we want to use webhooks to update delivery statuses.
In webhooks documentation (https://developer.uber.com/docs/deliveries/guides/webhooks) I read that UberRUSH event will contain information about delivery id (meta.resource_id) and user id (meta.user_id).
As we internally store our entities in separate tenants (separate tenant per UberRUSH user) we need to map event's user_id to our tenant name.
The only way I can think about for building such map, is based on user's access token that we keep. We can decode it (JWT) and read it's sub property (Subject), as I assume it contains user's id.
My question is, is it valid and safe (can we rely on it and it will not change in predictable future) to obtain user's id that way, or maybe there is simpler way to do it?
Since you're using the 3-legged-oauth, one simpler way to do this is to use the /me endpoint from the Riders API. That would provide you with the following user data:
{
"picture": "https://d1w2poirtb3as9.cloudfront.net/f3be498cb0bbf570aa3d.jpeg",
"first_name": "Uber",
"last_name": "Developer",
"uuid": "f4a416e3-6016-4623-8ec9-d5ee105a6e27",
"rider_id": "8OlTlUG1TyeAQf1JiBZZdkKxuSSOUwu2IkO0Hf9d2HV52Pm25A0NvsbmbnZr85tLVi-s8CckpBK8Eq0Nke4X-no3AcSHfeVh6J5O6LiQt5LsBZDSi4qyVUdSLeYDnTtirw==",
"email": "uberdevelopers#gmail.com",
"mobile_verified": true,
"promo_code": "uberd340ue"
}
With the uuid, rider_id, and email you'd get identifying props for the user. Keep in mind, you need to request the profile scope during auth to being able to make the call to /me.

Linkedin REST API retrieve status updates of a user

I'm trying to retrieve the status updates of the authenticated user with the REST API. Is there a way to do that? I only can find a way to retrieve the status updates of the companies the user has admin rights of.
It is no longer possible with the standard LinkedIn API (If you look at their REST console, you can see all the public methods: https://apigee.com/console/linkedin?apig_cc=1).
You now need to join their partner program in order to access additional API methods now: https://developer.linkedin.com/partner-programs

Time lag creating merchant accounts via Balanced API

I just set up our first live merchant on Balanced Payments and am looking to credit them. In the account creation process, I received the redirect request in my code, I followed that.
I entered in the merchant data and account information, and was successfully redirected back to my site with the account URI and email.
I can successfully retrieve the account via the API, but I do not see it listed in the accounts list page on my balanced dashboard. Is there possibly some lag time before a new live merchant account would show up?
When Balanced creates a merchant for you via the KYC process, you're not passing any authentication information to the API which means Balanced does not have the ability to create objects within your account. This is important to note because:
Balanced will create a Merchant which represents an identity within the Balanced system (this identity is not associated to any particular marketplace), but it doesn't create the actual Account on your marketplace.
The documentation notes that it is the URI of this Merchant which is returned to you, however you will need to then use this identity to create an Account within your marketplace. You are able to do this as you have an API key to authenticate the request.
Here is an example of creating the account using the Balanced Ruby client:
# URL looks like https://yoursite.com/kyc/complete?email_address=merchant#exam
# ple.org&merchant_uri=/v1/merchants/MR3KJZgnQcg8OX8FrTWlRszn
merchant_uri = params[:merchant_uri] # alter to your framework for GET params
email_address = params[:email_address]
merchant = Balanced::Marketplace.my_marketplace.create_merchant(
email_address,
merchant_uri
)