prediction explanation for specific customer - watson-openscale

I am thinking thru implementation pattern around churn problem. Scenario I am thinking about is pretty simple - for customers with propensity to churn to identify features of the account that could be changed/different plans offered, etc to try to retain them. For that, I would want to have visibility to “explainability” for these customers in Watson openscale – which is there – but not easy to get to and not searchable from UI. How would I approach this?

If I understood the questions correctly, you have lots of customers and there is a model which is predicting which customer is likely to leave and you want to generate an explanation of why the model predicted that a given customer would leave or not leave.
1) Each transaction (scoring done by the model) is associated with a transaction ID in Watson OpenScale. In order to generate an explanation for a specific customer, you need to provide the transaction ID associated with that customer. In case of Watson Machine Learning you can specify the transaction ID by setting the X-Global-Transaction-Id field in the HTTP header of the WML online scoring request. Details are available in the documentation: https://cloud.ibm.com/docs/services/ai-openscale?topic=ai-openscale-ie-ov
2) In case of non-WML serve engine, you can send the transaction ID while logging the payload using the payload logging REST API of Watson OpenScale.
3) If you are sending one customer data to the WML model in one online scoring request, then you can set the transaction ID to the customer ID. However, given that there will be millions of customers, I expect that multiple customers data would be sent to one WML online scoring request. In that case you will have to come up with some transaction ID for this request and have some mechanism to map the customer ID to the transaction ID. Note that if in one WML online scoring request you sent 5 customers data and the transaction ID is set to “T”, then the transaction ID for first customer will be T_1, that for the second customer will be T_2, ….upto T_5.
3) Once you are aware of the transaction ID to customer ID mapping, you will be able to generate an explanation for a specific customer by specifying his/her transaction ID. We have an API to find the explanation which has been generated. You can store the output of this GET API into a file (the response is a JSON).
Hope this answers your query.

Related

Get purchased product from PaymentIntent

in my app i want to list past purchases for a stripe customer. So I was looking at the relevant API objects like PaymentIntents, Sessions or Charges. But they all do not seem to contain any reference to Product or Price, which I would need to list the purchased products.
Subscriptions contain a list of items that are contained in that subscription, so I was expecting PaymentIntents to have something like that too.
Does anyone has an idea how to archive my list of past purchases? Thanks!
I did some digging through the Stripe API docs[1] and, out of the three objects you referrenced (PaymentIntent, Session, Charges), the only one that I can see being able to trace back to a product is the Session.
Session objects have a line_items property[2] which can be followed all the way down to line_items.data.price.product[3]. To access this you’ll need to inlcude the expand=["data.line_items"] parameter to your call to list Checkout Sessions. You can read more about expanding API responses here[4]
So for all the charges to your customers that were done using Checkout Sessions, you could list them all, use the customer property to associate earch session with a customer in your application, traverse the the returned data, and then query the API for the product details. If you have a lot of customers & products these API calls will add up fast so I would store this data in your back-end to avoid hitting rate limits[5].
Alternatively, you could just save the product ID (either Stripe or your local version) as metadata[6] for any of the above Stripe payment objects listed. That would allow you to link any payment object you wish to a product.
https://stripe.com/docs/api
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items
https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-line_items-data-price-product
https://stripe.com/docs/expand
https://stripe.com/docs/rate-limits
https://stripe.com/docs/api/metadata
I had the same question I found a way to retrieve the products related to a specific PaymentIntent.
You need to get the sessions that was linked to PaymentIntent when the Checkout process was made.
I will give you the code (in PHP) that I use to to this.
\Stripe\Stripe::setApiKey(STRIPE_API_SECRET);
// Find the Session for that PaymentIntent
$sessions = \Stripe\Checkout\Session::all([
'payment_intent' => "pi_xxxxxxxxxx",
'expand' => ['data.line_items'],
]);
You will then have an key line_items that contain the products linked.
Enjoy

node/rabbitmq : choreography asynchronous and reponse

Hello I have a question about choreography,
I know it's asynchronous, but in this context:
a requisition in endPoint / addEmployee (where to create an employee the existence in the department is necessary), I would check for an employee and send a message in my department queue to verify the existence and also sign up in the queue to hear the answer, would that be choreography?
Or when confirming the existence of the employee, should I create and send the response already? or can i send the response after consuming the departament queue?
Or in this case, would the orchestration be correct?
If I understand correctly you are receiving a request or a message which contains information to create an employee. One of those field is department name or id. And you would like to validate existence of this department information from department service. Is my understanding correct? If so I would say a lot easier solution would be keeping a basic department data on your employee service. You can get department created, updated events from department service and sync your data instead of asking for each and every employee.
With this solution you wont have a dependency between services. You will just listen the topic or queue to which you wont know where the message comes from which is total opposite of the coupling.

