Can't create ad group - google-ads-api

Campaign:
{
"id": "1709932214",
"name": "Noah Baumbach",
"status": "ENABLED",
"servingStatus": "PENDING",
"startDate": "20190219",
"endDate": "20190220",
"budget": {
"budgetId": "1730787529",
"name": "Dominic Schumm",
"amount": {
"ComparableValue.Type": "Money",
"microAmount": "10000"
},
"deliveryMethod": "STANDARD",
"referenceCount": 5,
"isExplicitlyShared": true,
"status": "ENABLED"
},
"conversionOptimizerEligibility": {
"eligible": false,
"rejectionReasons": [
"CONVERSION_TRACKING_NOT_ENABLED"
]
},
"adServingOptimizationStatus": "OPTIMIZE",
"frequencyCap": {
"impressions": "100",
"timeUnit": "DAY",
"level": "CAMPAIGN"
},
"settings": [
{
"attributes": {
"xsi:type": "GeoTargetTypeSetting"
},
"Setting.Type": "GeoTargetTypeSetting",
"positiveGeoTargetType": "DONT_CARE",
"negativeGeoTargetType": "DONT_CARE"
}
],
"advertisingChannelType": "DISPLAY",
"networkSetting": {
"targetGoogleSearch": false,
"targetSearchNetwork": false,
"targetContentNetwork": true,
"targetPartnerSearchNetwork": false
},
"biddingStrategyConfiguration": {
"biddingStrategyType": "MANUAL_CPC"
},
"campaignTrialType": "BASE",
"baseCampaignId": "1709932214"
}
When I try to create ad group with below parameters:
{
campaignId: 1709932214,
name: 'Jess Hegmann',
status: 'ENABLED',
criterionTypeGroup: 'VERTICAL',
targetAll: false,
bidAmount: 10000,
biddingStrategyType: 'MANUAL_CPC',
biddingStrategyName: 'biddingName 123',
adGroupType: 'DISPLAY_STANDARD',
adGroupAdRotationMode: 'OPTIMIZE',
};
Google adwords give me an error:
Failed: "[OperationAccessDenied.OPERATION_NOT_PERMITTED_FOR_CAMPAIGN_TYPE # operations[0].operand.biddingStrategyConfiguration.biddingStrategyType; trigger:'DISPLAY']"
How can I solve this?

I think this might be the reason:
Starting with v201705, this field cannot be set at the ad group or ad group criterion level to any value other than BiddingStrategyType.NONE.
Bid Strategy AdGroup Google Ads

Related

Recently Issue face in Input.date and Input.choice in AdaptiveCard While Integrating chatBot with Teams

