In my React Native I set subscriber attributes before I make a purchase. However in the “NON_RENEWING_PURCHASE” webhook the attributes are sometimes missing. Is this a race condition in your system?
When I process the webhook I use the attributes to perform certain actions. What would you suggest is the most reliable way of making sure the attributes are synced correctly? Should I use the REST API within the webhook to fetch the attributes?
Code snippet from my app
Purchases.setAttributes(userAttributes)
log.info('Set user attributed', userAttributes)
await Purchases.purchaseProduct(productId, null, Purchases.PURCHASE_TYPE.INAPP)
An example of the subscriber_attributes I am expecting back in the webhook are:
{"subscriber_attributes": {
"ability": {
"updated_at_ms": 1637782170690,
"value": "BEGINNER"
},
"age": {
"updated_at_ms": 1637781232715,
"value": "24"
},
"custom_group_id": {
"updated_at_ms": 1637781232716,
"value": "abc123"
},
"days": {
"updated_at_ms": 1637782170688,
"value": "[\"Mondays\",\"Tuesdays\"]"
},
"goal": {
"updated_at_ms": 1637782170686,
"value": "FIVE_K"
},
"longRun": {
"updated_at_ms": 1637782170693,
"value": "Mondays"
},
"measurementSystem": {
"updated_at_ms": 1637782170696,
"value": "KILOMETERS"
},
"name": {
"updated_at_ms": 1637782170698,
"value": "Walter"
},
"numberOfDays": {
"updated_at_ms": 1637782170695,
"value": "2"
},
"planId": {
"updated_at_ms": 1637782170684,
"value": "EIGHT_WEEK_5K_IMPROVEMENT"
},
"planName": {
"updated_at_ms": 1637789290600,
"value": "8 Week 5k Improvement Plan"
},
"raceDay": {
"updated_at_ms": 1637782170687,
"value": "Saturday"
},
"raceTime": {
"updated_at_ms": 1637782170692,
"value": "20:00"
},
"raceTimeType": {
"updated_at_ms": 1637782170691,
"value": "5k"
}
}}