Level 3 data with Stripe Payments

I'm working on a SAAS system that allows purchases to be made through a clients own payment gateway. We have one client that wants to use Stripe as their gateway, however as they are using Corporate Purchase Cards (CPC), it is necessary to pass Level 3 transaction details through. I've been trying to get details from Stripe on how we ensure that Level 3 data can be passed through successfully, however I'm not really getting anywhere with this in terms of getting any definitive information we can work with.
Stripe say that their system supports level 3 data, we just need to provide the data in the first place, however there is nothing in their documentation about this and the example we have been provided only allows for a single item to be listed - we will need to support a basket of different items.
We are using the Payment Intents process and already support adding in Metadata to the transaction. We've been told that adding metadata for SKU, Unit of Measure, Unit Price and Extended Price will allow level 3 processing, however this does seem to fall short of the information list on other sources (not to mention does not allow listing multiple items in the order due to the metadata keys needing to be unique)
Baed on that, our Metadata population looks like this (values hard coded to example purposes)
Dictionary<string, string> nRetVar = new Dictionary<string, string>();
nRetVar.Add("Customer", "John Smith");
nRetVar.Add("Email", "John.Smith#example.com");
nRetVar.Add("Order Number", "12345");
nRetVar.Add("Order Date", "2020-02-06");
nRetVar.Add("SKU", "ABCD1234");
nRetVar.Add("Unit of Measure", "1 Pack");
nRetVar.Add("Unit Price", "$10.00");
nRetVar.Add("Extended Price", "$15.00");
Stripe support never seem to directly answer any of the questions we have been asking about this, so it's proving very hard to get any progress on this - does anyone have enough experience with this to confirm if this metadata is enough to class as level 3, or is there more that we need to be adding?
Stripe supports Level 3 data in their API on both Charge and PaymentIntent. This feature though is currently "gated" which means you need to get access to the feature on your specific account. It's a bit similar to a long running beta. You should contact their support team again and ask for them to enable Level 3 data on PaymentIntent for your account.
The fields they are expecting as specific to that feature. This does not go inside metadata. The documentation is also gated which means you can only see it once you get access to the feature, to avoid confusion for other developers who don't have access.
You can see what the shape looks like in stripe-java for example on Charge here. The feature is not directly supported on PaymentIntent in the library though as this is still private.

Track multiple context for the same Bot

We have a bot that will be used by different customers and depending on their database, sector of activity we're gonna have different answers from the bot and inputs from users. Intents etc will be the same for now we don't plan to make a custom bot for each customer.
What would be the best way to separate data per customer within Chatbase?
I'm not sure if we should use
A new API key for each customer (Do we have a limitation then?)
Differentiate them by the platform filter (seems to not be appropriated)
Differentiate them by the version filter (same it would feel a bit weird to me)
Using Custom Event, not sure how though
Example, in Dialogflow we pass the customer name/id as a context parameter.
Thank you for your question. You listed the two workarounds I would suggest, I will detail the pros/cons:
New API Key for each customer: Could become unwieldy to have to change bots everytime you want to look at a different users' metrics. You should also create a general api (bot) where you send all messages in order to get the aggregate metrics. This would mean making two api calls per message.
Differentiate by version filter: This would be the preferred method, however it could lengthen load times for your reports as your number of users grows. The advantage would be that all of your metrics are in one place, and they will be aggregated while only having to send one api call per message.

What identification document does the field legal_entity.personal_id_number designate?

I am trying to create a managed account for my user on Stripe Connect. I have been receiving different requests for different documents in the verification.fields_needed one at a time. I supply the one it says they need and then I get a new value in this field. So, my question(s) are:
1) Is there an exhaustive list of documents that are required for verification if the legal entity's country is US, so I can supply them to the API once and for all and not have to look at the additional documents requested in the Stripe response and send back another request? This makes it difficult to automate the process.
I referred to this document: https://stripe.com/docs/connect/required-verification-information
And supplied everything it asked for, but as you can see, legal_entity.personal_id_number isn't on that list and there is also no explanation for the meaning of this field.
2) What identification document does legal_entity.personal_id_number represent? The newest response I have received says it needs this to complete verification.
Personal_id_number in the US is the full social security number, its only needed if the account is unable to be verified using the last 4 digits or if the account hits $20k in volume which would require Stripe to fill out a 1099K
https://support.stripe.com/questions/What-is-the-process-for-verifying-managed

Resources