While using input.choice with confirmation message in adaptive card rest at that time dropdown of choice list is not showing up, we started facing this problem recently before it was working properly.
This was the code we were using at first when it was having proper behaviour
TeamsAdaptiveCardRest adaptiveCardRest = new TeamsAdaptiveCardRest();
List<TeamsItemsChoiceRest> choiceList =
createTeamsItemChoiceRestList((MapUserMessageRest) chatUserResponse.getOptions());
TeamsTextBlockRest textBlock = new TeamsTextBlockRest();
textBlock.setText(chatUserResponse.getMessage());
TeamsStaticItemListRest staticItemListRest = new TeamsStaticItemListRest();
staticItemListRest.setChoices(choiceList);
staticItemListRest.setPlaceholder("select");
staticItemListRest.setId(String.valueOf(chatUserResponse.getChatBrainId()));
TeamsToggleElementsRest enableConfirmationMessage = createToggleElements("confirmationToggle", true);
TeamsToggleElementsRest enableActionButton = createToggleElements("actionButton", true);
TeamsToggleActionRest toggleSelectAction = new TeamsToggleActionRest();
toggleSelectAction
.setTargetElements(Lists.newArrayList(enableConfirmationMessage, enableActionButton));
TeamsContainerRest inputChoiceContainer = new TeamsContainerRest();
inputChoiceContainer.setVisible(true);
inputChoiceContainer.setItems(Lists.newArrayList(textBlock, staticItemListRest));
inputChoiceContainer.setSelectAction(toggleSelectAction);
adaptiveCardRest.addInBody(inputChoiceContainer);
TeamsContainerRest confirmationMessageContainer = new TeamsContainerRest();
confirmationMessageContainer.setItems(
Lists.newArrayList(new TeamsTextBlockRest(chatUserResponse.getConfirmationMessage())));
confirmationMessageContainer.setId("confirmationToggle");
confirmationMessageContainer.setVisible(false);
adaptiveCardRest.addInBody(confirmationMessageContainer);
TeamsActionSubmitRest submitAction = new TeamsActionSubmitRest("Yes");
TeamsToggleElementsRest disableConfirmationMessage =
createToggleElements("confirmationToggle", false);
TeamsToggleElementsRest disableActionButton = createToggleElements("actionButton", false);
TeamsToggleActionRest toggleDisabledAction = new TeamsToggleActionRest();
toggleDisabledAction
.setTargetElements(Lists.newArrayList(disableConfirmationMessage, disableActionButton));
toggleDisabledAction.setTitle("Cancel");
TeamsActionSetRest actionButtionSetRest = new TeamsActionSetRest();
actionButtionSetRest.setVisible(false);
actionButtionSetRest.setId("actionButton");
actionButtionSetRest.setActions(Lists.newArrayList(submitAction, toggleDisabledAction));
adaptiveCardRest.addInBody(actionButtionSetRest);
return adaptiveCardRest;
Json for the above code:
{
"type": "AdaptiveCard",
"version": "1.5",
"body": [
{
"type": "Container",
"id": null,
"items": [
{
"type": "TextBlock",
"text": "Input.choice",
"wrap": true
},
{
"type": "Input.ChoiceSet",
"choices": [
{
"title": "a",
"value": "aa",
"id": "aa"
}
],
"id": "39",
"value": null,
"placeholder": "select"
}
],
"selectAction": {
"type": "Action.ToggleVisibility",
"title": null,
"id": null,
"targetElements": [
{
"elementId": "confirmationToggle",
"visible": true,
"isVisible": true
},
{
"elementId": "actionButton",
"visible": true,
"isVisible": true
}
]
},
"visible": true,
"isVisible": true
},
{
"type": "Container",
"id": "confirmationToggle",
"items": [
{
"type": "TextBlock",
"text": "Are you sure?",
"wrap": true
}
],
"selectAction": null,
"visible": false,
"isVisible": false
},
{
"type": "ActionSet",
"actions": [
{
"type": "Action.Submit",
"title": "Yes",
"associatedInputs": "auto",
"data": null
},
{
"type": "Action.ToggleVisibility",
"title": "Cancel",
"id": null,
"targetElements": [
{
"elementId": "confirmationToggle",
"visible": false,
"isVisible": false
},
{
"elementId": "actionButton",
"visible": false,
"isVisible": false
}
]
}
],
"id": "actionButton",
"visible": false,
"isVisible": false
}
],
"selectAction": null,
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
}
We are facing same issue in input.date with confirmation message in that dropdown of datepicker doesn't show up
Due to the change in behaviour the dropdown of input.choice and input.date Doesn't show with confirmation message so It was working properly before but recently behaviour changed, So want to know the reason behind the change in behaviour.
enter image description here

Get /me/events/{id} returns incorrect calendar object

