Dears, I have a problem that I can't access the mint flow variables through Apigee edge on prem.
I made the monetization configuration ( Api product with transaction recording policy, Api package, developer with MINT custom attributes and accepting the rate plan in that developer )
curl used to accept the rate plan :
curl --location '{HOST}/v1/mint/organizations/{org_name}/developers/{dev_id}/developer-rateplans' \
--header 'Content-Type: application/json' \
--header 'Authorization: auth' \
--data '{
"developer":{
"id":"{dev_id}"
},
"startDate":"2024-09-16",
"ratePlan":{
"id":"{rateplan_id}"
}
}'
curl used to issue a credit for that developer :
curl --location --request POST '{HOST}/v1/mint/organizations/{org_name}/monetization-packages/{package_id}/rate-plans/{rateplan_id}/real-currency-credit-transactions?billingMonth=SEPTEMBER&billingYear=2024¤cyId=usd&developerId={dev_id}&transactionAmount=400&transactionNote=test' \
--header 'Authorization: auth'
I'm trying to access this flow variable for example : mint.limitscheck.prepaid_developer_balance In a service callout policy placed in the post client flow.
Thanks for you time & help.
Solved! Go to Solution.
Hello William, hope you are well !
We've opened a ticket with the support team and they said that we have to migrate to Apigee edge Hybrid or X to use the mint flow variables, they don't work for the onprem installations right now.
Thanks alot for your help!
Thanks for posting a new question... I have a few questions as well.
Are you saying that you cannot see any monetization flow variables when you debug the proxy?
Are some populated and not others?
Is this flow variable visible in the debug session with a valid value, but when you attempt to access it in the Service Callout in the PostClientFlow then it is null/blank?
Which flow has the Monetization policy attached (proxy preflow, target preflow, etc.)?
Can you include a copy of that policy here so we can see how it is configured?
Do you receive an error message and can you include that here as well?
Thanks for your response !
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<MonetizationLimitsCheck enabled="true" continueOnError="false" async="false" name="monetization-limits-check">
<DisplayName>Monetization Limits Check</DisplayName>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
<Properties/>
<Variables>
<ClientId>client_id</ClientId>
<Product>apiproduct.name</Product>
</Variables>
<FaultResponse>
<Set>
<Payload contentType="text/xml">
<error>
<messages>
<message>Exceeded developer limit configuration - {monetizationLimits.limitsMessageList} </message>
<message>Is Developer Suspended - {monetizationLimits.isDeveloperSuspended} </message>
</messages>
</error>
</Payload>
<StatusCode>403</StatusCode>
<ReasonPhrase>Forbidden</ReasonPhrase>
</Set>
</FaultResponse>
</MonetizationLimitsCheck>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="SC-CallNotificationBackend">
<DisplayName>SC-CallNotificationBackend</DisplayName>
<Properties/>
<Request clearPayload="true" variable="myRequest">
<Set>
<Headers>
<Header name="Content-Type">application/json</Header>
</Headers>
<Verb>POST</Verb>
<Payload contentType="application/json">
{
"state": "200",
"currentDevBalance":{mint.limitscheck.prepaid_developer_balance}
}
</Payload>
</Set>
<IgnoreUnresolvedVariables>true</IgnoreUnresolvedVariables>
</Request>
<!--<Response>calloutResponse</Response>-->
<HTTPTargetConnection>
<Properties/>
<URL>https://webhook.site/9775114a-753f-45a1-9b38-b7060ba7ec2d</URL>
</HTTPTargetConnection>
</ServiceCallout>
I want to send the current developer balance and the state of the response to the webhook, the value of { mint.limitscheck.prepaid_developer_balance} is blank and I didn't receive any errors as well.
The purpose of This solution is to send a notification after each proxy call to the developer to notify him that his walet balance changed and tell him the new balance and the amount that has been changed. if you have a better way to solve this rather than using these flow variables please tell me.
It is odd that monetizationLimits.limitsMessageList is blank if the policy fires a 403. It seems like that variable should be populated with why it failed, and it may have something to do with how you configured monetization. Unless we can get someone here with OPDK Monetization enabled, I'm not sure I can answer this part of your question.
I can understand why notifying the developer after every request could be useful. We also have Monetization Notifications that will notify the developer after they reach a set level. You could try this approach too. But this doesn't answer your immediate question.
"1. yes I can not see all the mint flow variables, In the monetization limit check policy for example I can see the monetization variable that says if the developer is suspended or not, but the mint variables that shown in the Apigee flow variables not working for me."
Ok, so you cannot see all the mint flow variables in the debug window. One thing that you can try is create new flow variable and set the value to the monetization mint variable that you want to save; use the Assign Message policy for this. Then refer to the flow variable that you created in the AssignMessage policy. I think some mint values are available at certain points and some are for internal tracking.
I can see from our docs that the mint.limitscheck.prepaid_developer_balance scope begins at the proxy request flow and so it should be available in the PostClientFlow. Again, it seems odd that you can't see this in the trace and can't access it in the PostClientFlow. My only suggestion is listed above or try using a different mint variable (see below).
There is another variable, mint.
When I tried to access the variable you mentioned I found that it also has no value
from the screen shot you can see that I have the two variables with blank value so I also can not access this variable in the post client flow.
but I found something that might be useful, if you see that docs link "https://cloud.google.com/apigee/docs/api-platform/reference/variables-reference#flow-variable-termin..." you will find the mint flow variables available in it but you mentioned that " This page applies to Apigee and Apigee hybrid." and for this docs link " https://docs.apigee.com/api-platform/reference/variables-reference" that refers to Apigee edge documentation you can see that there is no reference for the "mint" flow variable.
Is that means that these mint variables are not available or not supported in the Apigee edge for private cloud ?
Monetization is supported for both. But if you are using OPDK, then you have to install it.
https://docs.apigee.com/private-cloud/v4.52.02/installing-monetization-services
Have you completed the OPDK installation steps for Monetization?
Yes the installation is done and we have no errors appears from the monetization already
I didn't mean that monetization is not supported for Apigee edge on prem, I mean that mint flow variables not supported since it's not present in the documentation flow variables at this refrence : https://docs.apigee.com/api-platform/reference/variables-reference%22
Yes, those variables should be supported in OPDK. I think our Edge docs need to be updated. Essentially, the mint variables should be populated after the Monetization Policy executes. I suspect that the issue is with your OPDK Monetization configuration/setup.
Could you please give me a reference that talking about Monetization configuration for that point? because what I can see is that the monetization is working fine with me and no issues with it.
This is the link that I pasted above. https://docs.apigee.com/private-cloud/v4.52.02/installing-monetization-services
I'm trying to do all this to know the recurring status of a developer, Do you have a suggestion to get the developer recurring status if it happened or not?
@williamssean Do you have any suggestions?
Yes, I would go back through your monetization setup step by step and make sure that everything is configured correctly. Check the logs as well after you send a request to confirm there are no errors or warnings regarding monetization.
Hello William, hope you are well !
We've opened a ticket with the support team and they said that we have to migrate to Apigee edge Hybrid or X to use the mint flow variables, they don't work for the onprem installations right now.
Thanks alot for your help!
Dear @ahmedgamal ,
I hope you are doing well,
Did you find any way to check the developer's remaining request in case the rate card is a Bundle?
How can I check the remaining balance? for the developer.
Also, did you try to use Apigee edge notifications to notify the developer of his remaining requests if his subscription is bundled not per request?
Thank you
Amer Hijazi