I tried to fetch list of events from /me/events?$expand=calendar endpoint
and it returns correct calendar object in response.
However, when I tried to fetch one particular event, I received a different calendar.
API used: /me/events/{id}?$expand=calendar
The user has 4 calendars (verified using /me/calendars).
And the calendar id received from /me/events/{id}?$expand=calendar doesn't match with any of them.
Edit
Below are responses for more clarification
End point to list all calendars
https://graph.microsoft.com/v1.0/me/calendars
Response:
{
"value": [
{
"id": "<CALENDAR_ID_1>",
"name": "Calendar",
"color": "auto",
"changeKey": "<changeKey>",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"owner": {
"name": "<Name>",
"address": "<Email>"
}
},
{
"id": "<CALENDAR_ID_2>",
"name": "Birthdays",
"color": "auto",
"changeKey": "<changeKey>",
"canShare": false,
"canViewPrivateItems": true,
"canEdit": false,
"owner": {
"name": "TestVoIP 1",
"address": "<Email>"
}
},
....
]
}
List all events
https://graph.microsoft.com/v1.0/me/events?$expand=calendar
Response:
{
"value": [
{
"id": "<EVENT_ID_1>",
... some other properties
"calendar": {
"id": "<CALENDAR_ID_1>", // Note that this is the calendar id for EVENT_ID_1
"name": "Calendar",
"color": "auto",
"changeKey": "<changeKey>",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"owner": {
"name": "<Name>",
"address": "<Email>"
}
},
},
{
"id": "<EVENT_ID_2>",
... some other properties
"calendar": {
"id": "<CALENDAR_ID_1>",
"name": "Calendar",
"color": "auto",
"changeKey": "<changeKey>",
"canShare": true,
"canViewPrivateItems": true,
"canEdit": true,
"owner": {
"name": "<Name>",
"address": "<Email>"
}
},
},
...
]
}
Get event with ID
https://graph.microsoft.com/v1.0/me/events/<EVENT_ID_1>?$expand=calendar
Response:
{
"id": "<EVENT_ID_1>",
... some other properties
"calendar": {
"id": "<DIFFERENT_CALENDAR_ID>", // Note that this is entirely different calendar id than we noted in list of events response AND its not available in list of calendars response too
"name": null,
"color": "auto",
"changeKey": null,
"canShare": false,
"canViewPrivateItems": false,
"canEdit": false,
"owner": null
}
}

Expanding singleValueExtendedProperty not working when retrieving Event details

I am trying to retrieve custom property value for an event using Microsoft Graph.
The custom property was created by an Outlook Office.js Add-ing
Here is request
/v1.0/me/events/{id}?$expand=singleValueExtendedProperties($filter=id eq 'String {00020329-0000-0000-C000-000000000046} Name myCusProp')
This returns a successful response from Graph but it does not return the singleValueExtendedProperty. The Outlook add-in, however, is still able to retrieve the property value from the same Event.
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('{id}')/events/$entity",
"#odata.etag": "W/\"SdXmMkSN8kCNtzTsQ4x1lwAD7sMWVg==\"",
"id": "{id}",
"createdDateTime": "2019-09-30T10:12:34.110571Z",
"lastModifiedDateTime": "2019-09-30T10:23:57.8338159Z",
"changeKey": "SdXmMkSN8kCNtzTsQ4x1lwAD7sMWVg==",
"categories": [],
"originalStartTimeZone": "blah blah",
"originalEndTimeZone": "blah blah Standard Time",
"iCalUId": "040000008...EBBE4999DC5A61D31AC544",
"reminderMinutesBeforeStart": 15,
"isReminderOn": true,
"hasAttachments": false,
"subject": "WWW-002",
"bodyPreview": "rt",
"importance": "normal",
"sensitivity": "normal",
"isAllDay": false,
"isCancelled": false,
"isOrganizer": true,
"responseRequested": true,
"seriesMasterId": null,
"showAs": "busy",
"type": "singleInstance",
"webLink": "https://outlook.office365.com/owa/?itemid=AQMkADU2OWFjYTFjLWNkMGYtNDdlNS1hNDIxLWIxYjlmY...DqyJu%2FWyzJk6m5v0MbSs7lwcASdXmMkSN8kCNtzTsQ4x1lwAAAgENA...AD7q52owAAAA%3D%3D&exvsurl=1&path=/calendar/item",
"onlineMeetingUrl": null,
"recurrence": null,
"responseStatus": {
"response": "organizer",
"time": "0001-01-01T00:00:00Z"
},
"body": {
"contentType": "html",
"content": "<html>\r\n<head>\r\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\r\n<meta content=\"text/html; charset=us-ascii\">\r\n</head>\r\n<body>\r\n<div>rt</div>\r\n</body>\r\n</html>\r\n"
},
"start": {
"dateTime": "2019-09-19T02:30:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2019-09-19T03:00:00.0000000",
"timeZone": "UTC"
},
"location": {
"displayName": "",
"locationType": "default",
"uniqueIdType": "unknown",
"address": {},
"coordinates": {}
},
"locations": [],
"attendees": [],
"organizer": {
"emailAddress": {
"name": "Info a",
"address": "name#domain.com"
}
}
}
----Update 1 - office.js code-----
This is office-js/outlook-add-in code reference above.
The custom property value can be read here without an issue.
const item = Office.context.mailbox.item;
item.loadCustomPropertiesAsync(asyncResult => {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
let customProps = asyncResult.value;
customProps.set("myCusProp", "google.com");
customProps.saveAsync(asyncResult => {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
item.loadCustomPropertiesAsync(asyncResult => {
const customProps = asyncResult.value;
const myCusProp = customProps.get("myCusProp");
})
}
});
}
});
From documentation:
id eq 'String {00020329-0000-0000-C000-000000000046} Name cecp-<add-in id from manifest>'
Instead of myCusProp use cecp-/* add-in id from manifest */
Add-in id is the guid from manifest, this response has a custom properties as JSON.

Get OData option set values and names

I am using odata api, now I have an attribute on an entity that is an option select like :
attribute name is : status
values are: 1, 2, 3
names: done, progress, new
the thing is when I am using postman to fetch metadata and all I get for the fields 'status' its that its type integer.
Question how do I fetchj option names and values from metadata so I get values and names in response ?
Currently I get this:
<Property Name="status" Type="Edm.Int32">
<Annotation Term="Org.OData.Core.V1.Description" String="" />
</Property>
But I want to get the value and names on response ?
This could be vastly simplified, assuming all you want are the int values, and names for a particular option set attribute of an entity:
GET [Organization URI]/api/data/v8.2/EntityDefinitions(LogicalName='contact')/Attributes(LogicalName='status')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet($select=Options),GlobalOptionSet($select=Options)
The $select=LogicalName is just so it doesn't return all the other metadata for the attribute, and the $expand=OptionSet($select=Options) is for local option sets, and the GlobalOptionSet($select=Options) is for Global. If you know what type it is, you can skip it the other, but if you are putting this logic in a shared library (you are aren't you?) then adding both won't hurt:
{
"#odata.context":"http://YourOrg.com/YourInstance/api/data/v8.2/$metadata#EntityDefinitions('new_entity')/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata(LogicalName,OptionSet,GlobalOptionSet,OptionSet(Options),GlobalOptionSet(Options))/$entity",
"LogicalName":"new_familyshortname",
"MetadataId":"dc11c01f-b6bd-4664-82d0-3a521841c1f5",
"OptionSet#odata.context":"http://YourOrg.com/YourInstance/api/data/v8.2/$metadata#EntityDefinitions('new_entity')/Attributes(dc11c01f-b6bd-4664-82d0-3a521841c1f5)/Microsoft.Dynamics.CRM.PicklistAttributeMetadata/OptionSet(Options)/$entity",
"OptionSet":null,
"GlobalOptionSet":{
"#odata.type":"#Microsoft.Dynamics.CRM.OptionSetMetadata",
"Options":[
{
"Value":117280000,
"Label":{
"LocalizedLabels":[
{
"Label":"English Value 1",
"LanguageCode":1033,
"IsManaged":true,
"MetadataId":"3cb6bbd5-796f-e111-8cf3-3cd92b023782",
"HasChanged":null
},
{
"Label":"French Value 1",
"LanguageCode":1036,
"IsManaged":false,
"MetadataId":"d88be67d-4a7d-e411-8890-0050569f1654",
"HasChanged":null
}
],
"UserLocalizedLabel":{
"Label":"English Value 1",
"LanguageCode":1033,
"IsManaged":true,
"MetadataId":"3cb6bbd5-796f-e111-8cf3-3cd92b023782",
"HasChanged":null
}
},
"Description":{
"LocalizedLabels":[
{
"Label":"",
"LanguageCode":1033,
"IsManaged":true,
"MetadataId":"3db6bbd5-796f-e111-8cf3-3cd92b023782",
"HasChanged":null
}
],
"UserLocalizedLabel":{
"Label":"",
"LanguageCode":1033,
"IsManaged":true,
"MetadataId":"3db6bbd5-796f-e111-8cf3-3cd92b023782",
"HasChanged":null
}
},
"Color":null,
"IsManaged":true,
"MetadataId":null,
"HasChanged":null
},
... MORE ...
],
"MetadataId":"dcbbe460-bedb-4985-9a17-2f3dbc637594"
}
}
According to this article this is a multi-step process.
Please note that all the examples use HTTP GET.
First retrieve the entity's MetaData Id (for this example we're using the entity 'account'):
https://myOrg.crm.dynamics.com/api/data/v8.2/EntityDefinitions?$select=LogicalName,MetadataId&$filter=LogicalName eq 'account'
Returns:
{
"#odata.context": "https://myOrg.crm.dynamics.com/api/data/v8.2/$metadata#EntityDefinitions(LogicalName,MetadataId)",
"value": [{
"LogicalName": "account",
"MetadataId": "70816501-edb9-4740-a16c-6a5efbc05d84"
}]
}
Then retrieve the attribute's MetaDataId (in this example we're using the option set 'customertypecode'):
https://myOrg.crm.dynamics.com/api/data/v8.2/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)?$select=LogicalName&$expand=Attributes($select=LogicalName;$filter=LogicalName eq 'customertypecode')
Returns:
{
"#odata.context": "https://myOrg.crm.dynamics.com/api/data/v8.2/$metadata#EntityDefinitions(LogicalName,Attributes(LogicalName))/$entity",
"LogicalName": "account",
"MetadataId": "70816501-edb9-4740-a16c-6a5efbc05d84",
"Attributes#odata.context": "https://myOrg.crm.dynamics.com/api/data/v8.2/$metadata#EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes(LogicalName)",
"Attributes": [{
"#odata.type": "#Microsoft.Dynamics.CRM.PicklistAttributeMetadata",
"LogicalName": "customertypecode",
"MetadataId": "4e33af09-ba43-4365-a747-c7e4f9992172"
}]
}
Then query with the entity's and attribute's MetadataIds to get the option set values:
https://myOrg.crm.dynamics.com/api/data/v8.2/EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes(4e33af09-ba43-4365-a747-c7e4f9992172)/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?$select=LogicalName&$expand=OptionSet
Returns (truncated at 2 values):
{
"#odata.context": "https://myOrg.crm.dynamics.com/api/data/v8.2/$metadata#EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes/Microsoft.Dynamics.CRM.PicklistAttributeMetadata(LogicalName,OptionSet)/$entity",
"LogicalName": "customertypecode",
"MetadataId": "4e33af09-ba43-4365-a747-c7e4f9992172",
"OptionSet#odata.context": "https://myOrg.crm.dynamics.com/api/data/v8.2/$metadata#EntityDefinitions(70816501-edb9-4740-a16c-6a5efbc05d84)/Attributes(4e33af09-ba43-4365-a747-c7e4f9992172)/Microsoft.Dynamics.CRM.PicklistAttributeMetadata/OptionSet/$entity",
"OptionSet": {
"MetadataId": "3629e642-b895-41ab-8f1d-ea5bfa30e992",
"HasChanged": null,
"IsCustomOptionSet": false,
"IsGlobal": false,
"IsManaged": true,
"Name": "account_customertypecode",
"ExternalTypeName": null,
"OptionSetType": "Picklist",
"IntroducedVersion": "5.0.0.0",
"Description": {
"LocalizedLabels": [{
"Label": "Type of the account.",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "73f68e38-c78d-48a5-80cb-bee895baab2b",
"HasChanged": null
}],
"UserLocalizedLabel": {
"Label": "Type of the account.",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "73f68e38-c78d-48a5-80cb-bee895baab2b",
"HasChanged": null
}
},
"DisplayName": {
"LocalizedLabels": [{
"Label": "Relationship Type",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "e5d47366-fd09-41e6-96a1-cbfdd113b932",
"HasChanged": null
}],
"UserLocalizedLabel": {
"Label": "Relationship Type",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "e5d47366-fd09-41e6-96a1-cbfdd113b932",
"HasChanged": null
}
},
"IsCustomizable": {
"Value": true,
"CanBeChanged": false,
"ManagedPropertyLogicalName": "iscustomizable"
},
"Options": [{
"Value": 1,
"Color": null,
"IsManaged": true,
"ExternalValue": null,
"MetadataId": null,
"HasChanged": null,
"Label": {
"LocalizedLabels": [{
"Label": "Competitor",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6c54c2fa-2241-db11-898a-0007e9e17ebd",
"HasChanged": null
}],
"UserLocalizedLabel": {
"Label": "Competitor",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6c54c2fa-2241-db11-898a-0007e9e17ebd",
"HasChanged": null
}
},
"Description": {
"LocalizedLabels": [],
"UserLocalizedLabel": null
}
},
{
"Value": 2,
"Color": null,
"IsManaged": true,
"ExternalValue": null,
"MetadataId": null,
"HasChanged": null,
"Label": {
"LocalizedLabels": [{
"Label": "Consultant",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6e54c2fa-2241-db11-898a-0007e9e17ebd",
"HasChanged": null
}],
"UserLocalizedLabel": {
"Label": "Consultant",
"LanguageCode": 1033,
"IsManaged": true,
"MetadataId": "6e54c2fa-2241-db11-898a-0007e9e17ebd",
"HasChanged": null
}
},
"Description": {
"LocalizedLabels": [],
"UserLocalizedLabel": null
}
}
}
}

json data stripe webhook

Im trying to implement stripe webhooks in my rails app. The webhook send this json data.
{ "created": 1326853478, "livemode": false, "id": "evt_00000000000000", "type": "invoice.payment_succeeded", "object": "event", "request": null, "pending_webhooks": 1, "api_version": "2017-06-05", "data": {
"object": {
"id": "in_00000000000000",
"object": "invoice",
"amount_due": 500,
"application_fee": null,
"attempt_count": 1,
"attempted": true,
"charge": "_00000000000000",
"closed": true,
"currency": "usd",
"customer": "cus_00000000000000",
"date": 1501950408,
"description": null,
"discount": null,
"ending_balance": 0,
"forgiven": false,
"lines": {
"data": [
{
"id": "sub_BLXcTSekdHflq5",
"object": "line_item",
"amount": 500,
"currency": "usd",
"description": null,
"discountable": true,
"livemode": true,
"metadata": {
},
"period": {
"start": 1507246341,
"end": 1509924741
},
"plan": {
"id": "Subscriber",
"object": "plan",
"amount": 500,
"created": 1501901993,
"currency": "usd",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {
},
"name": "Subscriber",
"statement_descriptor": "WatchBuddie Stream sub",
"trial_period_days": null
},
"proration": false,
"quantity": 1,
"subscription": null,
"subscription_item": "si_1AyqWnFr5iCt1Tv7n23zDLOM",
"type": "subscription"
}
],
"total_count": 1,
"object": "list",
"url": "/v1/invoices/in_1AnV6yFr5iCt1Tv7PnqZ0EUA/lines"
},
"livemode": false,
"metadata": {
},
"next_payment_attempt": null,
"paid": true,
"period_end": 1501950408,
"period_start": 1501950408,
"receipt_number": null,
"starting_balance": 0,
"statement_descriptor": null,
"subscription": "sub_00000000000000",
"subtotal": 500,
"tax": null,
"tax_percent": null,
"total": 500,
"webhooks_delivered_at": 1501950409
} } }
webhook method
def webhooks
begin
event_json = JSON.parse(request.body.read)
event_object = event_json['data']['object']
#refer event types here https://stripe.com/docs/api#event_types
case event_json['type']
when 'invoice.payment_succeeded'
#Update the total subscription total
#Send in email to the user telling them that they resubbed
logger.debug event_object['lines']['id']
end
My question is how do I get the "id": "sub_BLXcTSekdHflq5" I tried
logger.debug event_object['lines']['id']
It doesn't seem to be working what am I doing wrong? I'm sure its just a syntax thing that I am not understanding.
Thanks for all the help!
Figured it out the lines data was in a hash so you had to iterate over it. This is what I did for anyone who comes across this.
event_object['lines']['data'].each{ |i|
sub_id = i['id']
logger.debug sub_id
}

Resources